Re: php parsing and db content
| From: | Schalk | Date: | Thu, 11 May 2006 03:42:32 +0000 |
| Subject: | Re: php parsing and db content | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235959@lists.php.net to get a copy of this message | ||
Chris wrote:
Chris wrote:The reason I need root in there is because sometimes it would be something like text > link > link, so in these cases I cannot merely prefix _root. -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.DevelopersSchalk wrote:.... actually if it's only one variable, this might do it for you: $content = str_replace('<?php echo _root ?>', _root, $content); but that's still a bad way to do this. Chris,Greetings All, I have the following problem. I load certain links and breadcrumbs from the database into a external .php file which I include on various pages within the site. Due to this I have defined a constant '_root' and precede all links with this to ensure that the links will work no matter from where inside the site structure they are called. My problem is this, when I load these links from the database into the external .php file and the load the page that includes this, the line <?php echo _root ?> is not parsed and shows up in the links, for example: /our_work/<?php echo _root ?>/our_work/index.php when it should be /site_root/our_work/index.php How can I ensure that these calls to <?php echo _root ?> are parsed before sent to the browser?Why do you need to store _root in the data? Wouldn't it be better to take it out and then prefix it before displaying? No complications then.