How do I make my categories display this way

Discussion in 'HTML & Website Design' started by jminscoe, Jun 22, 2007.

  1. #1
    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
     
    jminscoe, Jun 22, 2007 IP
  2. Philopoemen

    Philopoemen Peon

    Messages:
    704
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <ul>Main Category
    <li>Subcat</li>
    <li>Subcat</li>
    <li>Subcat</li>
    </ul>
    Style it with CSS and you're done.
     
    Philopoemen, Jun 23, 2007 IP
  3. jminscoe

    jminscoe Peon

    Messages:
    1,223
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ok what template do I do that with in phpld
     
    jminscoe, Jun 23, 2007 IP
  4. Arnold9000

    Arnold9000 Peon

    Messages:
    241
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Show me the template code.
     
    Arnold9000, Jun 23, 2007 IP
  5. jminscoe

    jminscoe Peon

    Messages:
    1,223
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #5
    thats just it I am unsure of which template the css or main or what
     
    jminscoe, Jun 23, 2007 IP
  6. matttwine

    matttwine Peon

    Messages:
    40
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    if you search on google for css menus you will get hundreds of not thousands of examples
     
    matttwine, Jun 24, 2007 IP
  7. jminscoe

    jminscoe Peon

    Messages:
    1,223
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I found out what was wrong I had to put a <br> and or <div> depending upon which template I was working with
     
    jminscoe, Jun 24, 2007 IP
  8. x-noise

    x-noise Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    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.
     
    x-noise, Jun 24, 2007 IP
  9. jminscoe

    jminscoe Peon

    Messages:
    1,223
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #9
    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>,&nbsp;
                {/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):
     
    jminscoe, Jun 25, 2007 IP
  10. SEOdir.net

    SEOdir.net Banned

    Messages:
    2,549
    Likes Received:
    105
    Best Answers:
    0
    Trophy Points:
    173
    #10
    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):
    :)
     
    SEOdir.net, Jun 25, 2007 IP
  11. jminscoe

    jminscoe Peon

    Messages:
    1,223
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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
     
    jminscoe, Jun 25, 2007 IP
  12. rchamberlin

    rchamberlin Peon

    Messages:
    81
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    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!
     
    rchamberlin, Jun 25, 2007 IP