Jump to content

str_replace but with a difference!!!


willpower

Recommended Posts

Hi

I have a string called $text.

It looks like this $text="<h1>Vacancies</h1>[INCLUDE JOBLIST]<p>for more information...blah</p>"

Now I need to echo the $text so that the [INCLUDE JOBLIST] becomes <? include 'joblist.php;?>

Now clearly if i str_replace and echo I simply get the <? include 'joblist.php;?> showing in the HTML but the php parser doesnt know what to do with it as its not actually a command itself...its merely part of the string to echo....

Any ideas how I can break the echo insert and include and then return to the rest of the echo.

The reason I need to do this is as part of a CMS.  I need to allow the user to enter some basic BBCode type commands into a text field in a database and the output be useful.

Hope all that made sense.

Will
Link to comment
https://forums.phpfreaks.com/topic/27394-str_replace-but-with-a-difference/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.