mayid Posted February 2, 2011 Share Posted February 2, 2011 I needed to show just subcategories in the main page, and i take the long road. I mean, i'm using the categories module, but i'm just skipping the categories and showing the subcategories. Now, the problem is that i just can't count them!Categories can be count, and the wished amount can be set in the control panel. But subcategories are harder to handle. And i don't know much about smarty. Could you please guys give me a tip? This is the code i'm using in category-tree-branch.tpl {if $node.children|@count == 0} {$node.name|escape:html:'UTF-8'} {/if} {if $node.children|@count > 0} {foreach from=$node.children item=child name=categoryTreeBranch} {if $smarty.foreach.categoryTreeBranch.last} {include file=$branche_tpl_path node=$child last='true'} {else} {include file=$branche_tpl_path node=$child last='false'} {/if} {/foreach} {/if} Link to comment Share on other sites More sharing options...
mayid Posted February 2, 2011 Author Share Posted February 2, 2011 With just PHP i'd just put a counter, a conditional, and loop six times:i = 0;if (i < 6)--- the loop ...i++;--- But with Smarty i don't know how to handle this. Link to comment Share on other sites More sharing options...
mayid Posted February 11, 2011 Author Share Posted February 11, 2011 Any clue on this? The above solution is not possible in smarty because it don't allow declaring vars, as far as i know.EDITED: nevermind. I'm using another module now, that can be controlled easily. I'm referring to the featured products module. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now