Dynamic PHP File I/O to display in web page.

Posted 13 September 2009 - 11:07 AM

I have a tester website I put before I put any code up for my parents business, and while trying to make a testimonial display box, I ran into some issues because I wanted to have php load the pages dynamically, here is the site. Testing Site. Never mind the colors, that's just so I can see visually how the code is working. Anyways, here is the php/html main portion of the site.

Very simple looking, right? I like my code that way, anyways. The noembed tags are to remove t35 ads, seeing as it pins them to each of the include files. They don't give any problems. And here is my main.php file. (This is the one I try to get all dynamic with.)

That reads from this list: Testimonial List
What I would like is maybe to have the web page automatically generated when a new addition is listed on that list. (Maybe incrementing creating testimonial2.php, testimonial3.php, etc.) And then have the Customer and the Text beneath be displayed, which would be from the main.php file.
I know this is a lot to ask, it's just that I'm a html/css guy and php is something I'm just starting to pick up, but I'd really appreciate some help, and I hope I've provided enough code for you guys here to get the "jist" of it.

Re: Dynamic PHP File I/O to display in web page.

If I understand you correctly, when a testimonial is added, you should open the file for append ("a"), and instead of fgets() like you do in reading, use fputs().

Thanks for the reply. Yes, this is true for inputting the testimonials, but how would I make it so it reads them, using formatted based on the capitalized word that is before them. (AKA CUSTOMER: and TEXT:). If this isn't clear, just tell me. Thanks!

Re: Dynamic PHP File I/O to display in web page.

Posted 14 September 2009 - 03:30 PM

Sorry, here it is.http://copshopinc.t3...imonialList.txt
I changed my code a bit, I'm now using an array similar to this $arr = array(1=>"name one", 2=>"name two") etc etc, and then I'm searching for that name in the text, and printing the name and the subsequent line. And I'm using $_GET["id"] in order to get pages for the index of the array.