Re: Command Line PHP Advice

From: Date: Sun, 29 Jan 2006 06:54:20 +0000
Subject: Re: Command Line PHP Advice
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-229415@lists.php.net to get a copy of this message
Angelo Christou wrote:
I read that it's better to split scripts up into small reusable parts so my plan is to keep the logic out of the edit.php script and simply pass the variables to it using another script. Am I on the right path doing this? That is a good ideology, but whether it's best for your script depends on the data. I, personally, would probably split it up, just to keep things clear and separated so when I go back to it later, I can more easily modify it..
I am only a beginner with PHP so I admit I don’t really know what I’m doing, that is why I am asking for pointers from the PHP Mail List :) Below is my model, however I am unsure how to achieve this or even if it's the best way to do it? open filelist.txt for each line create $filename $var1 $var2 then run ./edit.php $filename $var1 $var2 loop back to the next line end
That looks good to me. It's not too difficult to jsut throw something together with the file() function. If your file gets really big you may want to look into reading the file line by line with fopen() / fgets(). But if you're going to be running it once a month only, file() should work fine.
Many thanks in advance, Ang. --------------------------------- Do you Yahoo!? With a free 1 GB, there's more in store with Yahoo! Mail. Chris


« previous php.general (#229415) next »