7
To display adsense code after the first news story
For Classic view, edit news/templates/news_index.html
Change the table from:
<table width='100%' border='0'>
<tr>
<{section name=i loop=$columns}>
<td width="<{$columnwidth}>%">
<{foreach item=story from=$columns[i]}>
<{include file="db:news_item.html" story=$story}>
<{/foreach}>
</td>
<{/section}>
</tr>
</table>
to:
<table width='100%' border='0'>
<tr>
<{counter start=0 print=false assign=storycount}>
<{section name=i loop=$columns}>
<td width="<{$columnwidth}>%">
<{foreach item=story from=$columns[i]}>
<{include file="db:news_item.html" story=$story}>
<{if $storycount == 0}>
<!-- YOUR ADSENSE CODE HERE -->
<script type="text/javascript"><!--
google_ad_client = "pub-**************";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- END ADSENSE CODE -->
<{counter}>
<{/if}>
<{/foreach}>
</td>
<{/section}>
</tr>
</table>
If you show News by Topic in your index you could display an ad after the first topic by editing news/templates/news_by_topic.html
Look around line 25 for the end of the loops:
</div><br />
<{/foreach}>
</td>
<{/section}>
and change it to:
</div><br />
<{if $storycount == 0}>
<!-- YOUR ADSENSE CODE HERE -->
<script type="text/javascript"><!--
google_ad_client = "pub-***************";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<!-- END ADSENSE CODE -->
<br /><br />
<{/if}>
<{counter start=0 print=false assign=storycount}>
<{counter}>
<{/foreach}>
</td>
<{/section}>
This should work with all versions, but has only been tested on my local with XOOPS 2.2.4.
Good Luck!