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.

Related categories not showing related categories

July 16, 2010 1:14am

Subscribe [4]
  • #1 / Jul 16, 2010 1:14am

    porthos

    55 posts

    I’ve looked at this from a dozen angles and can’t figure out why it won’t work. I’m trying to show the entries that are in the same category as the entry they are viewing. I understand that I need the related_categories_mode tag but it still won’t bring up the entries. There are either too few or too many entries listed. The code:

    {exp:weblog:entries weblog="stories"}
    
    <h1>{title}</h1>
    
    {story}
    
    {/exp:weblog:entries}
    
    <h4>Other Stories in this category</h4>
    
    <p>{exp:weblog:entries related_categories_mode="on" limit="999"}</p>
    
    <p><a href="http://{title_permalink=">{title}</a></p>
    
    <p><br />
    {if no_results}</p>
    
    <p>There are no entries available.</p>
    
    <p>{/if}</p>
    
    <p>{/exp:weblog:entries}

    I just can’t see what’s wrong. Any help would be great.

  • #2 / Jul 16, 2010 3:55am

    John Henry Donovan

    12339 posts

    porthos,

    What does the url look like on the page you are testing on?

  • #3 / Jul 16, 2010 8:52am

    porthos

    55 posts

  • #4 / Jul 16, 2010 6:17pm

    Brandon Jones

    5500 posts

    porthos,

    Can you try just this in the template:

    {exp:weblog:entries related_categories_mode="on" weblog="stories" limit="999"}
    
    <a href="http://{title_permalink=">{title}</a>
    
    
    {if no_results}
    
    There are no entries available.
    
    {/if}
    
    {/exp:weblog:entries}

    Does that output correctly at that URL?

  • #5 / Jul 16, 2010 9:39pm

    porthos

    55 posts

    The result of that test is the message “There are no entries available.”

    Obviously there’s something wrong here. Not sure what, though.

  • #6 / Jul 17, 2010 10:51am

    Greg Salt

    3988 posts

    Hi porthos,

    In your CP, on the Edit page, can you choose the Stories weblog, then filter by the category of the entry that would be shown by the url_title. Are you getting results there?

    Cheers

    Greg

  • #7 / Jul 17, 2010 11:46am

    porthos

    55 posts

    In the CP, results are showing as they should.

  • #8 / Jul 17, 2010 12:05pm

    porthos

    55 posts

    OK. There’s a lot going on in this template. I’ve got:

    The main entry.
    A list of related entries sorted by author-id.
    A list of entries in the same category.
    A standalone edit form.

    There may be some conflict happening somewhere. To try to isolate the problem I broke out related entries, related categories, and saef into separate templates and embedded them. The problem persists.

    One question: Can having a weblog and a template group with the same name cause problems? Right now I’ve got stories for the template group and the weblog.

    The full code:

    {exp:weblog:entries weblog="stories"}
    
    <h1>{title}</h1>
    
    {story}
    
    {if date_started != ""}<strong>Date started:</strong> {date_started}{/if}
    {if date_completed != ""}<strong>Date completed:</strong> {date_completed}{/if}
    
    {/exp:weblog:entries}
    
    <h4>Organization responsible for this Story</h4>
    <p>{related_entries id="related_organization"}<br />
    <a href="http://{title_permalink=">{title}</a><br />
    {/related_entries}</p>
    
    <p>{embed="stories/stories_category"}</p>
    
    <p>{embed="stories/edit_story"}

    Stories category embed:

    <h4>Other Stories in this category</h4>
    <p>{exp:weblog:entries related_categories_mode="on" weblog="stories" limit="999"}<br />
    <a href="http://{title_permalink=">{title}</a></p>
    
    <p>{if no_results}<br />
    There are no entries available.<br />
    {/if}<br />
    {/exp:weblog:entries}

    The SAEF is pretty standard and uses the Form Helper plug-in from Solspace.

    Removing the related entries and saef embeds does not fix the issue. Placing the related category and related entries directly in the template (the SAEF must be embedded no matter what) also doesn’t fix the issue.

  • #9 / Jul 17, 2010 5:31pm

    Greg Salt

    3988 posts

    Hi porthos,

    You can certainly have a weblog and template group with the same name.

    Please confirm the version and build you are using. Additionally, which extensions and modules are active in this site?

    Cheers

    Greg

  • #10 / Jul 17, 2010 7:01pm

    porthos

    55 posts

    Running 1.6.9.

    Modules: User 2.0.9 (http://www.solspace.com/software/detail/user/) Haven’t upgraded to user 3x yet.

    Plug-ins: Form Helper (http://www.solspace.com/software/detail/form_helper/), Character Limiter, Magpie RSS Parser, Randomizer, Word Limiter, XML Encode

    Extensions: MD Simple Relation (http://masugadesign.com/the-lab/scripts/simple-relation/)

    Nothing special as far as I can see. Maybe MD Simple Relation is causing the hiccup? I do use it for the edit form (to restrict the list of relatable entries in the drop-down to entries created by the currently logged in user).

    But removing the edit form embed does not get rid of the problem.

  • #11 / Jul 18, 2010 4:03pm

    Greg Salt

    3988 posts

    Hi porthos,

    MD Simple Relation is an extension so just removing the form won’t disable whatever affect it might be having. Please go to your Extensions Manager and temporarily disable it by clicking the big green button, then test this again.

    Cheers

    Greg

  • #12 / Jul 19, 2010 12:31am

    porthos

    55 posts

    Greg:

    I disabled it and tried again. No change.

    After all the testing that I’ve done, though, I think a pattern has emerged:

    Entries that belong to a single category perform fine. Entries that belong to multiple categories do not. If an entry is listed in multiple categories it looks like all the entries that share a category (any category) with the entry are listed.

    An example:

    The user visits a page with a list of links to entries in Category A. In this example, the user clicks Entry A. Entry A is only in Category A along with entries B, C, and D.
    On entry A’s single page, entries B, C, and D are listed.
    The user visits the Category A page again. They click on entry B.
    Entry B is in Category A, B, D, and F.
    On Entry B’s page you see the entries in categories A, B, D, and F.

    This seems to make sense and EE is working as it should.

    So that idea seems to have pointed this in a clearer direction: If the entry is in multiple categories, how do you display just the related entries in the category they have ACCESSED the entry from?

    While this is surely technically possible using URL segments (haven’t thought of a way yet), I don’t see how the entry can have any permanent link to it. There would be multiple permanent links to a single entry. Something like:

    http://site.com/category_a/entry_a
    http://site.com/category_f/entry_a
    http://site.com/category_x/entry_a

    If all this is correct, this thread takes a new direction. Specifically:

    How to list entries in the category the user has accessed the entry from?
    How to have a logical permalink structure? It’s quite likely that there would be no “logical” permalink structure and the user simply bookmarks whatever location they access the entry from.

    Does any of this make sense?

  • #13 / Jul 19, 2010 6:25pm

    Brandon Jones

    5500 posts

    Stephen,

    From what you’ve described, that sounds correct. There’s probably a couple approaches in this case, though. I could move this over to the CodeShare Corner but you might have better luck posting anew there since this thread is a bit cluttered. Let me know what you’d like to do either way.

  • #14 / Jul 21, 2010 11:15am

    porthos

    55 posts

    Thanks Brandon. I’ll mull it over. It may be a simple matter of explaining to the client how the functionality works and that we may have have to come up with some less obtuse verbiage to describe the links we are showing.

  • #15 / Jul 21, 2010 7:39pm

    Brandon Jones

    5500 posts

    porthos, that makes sense. I’ll close this one for now, but don’t hesitate to start a new thread.

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

ExpressionEngine News!

#eecms, #events, #releases