Jump to content

Sequential FIle Append


Recommended Posts

Hello, I am in need of some help - I am trying to write a sequential file and create this file 18x advancing the count on each file name...I found a script for adding date and time but the effect I want is to create 18 PHP files ....where hole goes from 1 to 18 ... 

 

; Here is the original filename
$sFile = "C:\Group_1_hole_1_wk1.php"

; Separate the name and extension
$aSplit = StringSplit($sFile, ".")

; And concatenate in the date/time macros
$sNewFile = $aSplit[1] & " " & Group_1_hole_(this variable would be 1 and then repeat 2 then 3 etc. until 18)

; And here we are
MsgBox(0, "New name", $sNewFile)
Link to comment
Share on other sites

Just put it in a for loop and use string replace.  Basic example:

#include <Array.au3>

; Here is the original filename
Local $sFile = "C:\Group_1_hole_1_wk1.php"
Local $aFile[19] = [18]
For $i = 1 To 18
    $aFile[$i] = StringReplace($sFile, "Group_1_hole_", "Group_" & $i & "_hole_")
Next
_ArrayDisplay($aFile)

 

Edited by Subz
Link to comment
Share on other sites

Ty Subz...

So I want to open a file call Group_1_hole_1_wk1. php .. then insert 50 lines of code - with some variables...i.e title, what week and what hole they are playing ... then close the file and do the same moving forward.

Is there a way to replace text within the file - in a similar array ... 

<?php /* Template Name: Sk_G3_H6_WK2 */  ---- This would be the same as the title of the file.....

 ?>


<?php require_once 'connection.php';?>

<?php
header( "refresh:5;url=http://golfsettlers.com/7th-hole-skins-g3-wk1/" );        This would be whatever hole the file is plus 1.

  $gross_player = $connection->prepare('SELECT players.name AS player_name, leagues.name AS League, groups.name AS GroupName, teams.name AS Teams, (scorecard.net_6 ) Gross_Score FROM groups INNER JOIN scorecard ON groups.id = scorecard.group_id INNER JOIN teams ON teams.id = scorecard.team_id INNER JOIN leagues ON leagues.id = scorecard.league_id INNER JOIN players ON players.id = scorecard.player_id WHERE leagues.id = 1 AND net_6 > 0 AND scorecard.date_played = 2 AND players.skins = 3 Order by Gross_Score ASC  LIMIT 15');
 $gross_player->execute();
 $gross_players = $gross_player->fetchAll();

?>

 

Link to comment
Share on other sites

12 minutes ago, FrancescoDiMuro said:


EDIT: @bigbamboom
Is this script related somehow to a game?

Doesnt look like some digital game, but a real game of Golf, also search for the phrase "bigbamboom Golf" on google and a brand of Golf Polo Shirts shows up.

Seems legit to me ;)

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

  • Moderators
47 minutes ago, Werty said:

Doesnt look like some digital game, but a real game of Golf, also search for the phrase "bigbamboom Golf" on google and a brand of Golf Polo Shirts shows up.

Seems legit to me ;)

Rather than guessing at what the OP is doing, how about we let them explain?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

1 hour ago, Werty said:

Doesnt look like some digital game, but a real game of Golf, also search for the phrase "bigbamboom Golf" on google and a brand of Golf Polo Shirts shows up.

Seems legit to me ;)

It is for a golf scoring website for a group of men. The issue is each week we have 3 Groups of Golfers, Group 1,2,3 and 18 holes and 20 weeks in our league - each "hole" needs it's own PHP to work which is 1024 pages. I was hoping there was an easy fix which would create the sequential PHP files I need...making my life easier.

Link to comment
Share on other sites

I'm trying - I have done some light autoit - but this while hard to me - I am hoping is an easy task to create the autoit files I need.

in three steps:

1. Create the proper file 

2. Append the file by pasting in the php and substituting hole, week etc. 

3. Close the file

Each Season will have 20 new weeks (i.e season one week 1-20, season 2 week 21-40 etc.)  and it is a volunteer website - this is not for profit - or for gaming purposes - just a rec league with a volunteer webmaster who has 3 kids, 2 dogs and 3 cats - and no time! 

 

Edited by bigbamboom
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...