Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Sidebar Ad Display Counter

Quote Reply
Sidebar Ad Display Counter
I put this loop link counter on the page and the if link counter in the right sidebar to display ads depending on the amount of room available. I used- loop link counter (set to stop counting at 9)
Code:
<%set Link_Counter = 0%>
<%loop links_loop%>
<%set Link_Counter += 1%>
<%if Link_Counter > 9%>
<%lastloop%>
if link counter
Code:
<%if Link_Counter > 0%>
(more than 0) Display med button ad.
<%else%>
(0) Display small button ad.
<%endif%>
This works very well. My question is what is the correct if syntex to use to show longer ads depending on how much room is available. This would be determined by the number of links being displayed in the category and search page. Such as (I know this is not correct)-
Code:
<%if Link_Counter > 0%>
(more than 0) Display med button ad.
<%else%>
(0) Display small button ad.
<%unless%>
<%Link_Counter > 3%>
(more than 3) Display long ad.
<%unless%>
<%Link_Counter > 5%>
(more than 5) Display longer ad.
<%endif%>

Any ideas?
Quote Reply
Re: [jgkiefer] Sidebar Ad Display Counter In reply to
<%if Link_Counter > 5%>
(more than 5) Display longer ad.
<%elsif Link_Counter > 3%>
(more than 3) Display long ad.
<%elsif Link_Counter > 0%>
(more than 0) Display med button ad.
<%else%>
(0) Display small button ad.
<%endif%>
Quote Reply
Re: [afinlr] Sidebar Ad Display Counter In reply to
Works very well, thank you. Wink
Quote Reply
Re: [afinlr] Sidebar Ad Display Counter In reply to
This works well on the category pages but not on the search results page. Anyone know how I can get different length banners to display depending on the amount of links to show up on the search results page?
Quote Reply
Re: [jgkiefer] Sidebar Ad Display Counter In reply to
Never mind I found the answer. For the search page it is:

<%if link_hits > 5%>
ad here and so on...
<%endif%>