Rather, advanced I suppose type of question
| From: | Jenni &/or Patrick | Date: | Sat, 19 Aug 2000 05:55:19 +0000 |
| Subject: | Rather, advanced I suppose type of question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12565@lists.php.net to get a copy of this message | ||
I'm currently implementing a website for myself, and have been using PHP for
sometime, and it seems to work for what I want.
My site is stored in a database, and I would like to go through the returned
page, and replace my "tags" with appropriate variables.
Now, I know I could $the_var = str_replace ("<DOC:CONTENTS>",
$doc["contents"], $the_variable).
However, I don't really want to have str_replace millions of times :)
What I would like to do is something like
$the_var = ereg_replace ("<pss:($tag):($variable)>",
"{${$tag}[$variable]}", $the_variable);
Using Apache's re-write rules I can re-write a url /merc/$1/$2 to
/something.php?abc=$1&def=$2, using ^/merc/([^/]+)/?(.*)
Would something like <pss:([^:]+):?(.*)> be possible?
I come from a windows background, so am still not really used to regular
expressions :)
(Please note I have not tried the ereg_replace example I gave, it was just a
way of showing something of what I would like).
This really does have to work on _both_ Win32 (Apache.cgi) and Linux
(Apache.mod)
Thanks,
Patrick.