How to embed AdSense into TYPO3 content elements

I'm back again with another quickie that I needed to figure out for this site. See those AdSense ads embedded within this content element? Well it took me a while to figure out how to do it the proper way. What I did not want was doing it in HTML or anything of the kind. I wanted a simple way to put AdSense ads within my content elements.

And I found it. The answer is the extension: wt_searchandreplace. Using this extension I was able to define simple markers to be placed in the text that will be replaced by AdSense ads by the wt_searchandreplace. And it works like a charm. All I needed to do to get AdSense in this content element is to put a marker like ###ADSENSE ADS HERE PLEASE### in my text and it will be replaced by the corresponding AdSense block within the text. The added benefit is that now I can quickly remove all AdSense ads by simply replacing the markers with nothing.

Addition: I forgot to mention that the 'replace with' field is not large enough to contain AdSense code. What I did to work around this was simply change the field in the DB to text and the edit area in the BE form to textarea. After these additions I was able to achieve the effect that you see on these pages. For the lazier amongst you I uploaded my version of the extension so you can check it out: wt_searchandreplace-modified.t3x.

Your thoughts

No comments

Add comment

* - required field