Page 1 of 1

I need insert php code in template

Posted: Sun Dec 18, 2005 6:15 pm
by Stefano
I need insert php code for include adsense banner in home page

{if not $is_single_entry }


i want only view banner in 2 post (i use 4 display article for page)

i have try this solution :

Code: Select all


 <? $pippo_baudo = $this->_tpl_vars['entry']['id']/2;
if(is_float($pippo_baudo) && ! $this->_tpl_vars['is_single_entry']){echo $this->_tpl_vars['entry']['id'];} ?>

But i need help for write with smarty

Posted: Sun Dec 18, 2005 8:16 pm
by judebert
Sorry, I'm not really certain what you want.

Are you trying to achieve:

(On frontpage only)
Article
Article
Adsense Banner
Article
Article
Adsense Banner

If so, you could use the Static Blocks plugin. Define a static block with the Adsense Banner URL, and define it to repeat every 2 articles.

If you want something else, describe it and I'll try again.

Re: I need insert php code in template

Posted: Mon Dec 19, 2005 10:13 am
by garvinhicking
You shouldn't ever modify the .tpl.php files. Always only edit the .tpl files in the templates directory (NOT templates_c).

Inside the entries.tpl you can do your Smarty checking code like

Code: Select all

{if not $is_single_entry and $entry.id == 4711}
ADCODE
{/if}
HTH,
Garvin