Page 1 of 1

does it possible

Posted: Wed Feb 23, 2011 10:45 am
by mohsin360
i want to make a web of computers which having thumbs and prices and product name and no .my client is a lammer like me so i want to make it from the function include so he can edit the prices and product numbers by just editing notepad files by using include function .the problem is that web contain a lot of categories and a lot of products if i use include function for each one there are so many notepad files require all i need is can i use explode function with in include function so there is one file for each category and i can include its lines or coma seperated values to include?sory for poor english

Re: does it possible

Posted: Wed Feb 23, 2011 11:26 am
by Jonah Bron
Yes, you can use explode() on it. But you won't use include, you'd use file().

http://php.net/file

File() loads the file, and splits it into an array at each line.

Re: does it possible

Posted: Wed Mar 02, 2011 1:19 pm
by mohsin360
$file = explode("\n", file_get_contents('txtfile.txt'));

echo $file[2];

Re: does it possible

Posted: Wed Mar 02, 2011 1:42 pm
by AbraCadaver
mohsin360 wrote:$file = explode("\n", file_get_contents('txtfile.txt'));

echo $file[2];
Or as Jonah said:

Code: Select all

$lines = file('txtfile.txt');