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.

category_heading blank

September 07, 2011 4:15pm

Subscribe [3]
  • #1 / Sep 07, 2011 4:15pm

    florian

    395 posts

    Hi,

    I cant figure out why the cateogory_heading tag does not output my category name.

    Category URL Indicator = products
    category url titles = yes

    I use the same template to show the list of categories and also the products for the categories. I use a simple {if segment_1 == ""} conditional for this.

    we are dealing with the site/index page here. So when I go to domain.com I will see a list of categories since segment_1 is empty.

    when I click on any of the category links which look like href=”{path=/}” (or I also tried href=”{path=site}” and i also tried href=”{path=site/index}”) I will get the list of the products for this category.

    the url at this point looks like http://www.domain.com/index.php/products/categoryname which is what I would like. I dont like domain.com/index.php/site/products/categoryname

    however, the following code does not give me the category name:

    {exp:channel:category_heading channel="products"}
            
                You are viewing category <em>{category_name}</em>
                {exp:catcount cat_id="{category_id}"} items
    
    {/exp:channel:category_heading}

    according to the docs and to what I know, this should work, no?

    this is EE 2.2.2

  • #2 / Sep 07, 2011 4:43pm

    Lee Powell

    88 posts

    Does this work:

    http://www.domain.com/index.php/site/products/categoryname

    I would probably use ‘category’ as the trigger, and create a template group called products, so the url would be:

    http://www.domain.com/index.php/products/category/categoryname

  • #3 / Sep 07, 2011 4:57pm

    florian

    395 posts

    no, http://www.domain.com/index.php/site/products/categoryname does not work either.

    yes, I could create a new template for it, but I like the url better with index.php/products/categoryname
    I feel like the index.php/products/category/categoryname is too long and the word category is not needed.

    is there some reason why my method does not work? i dont see one anyways 😊

  • #4 / Sep 07, 2011 5:07pm

    Lee Powell

    88 posts

    Odd - because I just replicated your setup locally, and it worked.
    Well, it didn’t work with your original url, however, with ‘site’ added to the url, it worked.

  • #5 / Sep 07, 2011 5:26pm

    florian

    395 posts

    here is what my entire index code looks like. do you see any issues compared with your code? can you copy your working code? maybe i can put it into an empty test template

    <div class="products">
        
    {if segment_1 == ""}
        
    {exp:channel:categories channel="products" category_group="1"}
    
            <h3><a href="http://{path=site}">{category_name}</a></h3>
    <p>        <br />
            <div class="mosaic-block cover"><br />
                <div class="mosaic-overlay">{category_image}</div><br />
                <div class="mosaic-backdrop"><br />
                    <div class="details"><br />
                        {category_description}<br />
                        <a href="http://{path=site}">View all Products</a><br />
                    </div><br />
                </div><br />
            </div><br />
            <br />
            <a href="http://{path=site}class=more">View all {exp:catcount cat_id="{category_id}"} products</a><br />
            <br />
    {/exp:channel:categories}</p>
    
    <p>{if:else}</p>
    
    <p>        <div class="categories"><br />
            <br />
                Filter by Category</p>
    
    <p>            {exp:channel:categories channel="products" style="linear" category_group="1"}</p>
    
    <p>            </p><h4><a href="http://{path=/}class=active">{category_name}</a></h4>
    
    <p>            {/exp:channel:categories}<br />
                <br />
            </div><br />
            <br />
            <div class="bread"></p>
    
    <p>{exp:channel:category_heading channel="products"}<br />
            <br />
                You are viewing category <em>{category_name}</em><br />
                {exp:catcount cat_id="{category_id}"} items</p>
    
    <p>{/exp:channel:category_heading}<br />
                <br />
            </div></p>
    
    <p><br />
            <br />
            <ul class="list"><br />
            <br />
    {exp:channel:entries channel="products"}<br />
            <br />
                <li><br />
    {product-images}<br />
                    <a href="http://{url_title_path=product}">{exp:ce_img:make src="{pic}" max_width="205" max_height="208" crop="yes|center,center"}{made}{/exp:ce_img:make}</a><br />
    {/product-images}<br />
                    <a href="http://{url_title_path=product}">{title}</a><br />
                    <a href="http://{url_title_path=product}class=more">more</a><br />
                </li><br />
                <br />
    {/exp:channel:entries}</p>
    
    <p>        </ul><br />
                <br />
    {/if}<br />
            <br />
        </div>

  • #6 / Sep 07, 2011 5:33pm

    Lee Powell

    88 posts

    I used the trigger word ‘posts’ instead of products (as I already had a test channel setup with that name), and simply placed the following in site/index.html

    {exp:channel:category_heading channel="posts"}   
         You are viewing category <em>{category_name}</em>
    {/exp:channel:category_heading}

    I then used the following URL: http://ee.localhost/index.php/site/posts/environment

    It may be worth stripping out the superfluous code from your template to what you need, check it works, and build it up from there.

  • #7 / Sep 07, 2011 6:14pm

    florian

    395 posts

    I put the bare minimum code in vanilla template, but I found out that when I set ‘use category url titles in links’ to NO, it all of a sudden works for me. could this be a EE2.2.2 bug??

    I also tried with different category url indicator and I made sure to use 2 templates. one for the listing of categories and one to display. (although I dont think this makes a difference, as I used the one template method with if conditional many times before)

    admins?

  • #8 / Sep 07, 2011 6:31pm

    florian

    395 posts

    edit: still not working for me here.

    it almost looks like the whole category thing doesnt work for me, because not only is the category name not displaying, the products lists ALL products and does not narrow it down to the category that I clicked on. even though the category name is in the URL. so something is not right here.

    as i said, it works when i dont use the title in category url.

  • #9 / Sep 08, 2011 8:56am

    florian

    395 posts

    I copied the same code to a different EE installation and it works as it should.

    I am wondering if a add on could create the issue? Could the structure module or maybe the biber multi language support module mess with the category url somehow??

    thoughts anybody?

  • #10 / Sep 08, 2011 11:30am

    Mark Bowen

    12637 posts

    Hi florian,

    If you are trying to use the index page to do this on then you would need to craft your URL more along these lines :

    http://www.example.com/index/products/categoryname

    /index
    This being the index template in your main template group.

    /products
    This is the category url indicator. In your case products.

    and

    /categoryname
    This being a valid category name in the Channel that you are referring to in the tag.

    Could you give that a go for me perhaps.

    Thanks.

    Mark

  • #11 / Sep 08, 2011 1:57pm

    florian

    395 posts

    Hi Mark,

    I did try linking to /index but I am experiencing the same issue. Based on all the things that I have tried, I think there is some other conflict here, because

    - everything works normal when I dont use category url in title
    - if i use category url in title, not only does the category heading not display a name, also the categories are not getting filtered. all products display instead of the one which are in a particular category
    - i tried using a different category trigger word but that doesnt seem to be the issue either

    -> could the structure module mess with the category urls?

    best
    florian

  • #12 / Sep 08, 2011 6:30pm

    Mark Bowen

    12637 posts

    Hi Florian,

    Ah so you’re using the Structure Module here?

    You didn’t mention that in your first post 😉

    The Structure Module does indeed completely take over the standard ExpressionEngine URL structure so getting all of this to work is definitely at this stage a custom solution.

    If you are utilising Structure and need something to work in conjunction with that then you would need to contact the author of that add-on directly as we can’t offer support for 3rd party add-ons I’m afraid.

    What you are looking to do could well be achievable using the Low Seg2Cat add-on however this is definitely now a custom solution so I’m going to move this thread on down to the Community Help forums where you may get further input from other forum users.

    Thanks,

    Mark

  • #13 / Sep 09, 2011 1:53pm

    florian

    395 posts

    Hi Mark,

    so even though I am not on a structure url and I am not managing this particular channel with structure, the fact that its installed would mess up the category url things? does it make sense that only when i use url in title the categories seem not to work correctly? I suppose it could.

    i’ll try the freebi extension for structure to work with my categories, see if i can figure this out

    best
    florian

  • #14 / Sep 09, 2011 8:08pm

    Mark Bowen

    12637 posts

    Hi Florian,

    As I can get this to work on a localhost install without the Structure module installed (we always test with bare minimum installs [no 3rd party add-ons present] as we can’t support those in these forums) then I am thinking that this will be related to that module.

    You may want to post over on the add-ons support page found here - https://structure.tenderapp.com/ to see if they have any ideas on this one.

    Thanks,

    Mark

  • #15 / Sep 09, 2011 8:36pm

    florian

    395 posts

    Hi Mark

    I will post over there. Also I have some other EE installations with structure. I could test it on there too to check if its indeed structure related or maybe something else all together,

    thanks
    Florian

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

ExpressionEngine News!

#eecms, #events, #releases