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.

Some category listings not showing up

February 21, 2012 12:03pm

Subscribe [1]
  • #1 / Feb 21, 2012 12:03pm

    tigerchick

    34 posts

    This question may be related to a resolved thread.

    Hi, I’m having trouble with a site that has two blogs, both have the option of filtering entires shown by category.  Each blog has it’s own category group name and the option “Use Category URL Titles in Links” in ticked. The category URL indicator is simply “category”.

    This all seems to work fine as far as I can tell except when the same category name appears in both blogs.  eg. “Winter” is a necessary category in both blogs but any entries assigned to that category do not show up when the entries are displayed by that category.

    Here are example urls of both blogs:

    http://www.eastsidecottages.co.uk/blog/farm_category/category/winter

    http://www.eastsidecottages.co.uk/blog/wo_category/category/winter

    As you can see, the last two segments of the url are the same - perhaps this is causing the trouble? However, seg 2 is different and I need “winter” in both! (And with friendly URLs rather than C15 or whatever).  Hope you can help

    Many thanks,
    Michael

  • #2 / Feb 22, 2012 3:13pm

    Dan Decker

    7338 posts

    Hi Michael,

    Make sure you are using the site= parameter on your channel entries tags:

    {exp:channel:entries site="default_site" channel="channel"}

    The site parameter will tell the tag to only pull entries for the category from that site.

    Let me know if you have any questions!

    Cheers,

     

  • #3 / Feb 23, 2012 7:45am

    tigerchick

    34 posts

    Hi Dan, thanks for getting back to me. I tried adding in [site=“default_site” ]  but to no avail. 

    I think I may have been a little confusing in my last post - the two blogs are actually part of the same site, and I’m not using multi-site manager or anything.

    The category groups are correctly assigned to their corresponding channels and the blog entires themselves have the channels assigned correctly through the publish form. I just can’t see what’s going wrong!

    Michael

  • #4 / Feb 24, 2012 3:59pm

    Dan Decker

    7338 posts

    Hi Michael,

    Thanks for clarifying that!

    Let me make sure I have a firm grasp of the situation now.

    You have 2 channels. Each channel has been assigned the category group that contains the “Winter” category. Is this correct?

    Can you please post the templates that are giving you trouble? Post the code from each template along with a description of what you expect to happen and what is actually happening.

    We’ll get this sorted out!

    I look forward to your reply.

    Cheers,

  • #5 / Feb 24, 2012 4:05pm

    tigerchick

    34 posts

    Hi Dan,

    You have 2 channels. Each channel has been assigned the category group that contains the “Winter” category. Is this correct?

    not quite. There 2 channels. There are 2 category groups. Each group has a category within it called “winter”.

    Does that make a fundamental difference that could cause a breakage or should I cary on and post the templates?

    Michael

  • #6 / Feb 24, 2012 6:54pm

    tigerchick

    34 posts

    ok, this is part of the template that deals with the side panel content here:

    http://www.eastsidecottages.co.uk/whats_on/whats_on_blog/

    <div class="cat-search">
      <h3 class="side-title">Search by category</h3>
      <a href="http://{path=whats_on/whats_on_blog}">All</a>
      {exp:channel:categories channel="whats_on_blog" style="linear"}
          <a href="http://{path=blog/wo_category}">{category_name}</a>
      {/exp:channel:categories}
      <br class="clearer" >
    </div>


    Each of the <a> tags above generate a button with a category name on it. Clicking on these should take you to the template that shows the corresponding template eg. http://www.eastsidecottages.co.uk/blog/wo_category/category/whats_on

    Here is that template:

    {embed="includes/.header"}
    
    <div class="cottage-intro">
     
     <div class="main">
      <h1>What's on blog</h1>
      <h2>A local's guide to what's happening in and around Edinburgh and the Lothians - news of events and happenings that we'll try to keep informative, interesting and up to date!</h2>
    <p>  <a href="http://{path=whats_on/whats_on_blog}">« back to all posts</a><br />
      <h3 class="sub-heading">Recent articles in — {segment_4_category_name}</h3><br />
        <br />
      {exp:channel:entries channel="whats_on_blog" limit="5" disable="categories" orderby="date" sort="desc" paginate="bottom"}<br />
       {if no_results}<br />
        No articles here yet!  Please check back soon…<br />
       {/if}<br />
       <div class="blog-post"><br />
        </p><h2><a href="http://{page_url}">{title}</a></h2>
    <p>    <br />
         <span class="entry-date">{entry_date format="%j %M %Y"}</span><span class="author">Posted by <a href="http://{exp:eehive_hacksaw}{googleplus}{/exp:eehive_hacksaw}" target="_blank" rel="noopener">{author}</a></span><br />
        <br />
        {blog_excerpt}<br />
        {blog_image limit="1"}<br />
         <a href="http://{page_url}">{exp:ed_imageresizer image="{blog_image_image}" maxWidth="523" alt="{blog_image_title}"}</a><br />
         {blog_image_title} ↑<br />
         <div class="credit">{blog_image_credit}</div><br />
        {/blog_image}<br />
        <br />
        <div class="blog-links"><br />
         <a href="http://{page_url}" class="more-link">Read full article…</a><br />
         <div class="addthis">{addthis}</div><br />
        </div></p>
    
    <p>    {paginate}{if {total_pages} > 1}<br />
        <div class="inter-post"><br />
         {if previous_page}<br />
         <a href="http://{auto_path}" class="ulto-btn">Previous Page</a>  <br />
         {/if}<br />
         {if next_page}<br />
         <a href="http://{auto_path}" class="btn">Next Page</a><br />
         {/if}<br />
         <br class="clearer" ><br />
        </div><br />
        {/if}{/paginate} <br />
        <br class="clearer" ><br />
       </div><br />
      {/exp:channel:entries}<br />
      <br />
     </div><br />
     {embed="blog/.wo_sidebar"}<br />
     <br class="clearer" ><br />
     <br />
    </div><!-- /cottage-intro --></p>
    
    <p>{embed="includes/.footer"}

    Unfortunately this does not show channel entries that have been assigned this category in some cases. Eg. The category “christmas” http://www.eastsidecottages.co.uk/blog/wo_category/category/christmas works just fine, but the category “what’s on” does not.

    There are two channels where this is the case - set up in the same way with different category groups assigned to them.  Some of these categories happen to be of the same name and previously I had thought that it was the ones that share the same name as other categories within the other group that were causing the trouble - however I now see that the problem also extends to categories (such as “what’s on” )that do not have a counterpart of the same name.

    Hope this helps! Michael

  • #7 / Feb 26, 2012 12:47pm

    Dan Decker

    7338 posts

    Hi Michael,

    In you second template example, you have:

    {exp:channel:entries channel="whats_on_blog" limit="5" disable="categories" orderby="date" sort="desc" paginate="bottom"}

    You are disabling categories here, so the channel entries tag is telling ExpressionEngine to ignore anything to do with categories.

    If you take out the disable=“categories” parameter, this should get you closer to what you are looking for.

    You mentioned that you have 2 separate category groups with similar categories. Is there a reason you aren’t using one group with both channels?

    For the Winter group specifically, do they have the same category url title value? That can also lead to unpredictable results when dealing with categories.

    Cheers,

  • #8 / Feb 27, 2012 6:38am

    tigerchick

    34 posts

    Hi Dan, right I’ve fixed this. In the second template where you mention I categories disabled I changed the line to this (using lowseg2cat):

    {exp:channel:entries channel="farm_blog" limit="5" category="{segment_4_category_id}" category_group="2" orderby="date" sort="desc" paginate="bottom"}

    That fixed the listing of any category that didn’t have a category of the same name in a different group.

    Then to fix the categories that weren’t displaying as there was another category of the same name in a different group, i simply changed the url title of those categories so they were different form the other category.

    There is more info on that particular problem here: http://linglau.com/index.php/blog/view/multiple_category_naming_issues_in_expression_engine and here: http://ellislab.com/forums/viewthread/204420/

    Many thanks,
    Michael

  • #9 / Feb 27, 2012 6:42pm

    Sean C. Smith

    3818 posts

    Micheal,

    Really happy to see you were able to find a solution to this. Is there anything else I can assist you with?

    Sean

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

ExpressionEngine News!

#eecms, #events, #releases