Forum Moderators: coopster
Okay, say I've got a page that goes something like this
...<body>
<!-- header -->
<p>Body text</p>
<!-- footer -->
</body>...
I want to use php to replace the comments with code I've read from external files and stored in variables. I've found stuff about using str_replace, but I can't figure out how it works.
Thanks,
Erik
What about using include [ca3.php.net]? You could then include a file which reds the value you need and then echo's it.
A little more explanation of what you want to do, as opposed to how, might help give you a little better insight.
If you are using plain text then it can be done in this way :
$mytext=".... your text"
$uncommentedtext = str_replace("<!--","",$mytext);
I guess my goal is to not hardcode the same structural code for certain page elements.
If there's a better way to do this, I'm open to suggestions.
A dynamic site in 2 minutes [webmasterworld.com]