How do I hide sub categories from the side bar

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 06-15-2007, 05:02 AM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
I tried using this code but it takes the css away.

<br />
{if $pagename eq 'published' || $pagename eq 'upcoming'}


<div id="categories-bg">
<ul>

{******Get the parent category******}
{assign var=requested_cat value=$request_category}

{* if story page - set the story's category to this *}
{if $pagename eq 'story'}
{assign var=requested_cat value='sub'}
{/if}

{assign var=mainCatStr value=''}
{assign var=parentCat value=-1}

{section name=thecat loop=$cat_array}
{if $cat_array[thecat].safename eq $requested_cat}
{if $cat_array[thecat].parent neq 0}
{assign var=parentCat value=$cat_array[thecat].parent}
{assign var=mainCatStr value=$cat_array[$parentCat].safename}
{else}
{assign var=parentCat value=$cat_array[thecat].auto_id}
{assign var=mainCatStr value=$cat_array[thecat].safename}
{/if}
{/if}
{/section}

{********* Displaying the Main categories *******************}
{section name=thecat loop=$cat_array}
{if $cat_array[thecat].parent eq 0}
{if $cat_array[thecat].safename eq $requested_cat || $cat_array[thecat].auto_id eq $parentCat}

<li><a href="{$URL_maincategory, $cat_array[thecat].safename}" class="current">{$cat_array[thecat].name}</a></li>
{elseif $requested_cat eq "" && $cat_array[thecat].auto_id eq 0}
<li><a href="{$URL_maincategory, $cat_array[thecat].safename}" class="current">{$cat_array[thecat].name}</a></li>
{else}
<li><a href="{$URL_maincategory, $cat_array[thecat].safename}">{$cat_array[thecat].name}</a></li>
{/if}
{/if}
{/section}
</ul>
</div><!--end of div tag "categories-bg"-->

{********* Displaying the Sub categories *******************}
{if $parentCat gt 0}
<center>
<div id="categories-layer">
<ul>
{if $requested_cat eq $mainCatStr}
<li><a style="font-size:11px;" href="{$URL_maincategory, $mainCatStr}" class='current'>{#PLIGG_Visual_RSS_All#}</a></li>
{else}

<li><a style="font-size:11px;" href="{$URL_maincategory, $mainCatStr}">{#PLIGG_Visual_RSS_All#}</a><li>
{/if}

{section name=thecat loop=$cat_array}
{if $cat_array[thecat].parent eq $parentCat}
{if $cat_array[thecat].safename eq $requested_cat}
<li style="font-size:11px;"><a href="{$cat_url}{$cat_array[thecat].safename}" class="current">{$cat_array[thecat].name}</a></li>
{else}
<li><a style="font-size:11px;" href="{$cat_url}{$cat_array[thecat].safename}">{$cat_array[thecat].name}</a></li>
{/if}
{/if}
{/section}
</ul>
</div><!--end of div tag "categories-layer"-->

{/if}
{elseif $pagename neq 'submit'}

{********* Displaying the Main categories *******************}

<div id="categories-bg">
<ul>
{section name=thecat loop=$cat_array}

{if $cat_array[thecat].parent eq 0}

<li><a href="{$URL_maincategory, $cat_array[thecat].safename}">{$cat_array[thecat].name}</a></li>

{/if}

{/section}
</ul>
</div>
</center>
{else}

{/if}

<br />
Reply With Quote
  #2 (permalink)  
Old 06-15-2007, 07:17 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
displaying categories who's parent category is 0 should solve the issue:

the below condition in the section loop will filter off the sub-categories - use it in your normal categories code.
Code:
{if $cat_array[thecat].parent eq 0}
Reply With Quote
  #3 (permalink)  
Old 06-15-2007, 07:27 AM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
No luck . . . just shows the links.

I put the code in my sidebar by the way.

Thanks

JB
Reply With Quote
  #4 (permalink)  
Old 06-15-2007, 05:11 PM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
Anoyone? Pleeeese
Reply With Quote
  #5 (permalink)  
Old 06-16-2007, 02:21 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Which file you are playing with? categories.tpl?
If categories.tpl - replace the section code with the below (not tested - but should work):
Code:
{section name=thecat loop=$cat_array start=1}
   {if $cat_array[thecat].parent eq 0}
      <li><a href="{$URL_rsscategory, $cat_array[thecat].auto_id}" target="_blank" style="border:none;"> 	 
	        <img src="{$my_pligg_base}/templates/{$the_template}/images/rss.gif" border="0" style="float:right;padding-right:10px;"></a>
			
					{if $pagename eq "published"}
						<a href="{$URL_maincategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
					{else}
						<a href="{$URL_queuedcategory, $cat_array[thecat].safename}" style="padding-bottom:5px;">{$cat_array[thecat].name}</a>
					{/if}
					</li>
   {/if}
{/select}
Reply With Quote
  #6 (permalink)  
Old 06-16-2007, 06:31 AM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
I tried several combo I keep getting the following:

Fatal error: TPL: [in yget/sidebar_modules/categories.tpl line 21]: syntax error: /select function does not exist (class.compiler.php, line 485) in /home/soulja90/public_html/class.template.php on line 923

Also I'm doing this on all the original files. i havent modifed or touched anything.

Thanks

JB

PS: This will ROCK my world and I can finally share my site with the rest of the pligg users. Thanks JB
Reply With Quote
  #7 (permalink)  
Old 06-16-2007, 07:34 AM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Unless you specify which file you exactly play around - there gonna be no help.
you try this on header.tpl or categories.tpl - which one?
Reply With Quote
  #8 (permalink)  
Old 06-16-2007, 08:28 AM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
Sorry about that (Spanks himself)

Just the category.tpl

Thats it.

Thanks

JB

I first screwed around with sidebar. But it didnt work. So I uploaded brand new pligg version - that I'm using right now and the sidebar.tpl file from it.

So everything is 'stock' as they say.

Since talking with you - I've just touched the category.tpl

Thanks

JB
Reply With Quote
  #9 (permalink)  
Old 06-16-2007, 03:33 PM
dollars5's Avatar
Pligg Donor
 
Join Date: Dec 2006
Location: India
Posts: 1,960
Did you try the code outlined here at categories.tpl? How do I hide sub categories from the side bar
Reply With Quote
  #10 (permalink)  
Old 06-16-2007, 06:23 PM
Casual Pligger
 
Join Date: Dec 2006
Posts: 74
Yes dollar5,

Thats the exact code I tried but still no luck.

Thats how I started getting the fatal error message.

Thanks

JB
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different side bar content for different categories ptflyer Questions and Comments 2 07-02-2009 01:12 PM
[MOD] Drop Down Categories & Sub-categories in Side Bar manager456 Questions and Comments 20 03-16-2009 11:32 PM
Sidebar Categories Enhancement AddOn AnAlienHolakres3 Questions and Comments 65 08-31-2008 12:48 AM
[SOLVED] White space in my categories side panel AshMCairo Questions and Comments 5 07-20-2007 11:48 AM
How to hide sub categories? maxbear Questions and Comments 0 04-25-2007 07:06 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development