To insert ads in particular locations on my articles, I place a particular string within the location of the article where I want the ad to appear.
For example, I may place the string ###replaceme### somewhere inside of an article.
What I want to do is use the php replace tag (str_replace?) to replace that string, with a string of my ads.
Because the_content() is a function call, I can’t seem to replace it effectively though. Any tips?
Also, the block that is replacing the string may look something like:
Title For Something<br>
Body about that something, etc.
Is there any way to wrap that code into a variable? Cold Fusion allows you to do it with CFSAVECONTENT, but in php, I wasn’t aware of a way to do it. Worst case scenario, I could force it all on a single line, but being able to save the variable and keep the formatting is always nice 🙂
- The topic ‘Replacing a string within the_content() with another?’ is closed to new replies.