We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Can one of the new cat plugins do this:Parent not a link

Development and Programming

pserko's avatar
pserko
44 posts
19 years ago
pserko's avatar pserko

Thanks to all who are working on improving category options for us all! Can any of the cat experts tell me if one of the plugins can do this? I want to NOT have a parent category as hyperlink but only the subcategories links in a nested list. Where a category is not a parent it should be a link. Is this possible?

       
pieshop's avatar
pieshop
32 posts
18 years ago
pieshop's avatar pieshop

Me too. In a sidebar I need to show subcategory links of the current parent category, with nested entry lists….. Possible?

       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni

I need this feature as well. PS where can i find the latest version of the subcategories plugin?

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz
Thanks to all who are working on improving category options for us all! Can any of the cat experts tell me if one of the plugins can do this? I want to NOT have a parent category as hyperlink but only the subcategories links in a nested list. Where a category is not a parent it should be a link. Is this possible?

Like exactly what exp:weblog:categories does but the parent categories are no links? Shouldn’t be that hard to make. What about subcategories that are parent to another level of subcategories?

       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni
Thanks to all who are working on improving category options for us all! Can any of the cat experts tell me if one of the plugins can do this? I want to NOT have a parent category as hyperlink but only the subcategories links in a nested list. Where a category is not a parent it should be a link. Is this possible?
Like exactly what exp:weblog:categories does but the parent categories are no links? Shouldn’t be that hard to make. What about subcategories that are parent to another level of subcategories?

Speaking for myself: all subcategories BELOW the FIRST parent would be a link. Only the Parent would not be a link. Ideally this would eventually be an option/setting within EE, but in the meantime a plugin that does this would be something that I could use. RE: Subcatergories within subcategories - I can’t see that they would ever not be links as there is no point in listing them if they are not links.

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz

Well, to keep it simple and not use any additional SQL-queries, the attached plugin just takes the output from weblog:categories and removes the link-tags from the first level of <li>-elements.

Usage: Just wrap the tags around a pair of {exp:weblog:categories}-tags.

Example:

{exp:cat_parent_nolink}
 {exp:weblog:categories weblog="default_site"}
  <a href="http://{path=site/index}">{category_name}</a>
 {/exp:weblog:categories}
{/exp:cat_parent_nolink}

Give it a try, if you like.

       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni
Well, to keep it simple and not use any additional SQL-queries, the attached plugin just takes the output from weblog:categories and removes the link-tags from the first level of <li>-elements. Give it a try, if you like.

I tried it but it had no effect on the output.

PS i have three parents and one of these has sub-cats CAT1 CAT2 sub1 sub2 sub3 CAT3

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz

Interesting. Could you post your template code, to see if there’s something special? I’ve tested it with 1.5.1 and 1.6.

       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni

Hi - here is what i have:



I have tried it two ways. With {exp:cat_parent_nolink} before and after {exp:weblog:categories}. The output remains the same with or without the plugin. I also had problems with the other plugin: Category Expander (v.1.0 [EE 1.6])

PS many thanks for all your work.

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz

{exp:cat_parent_nolink} {exp:weblog:categories weblog="{my_weblog}” show_empty=”no” style=”nested”} <!–<li>Categories</li>–> <li>{category_name} </li> {/exp:weblog:categories} {/exp:cat_parent_nolink}

Remove the bolded li-tags. You don’t need them. style=”nested” creates the list for you.

{exp:cat_parent_nolink}
{exp:weblog:categories weblog="{my_weblog}" show_empty="no" style="nested"}
<!--<li><strong>Categories</strong></li>-->
<a href="http://{path={my_template_group}/index}">{category_name}</a>
{/exp:weblog:categories}
{/exp:cat_parent_nolink}
       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni
{exp:cat_parent_nolink} {exp:weblog:categories weblog="{my_weblog}” show_empty=”no” style=”nested”} {category_name} {/exp:weblog:categories} {/exp:cat_parent_nolink} Remove the bolded li-tags. You don’t need them. style=”nested” creates the list for you.

Yes that works…. a little too well! It aso removes the links function from main Categories that I wish to remain as links!

If a category has no sub-categories or children it should remain as a LINK. But if a parent Catergory has Children it it is NOT a link. Is this possible?

       
silenz's avatar
silenz
1,648 posts
17 years ago
silenz's avatar silenz
If a category has no sub-categories or children it should remain as a LINK. But if a parent Catergory has Children it it is NOT a link. Is this possible?

This is possible, too. Note, this time the plugin-tag goes inside the {exp:weblog:categories}-tag.

This removes the link from top-level categories if they have subcategories.

{exp:weblog:categories weblog="{my_weblog}" show_empty="no" style="nested"}

{exp:cat_parent_nolink2 cat_id="{category_id}"}
<a href="http://{path={my_template_group}/index}">{category_name}</a>
{/exp:cat_parent_nolink2}

{/exp:weblog:categories}
       
giovanni's avatar
giovanni
203 posts
17 years ago
giovanni's avatar giovanni

bingo! it works fine. many thanks for all this.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.