|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
anakati Smarty n00b
Joined: 13 Jun 2010 Posts: 2
|
Posted: Thu Jun 17, 2010 10:09 am Post subject: Subcategory problem |
|
|
Hi Everybody,
I managed to get a different background for each category using:
Code: |
{if $page_name == 'category'}
{assign var='id_cat_bg' value=$smarty.get.id_category|intval}
{/if}
<body>
<div id="contenu" {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}{if $page_name == 'category' AND $id_cat_bg != $id_cat_exclude} style="background-image:url({$link->getCatImageLink('', $id_cat_bg, 'category')});"{/if} />
|
Now I am willing to exclude the child category having this background.
Is there a way to have something like :
Code: |
{if $page_name == 'category'}
{assign var='id_cat_bg' value=$smarty.get.id_category WHERE $id_cat_bg->id_parent|intval}
{/if} |
Thanks for your help
f. |
|
Back to top |
|
jpiercemaine Smarty Regular
Joined: 24 Sep 2009 Posts: 82
|
Posted: Thu Jun 17, 2010 12:35 pm Post subject: hmmm |
|
|
Not sure exactly how your code works, but rather than try to include a WHERE clause could you use it in the IF statement?
Code: |
{if $page_name == 'category' && $id_cat_bg->id_parent|intval ne 0}
{assign var='id_cat_bg' value=$smarty.get.id_category}
{/if}
|
_________________ ~ jpierce |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|