Halfagain IM Forums
May 22, 2012, 22:07 *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Due to increasing spam we are forced to make this forum "Read Only". If you have an issue, most likely was discussed here. Use the Search function and try to find related discussions. If you can't find any helpful information, just email support at halfagain dot com"
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Hide subcategories on homepage  (Read 1140 times)
0 Members and 2 Guests are viewing this topic.
Omar
Here to help.
Administrator
Hero Member
*****

Karma: 10001
Offline Offline

Posts: 2687


« on: April 30, 2008, 12:19 »

By default, on the homepage view, every category and sub-category is listed and that can look a bit messy when have lot of categories and subcategories. Here is how you can only show main categoris on hompage, and only unfold ubcategories when a category is clicked in the menu.

Open home.tpl for the template you want to change.

Look of the code below:

{if $subcategories}
{foreach from=$subcategories item=curr_sub_cat}
{if $curr_sub_cat.level<$levels && $curr_sub_cat.name}
       

  • {/if}
    {/foreach}
    {/if}


    and change it to

    {if $subcategories}
    {foreach from=$subcategories item=curr_sub_cat}
    {if $curr_sub_cat.level == '1' && $curr_sub_cat.name}
           

  • {/if}
    {/foreach}
    {/if}


    Then of course save the changes and reupload the file if you edited offline and not directly on ftp.

    If you look carfully, you will see that only one line was changed, [COLOR="Red"]{if $curr_sub_cat.level<$levels && $curr_sub_cat.name}[/COLOR] with [COLOR="RoyalBlue"]{if $curr_sub_cat.level == '1' && $curr_sub_cat.name}[/COLOR] but that is all to do the trick.
    Logged
    royalmice
    Jr. Member
    **

    Karma: 9
    Offline Offline

    Posts: 148


    WWW
    « Reply #1 on: May 06, 2008, 15:29 »

    Hi Omar,

    Thanks for this, it really made a big difference to my site, since i have 100's of categories.
    It is much neater now.

    Thanks again
    Logged

    The best Hosting or your Store Stacker site with plenty of freebies, only at http://bh-server.com
    flashdiva
    Jr. Member
    **

    Karma: 11
    Offline Offline

    Posts: 119


    WWW
    « Reply #2 on: May 16, 2008, 23:46 »

    Thanks Omar! This worked great! Cheesy
    Logged

    Leanne Carson Boyd
    Waybill To Adventure LLC. Ebook Gallery. Gallery of Works.
    Extraordinary Flash. And more...[1] [2] [3]...Credentials. :eek:
    "You do not really understand something unless you can
    explain it to your grandmother" - Albert Einstein
    Pages: [1]
      Print  
     
    Jump to:  

    Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!