RE: [PHP] Matching strings in a flat/text file?
| From: | Jack Dempsey | Date: | Tue, 23 Oct 2001 05:20:27 +0000 |
| Subject: | RE: [PHP] Matching strings in a flat/text file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71895@lists.php.net to get a copy of this message | ||
lots of ideas nick, but can you use a database? MySQL is free and i've found
its almost always better to use databases when you can...
if you can't, you could do something like this:
1. find the pos of the string you need using strpos
2. find the pos of the ending delimiter
3. substr from the first pos to the end (you'll need to add/subtract some
strlen's to slice off the delimiters as well...
jack
-----Original Message-----
From: Nick Richardson [mailto:res04qlq@gte.net]
Sent: Tuesday, October 23, 2001 1:10 AM
To: php-general@lists.php.net
Subject: [PHP] Matching strings in a flat/text file?
Hey everyone,
Anyone out there know how i could do this:
I have a client who is an import car tuner. They would like to feature the
cars they work on in their website. Instead of creating a new .html or .php
file for every car they add to include the background setup, and the general
content (type of car, owner, etc...) i want to put the information in to
text file and search for it in there.
So that's where i need help. I want to be able to put the info into a text
file and pass the string to search for through the URL, then match
everything between that line and an ending line in the text file, and print
that out to the browser.
Example: I want to pass a string using the URL (blah.php?car=civic_si) then
search for ##civic_si in the text file, and print everything until it finds
##end. So the text file will look like this:
##civic_si
This is my content, blah blah
##end
##nissan
This is more content... yadda yadda
##end
Any ideas on how i can do this???
//Nick Richardson
//esoteric.web@gte.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net