Re: Command Line PHP Advice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux