EllisLab text mark
Advanced Search
     
Showing on first few ‘categories’ in the navigation
Posted: 12 July 2012 08:38 AM   [ Ignore ]
Joined: 2012-04-24
4 posts

Hi,

I’ve a list of say 10 categories in my category group. I want to show only first 8 categories from them. But don’t want to delete other 2 as I may need them at some other time.

Following is my code:

{exp:channel:categories channel="products"}
  
<a href="{path='product/index'}" id="category-{category_id}">{category_name}</a>
{/exp:channel:categories} 

and I want to do something like

{exp:channel:categories channel=“products” limit=“8”}

. But “limit” is not supported in this tag.


Please suggest me any alternate solution.

Thanks in advance!

 
Posted: 12 July 2012 08:49 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2012-04-24
4 posts

Okay it seems I have a solution as follows:

{exp:channel:categories channel="products"}
  {if count 
<=8}
    
<a href="{path='product/index'}" id="category-{category_id}">{category_name}</a>
  
{/if}        
{
/exp:channel:categories} 

Any other solution is appreciated!!