Skip to main content

Category tree

Category tree loop, to get a category tree from a given category to a given depth.
{loop type="category-tree" name="the-loop-name" [argument="value"], [...]}


category *A single category id.category="2"
depthThe max depthdepth="5"
excludeA single or a list of category ids to exclude for result.exclude="5,72"
return_urlA boolean value which allows the urls generation.yesreturn_url="no"
visibleWhatever we consider hidden category or not.truevisible="false"

Plus the global arguments


$IDthe category id
$PARENTthe parent category
$TITLEthe category title
$URLthe category URL
$VISIBLEwhatever the category is visible or not

Plus the global outputs


I want to display a select list with all visible categories.

<select name="category">
{loop name="categories-tree" type="category-tree" category="0"}
<option value="{$ID}">{"-"|str_repeat:$LEVEL} {$TITLE} {if $CHILD_COUNT != 0}({$CHILD_COUNT}){/if}</option>