Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Displaying ads in article lists
Hello, all!
I’m currently trying to implement Google ads on my site. On my front page I use a simple article list (txp:article /> list displaying ten articles from different sections. In this list of articles I would like to display an ad after every five articles, like this:
- article
- article
- article
- article
- article
- Ad
- article
- article
- article
- article
- article
- Ad
Conceptually I guess I would like the form containing the separate article (the default form) to be able to add the code for the ad, when the number of previously displayed articles reaches the number five. A counter of sorts, I suppose.
Is there any way of achieving anything like this?
Offline
Re: Displaying ads in article lists
I found a simple, and rather obvious solution. Instead of trying to make the article form counting displayed articles I changed the page template to this:
<txp:article limit="1" pageby="10" />
<Google code>
<txp:article limit="5" offset="1" pageby="10" />
<Google code>
<txp:article limit="4" offset="6" pageby="10" />
This will display a list of ten articles, with an ad after the first and sixth one.
You may see the result here if you like.
Last edited by december76 (2008-03-30 12:05:38)
Offline
Pages: 1