Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Subcategory problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
anakati
Smarty n00b


Joined: 13 Jun 2010
Posts: 2

PostPosted: Thu Jun 17, 2010 10:09 am    Post subject: Subcategory problem Reply with quote

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
View user's profile Send private message
jpiercemaine
Smarty Regular


Joined: 24 Sep 2009
Posts: 82

PostPosted: Thu Jun 17, 2010 12:35 pm    Post subject: hmmm Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP