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.

Gah! Pages and related category problem

October 21, 2008 6:43am

Subscribe [2]
  • #1 / Oct 21, 2008 6:43am

    ayza

    71 posts

    Hi all,

    hope you can help because I can’t figure out what I’m doing wrong.

    I have a template that should show
    1) A single entry and associated social bookmarks. The entry belongs to two categories: one unique to its weblog and one it shares with another weblog.
    2) A list of links from the category it shares with the other weblog.

    My problem is that I can’t get the second list to appear. I’ve tried with related_categories_mode=“on” but that doesn’t work either.

    The URL is template_group/template/title_url (here)

    {exp:weblog:entries weblog="{master_weblog_name}"  limit="1" disable="category_fields|member_data|pagination|trackbacks"}        
    <h3>{title}</h3>
    <p>{image}<br />
    {body}<br />
    <---social bookmarks---><br />
    {/exp:weblog:entries}</p>
    
    <p><ul ><br />
    {exp:weblog:entries weblog="hjalptexter"  disable="member_data|pagination|trackbacks"}    <br />
    <li><a href="#">{title}</a></li><br />
    {/exp:weblog:entries}    <br />
    </ul>

    Any good ideas?

    / Ayza

  • #2 / Oct 21, 2008 11:03am

    Robin Sowell

    13255 posts

    related_categories_mode would seem the logical choice.  Can you try it again- and post how you tweaked the code when you do it?  Not spotting why that shouldn’t work.

  • #3 / Oct 28, 2008 1:34pm

    ayza

    71 posts

    Hi,
    I have a test page where there should be one related entry at the bottom, but there’s ten!

    The first entry on the page (in weblog 1) shares one set of categories with the second weblog which should show one linked title at the bottom.

    Does the category need to be in the URL? Now it’s template_group/template/entryURL.

    Here’s the code:

    {exp:weblog:entries weblog="{master_weblog_name}"  limit="1"  disable="category_fields|member_data|pagination|trackbacks"}        
    <h2>{title}</h2>
    <p><div class="image">{image}</div><br />
    {body}<br />
    {/exp:weblog:entries}</p>
    
    <h3>Läs mer</h3>
    <p><ul ><br />
    {exp:weblog:entries weblog="hjalptexter"  related_categories_mode="on" custom_fields="off" member_data="off" disable="member_data|pagination|trackbacks"}    <br />
    <li><a href="http://{path=">{title}</a></li><br />
    {/exp:weblog:entries}    <br />
                    </ul>

    I also think it should work and haven’t a clue what’s wrong.

    / Ayza

  • #4 / Oct 29, 2008 10:47am

    Robin Sowell

    13255 posts

    Yep- looks like it should work to me as well.  What version and build are you running?  And so we can see what’s up- can you add a category tag pair to both tags- so they list out all of the categories the entries pulled back are assigned to?  Make sense?

  • #5 / Nov 09, 2008 4:19pm

    ayza

    71 posts

    Hi,

    I caught the flu so I’ve been away for a while. But back to work:

    I tried to add the categories tag as you suggested:

    {exp:weblog:entries weblog="{master_weblog_name}"  limit="1"  disable="category_fields|member_data|pagination|trackbacks"}        
    
    {categories}
    <h2>{title}</h2>
    <p><div class="image">{image}</div><br />
    {body}<br />
    {/categories}<br />
    {/exp:weblog:entries}</p>
    
    <h3>Läs mer</h3>
    <p><ul><br />
    {exp:weblog:entries weblog="hjalptexter"  related_categories_mode="on" custom_fields="off" member_data="off" disable="member_data|pagination|trackbacks"}    <br />
    {categories}<br />
    <li><a href="http://{path=">{title}</a></li><br />
    {/categories}<br />
    {/exp:weblog:entries}    <br />
    </ul>

    That caused the first weblog code to repeat itself twice despite limit=“1”, which I guess is caused by having assigned two categories to the entry. The second weblog that should contain the list, didn’t appear at all.

    I removed the {categories} tag and tried to use a category path: http://www.dashnotes.se/publik/rundtur/C61/ but the list with the titles from the second weblog that also uses the same category. The only the static headline “Läs mer” (read more) appears at the bottom. Previously I have used a template_group/template/url_title path, which so far haven’t worked.

    This shouldn’t be so hard!

    Btw, I’m running EE 1.6.4 Build:  20080319 and I don’t have the time to upgrade right now. I have done similar things with older versions so I can’t understand why it’s not working now.

  • #6 / Nov 10, 2008 7:47pm

    ayza

    71 posts

    Ha! Solved it!

    The problem was that I had several entries in different weblogs with the same url title. The related categories tag seemed to pick up the categories from all the entries with the same URL title, instead of just the one being displayed.

    Well, you learn as long as you live.

    /Ayza

  • #7 / Nov 10, 2008 7:58pm

    Sue Crocker

    26054 posts

    Glad to hear things are working for you again. Please don’t hesitate to post again if needed.

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

ExpressionEngine News!

#eecms, #events, #releases