ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

getting category_heading when using

October 25, 2011 11:27am

Subscribe [7]
  • #1 / Oct 25, 2011 11:27am

    iammikek

    10 posts

    I’m trying to neaten up my url structure for categories

    I’ve enabled category url titles in links

    http://ellislab.com/expressionengine/user-guide/cp/admin/channels/global_channel_preferences.html#use-category-url-titles-in-links

    which gives me a url structure looking like:
    /cart/browse/category/cushion_pads

    instead of
    /cart/browse/C322

    the side affect of doing this, is that i now cannot access category_heading or category_description.

    any clue of how to sort that?

  • #2 / Oct 25, 2011 12:16pm

    mz91184

    100 posts

    I am not sure if this helps.  I like to use the exp:query module for grabbing category information sometimes.  You can grab category headings with some code like this

    {exp:query sql='SELECT cat_name, cat_description FROM exp_categories WHERE cat_url_title == {segment_3}'}
    {cat_name} or {cat_description}
    {/exp:query}

    Hope this helps.  Best of luck.

  • #3 / Oct 25, 2011 12:19pm

    mz91184

    100 posts

    One other idea, you could probably use this plug-in too, http://gotolow.com/addons/low-seg2cat

  • #4 / Oct 26, 2011 12:03am

    Dan Decker

    7338 posts

    iammikek,

    I would also suggest using seg2cat. It allows you to use functionality similar to category url titles without having to enable that feature. It also eliminates “category” from your URLs for extra neatness. That would allow you to still have all the features of category heading and such.

    Cheers,

  • #5 / Oct 26, 2011 4:12am

    iammikek

    10 posts

    Thanks for your replies. I’d have hoped that this functionality had made it into the core by now. It seems bizarre that ee would allow you to set something in the admin which would break something else.

    Anyway, 2 options to look at. Incidentally, i had looked at seg2cat on a 1.1 install but wrongly assumed i had to pay for it being a 3rd party module.

  • #6 / Oct 26, 2011 11:27am

    Mark Bowen

    12637 posts

    Hi iammikek,

    If you have a URL such as http://www.example.com/index.php/options/category/category-two then this should work fine out of the box. You are having this problem though because you are not following the standard URL structure for using categories as you have an extra segment in your URL.

    This means that you would indeed need to use a 3rd party add-on to get at what you need here.

    Does that help at all?

    Thanks,

    Mark

  • #7 / Oct 31, 2011 7:30am

    Visiluna

    92 posts

    Mark,

    I’m seriously confused. I’m having this same problem, but I don’t understand how his example http://www.example.com/index.php/cart/browse/category/cushion_pads is not standard?

    It follows the TEMPLATEGROUP/TEMPLATE/category/CATEGORY standard.

    Are you saying that the category trigger can be used to show categories ONLY in the index template of a group?

    Please advise.

  • #8 / Oct 31, 2011 3:24pm

    Rob Allen

    3114 posts

    You need to add that Channel name to the category_heading tag…

    {exp:channel:category_heading channel="mychannelname"}
        <h1>{category_name}</h1>
        {if category_description}
            {category_description}
        {/if}
    {/exp:channel:category_heading}

    See http://ellislab.com/expressionengine/user-guide/modules/channel/category_heading.html#channel

  • #9 / Nov 01, 2011 6:53am

    Mark Bowen

    12637 posts

    Hi Visiluna,

    Although I’ll probably get frowned upon by some for saying this (I don’t really care truthfully though), apologies for my post above as I had slightly mis-read what was being done here.

    Best wishes,

    Mark

  • #10 / Nov 01, 2011 10:27pm

    Dan Decker

    7338 posts

    iammikek,

    Did you have a chance to give seg2cat a look?

    Visiluna,

    Nope, you are not required to route categories through the index template. It all depends on either the ā€œCā€ or category URL trigger being in the URL.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases