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

Category`s id filtering

 
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
smiler
Smarty n00b


Joined: 30 May 2016
Posts: 1

PostPosted: Mon May 30, 2016 7:10 am    Post subject: Category`s id filtering Reply with quote

Hello. I have a problem, so I hope someone help me Smile
I have a menu like this design:
-Category1
--Subcategory2
--Subcategory3
--Subcategory4
-Category5
--Subcategory6
--Subcategory7
--Subcategory8

On homepage i have a list with all new topics without filtering.
I need to remove each topic from Category5 and from her subcategorys (6,7,8.) from my homepage.
I try
Code:
{%if $message.cat !== '6'%}
This removes the topics from subcategory with id 6. But i need to remove all topics from categorys with id 6,7,8.
Code:
{%if $smarty.get.cat.0 !== '5''%}
doesnt work Sad
How can i do this?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Mon May 30, 2016 3:10 pm    Post subject: Reply with quote

I would suggest "do this" in the SQL query.
But if you absolutely want to do this in template code, then pass a $filter = array(id => name); to template and

{if isset($filter[$article.category])}{continue}{/if}
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