1
deka87
how do i put a banner in the middle of the list
  • 2010/2/15 19:32

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


hi guys,

lets assume we've got a list of ads that goes like this
le="color: #000000"><?php <{foreach item=item from=$items}>
and so on. i wonder how do i put an ad code to be displayed in the middle of the list? like this:

----------------
item1
----------------
item2
----------------
banner
----------------
item3
----------------
item4
----------------

and so on. any ideas?

2
ghia
Re: how do i put a banner in the middle of the list
  • 2010/2/15 23:25

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this.

3
jlm69
Re: how do i put a banner in the middle of the list
  • 2010/2/16 0:03

  • jlm69

  • Module Developer

  • Posts: 719

  • Since: 2002/7/19


I will add this option to my classifieds module this week. Although I will do it different from the above post.

John

4
deka87
Re: how do i put a banner in the middle of the list
  • 2010/2/22 8:11

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


@ ghia

ok i put this code in the template

le="color: #000000"><?php <{foreach item=item from=$items name=aded}> <{if $smarty.foreach.aded.index % 8 == 0}> <tr><td colspan="6"><div align="center" style="border-bottom:1px dotted #cccccc;">my banner</div></td></tr> <{/if}>


but it shows two ads one of which goes right after the header (take a look here plz). how do i get rid of the first ad and leave the second one only? thanks in advance

5
Bleekk
Re: how do i put a banner in the middle of the list
  • 2010/2/22 13:59

  • Bleekk

  • Theme Designer

  • Posts: 942

  • Since: 2002/12/14


I have done something similar to you on my site. I have added a banner every 3 lines. I have used a counter (zaehler in my code).

le="color: #000000"><?php <{assign var=zaehler value=1}> <{foreach from=$photos item=photo}> <{assign var=zaehler value=$zaehler+1}> <{if $zaehler % 3 == 0}> YOUR BANNER <{/if}> <{/foreach}>

6
zyspec
Re: how do i put a banner in the middle of the list
  • 2010/2/22 14:30

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


deka87,

you should be able to just change
le="color: #000000"><?php <{if $smarty.foreach.aded.index % 8 == 0}>


to
le="color: #000000"><?php <{if ($smarty.foreach.aded.index % 8 == 0) && !($smarty.foreach.aded.first)}>


7
deka87
Re: how do i put a banner in the middle of the list
  • 2010/2/22 20:08

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


thanks guys! i did it the way zyspec said and it worked out. cool!

Login

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!