I know there is probably a thread somewhere but I can't find it, what I wanting to do is display my categories this way Main Cat Sub Cat Sub Cat Sub Cat Sub Cat with the sub cats indented slightly what do I do to display it that way I am trying to do it on phpld template Thank You and Have A Nice Day
<ul>Main Category <li>Subcat</li> <li>Subcat</li> <li>Subcat</li> </ul> Style it with CSS and you're done.
I found out what was wrong I had to put a <br> and or <div> depending upon which template I was working with
that's incorrect. you are not allowed to use other elements or text in between <ul> and <li> elements, nor in between <li> elements and in between </li></ul> elements. what you want to do is cascade padding. let's say we have 4 levels of subcategories. you want to indent each levelwith 10 pixels to the left compared to the immediatly superior level. the code will look like this: <ul> <li> Main category <ul> <li> Main subcategory <ul> <li> Main sub sub category <ul> <li>Main sub sub sub category</li> </ul> </li> </ul> </li> </ul> </li> </ul> and the css code: ul li { padding-left:10px; } ul ul li { padding-left:20px; } ul ul ul li { padding-left:30px; } ul ul ul ul li { padding-left:40px; } this can be very easily acomplished dinamicly with some server side script and a db generated category tree. the code above can be extended to an infinite subcategory level.
no I had to go from this <a href="{if $smarty.const.ENABLE_REWRITE}{$cat.TITLE_URL|escape}/{$scat.TITLE_URL|escape}/{else}index.php?c={$scat.ID}{/if}"> {$scat.TITLE|escape}</a>, {/foreach} Code (markup): to this <a href="{if $smarty.const.ENABLE_REWRITE}{$cat.TITLE_URL|escape}/{$scat.TITLE_URL|escape}/{else}index.php?c={$scat.ID}{/if}"> {$scat.TITLE|escape}</a> [B]</div>[/B] {/foreach} Code (markup):
In main.tpl (in your root template folder) delte "..." add <br> (if no exits) {* Display subcategories *} {if !empty($cat.SUBCATS)} <p class="subcats"> {foreach from=$cat.SUBCATS item=scat name=scategs} <a href="{$smarty.const.DOC_ROOT}/{$scat.CACHE_URL|escape}"> {$scat.TITLE|escape}</a>[B]<br />[/B] {/foreach} </p> {/if} {if ($smarty.foreach.categs.iteration mod $cats_per_col eq 0 and $cats_per_col gt 1) or $smarty.foreach.categs.last}</td>{/if} {/foreach} Code (markup):
on some of the templates I had to use </div> others I had to use the <br /> it all depended on which template I was using
You could also use a definition list for this: <dl> <dt>Main Cat</dt> <dd>Sub Cat</dd> <dd>Sub Cat</dd> <dd>Sub Cat</dd> <dd>Sub Cat</dd> </dl> Code (markup): and then add padding-left to the dd element to indent it. Hope that helps!