|
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 |
smiler Smarty n00b
Joined: 30 May 2016 Posts: 1
|
Posted: Mon May 30, 2016 7:10 am Post subject: Category`s id filtering |
|
|
Hello. I have a problem, so I hope someone help me
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
How can i do this? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Mon May 30, 2016 3:10 pm Post subject: |
|
|
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 |
|
|
|
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
|