1 of 2
1
related_categories_mode linking when post has no categories!
Posted: 28 August 2008 09:10 AM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

This is a strange one (i’ve been getting a lot of these recently).

I have related categories turned on to link between two weblogs.  And for some reason some posts are relating even though they aren’t sharing a category (infact they don’t have any categories selected at all).

Weblog “projects” has a category group of “project categories”, currently all posts have no categories selected.

Weblog “blog” has category groups of “blog categories” and “project categories”, and some posts are tagged with categories from “blog categories”.

If I go to the single entry templates for projects I am getting realted blog posts showing up even though they arent sharing categories!  It doesnt happen the other way around (the blog posts arent relating to the project page).  It’s only happening with category ID 1.

It’s only happening on some posts, and i might be worth noting I imported a load of blog posts from wordpress (using the MT import untility)

I’ve checked exp_category_posts, and the project posts aren’t in the list (as they dont have any categories).

Below is the code:

<div class="main">
    
{exp:weblog:entries weblog="projects" orderby="date" sort="desc" limit="1" disable="pagination|member_data|trackbacks"}
    
<div class="post">
        <
h2 class="post-title">{title}</h2>
        <
p class="post-meta">Posted by {author} on {entry_date format="%d %F %Y"}{if allow_comments} | <a href="#comments">{comment_total} Comments</a>{/if}</p>
        
{project_summary}
        {project_body}
        
<p class="post-meta">Posted in:
        
{categories backspace="7"}
        
<a href="{path=blog}">{category_name}</a>,&nbsp;
        
{/categories}
        
</p>
    </
div>
    
{if no_results}
    
<p>No Results</p>
    
{/if}
    {
/exp:weblog:entries}

    {exp
:weblog:entries weblog="blog" limit="5" related_categories_mode="on"}
    {if count
==1}<h3>Related Blog Posts</h3><ul>{/if}
        
<li><a href="{url_title_path=blog/entry}">{title}</a></li>
    
{if count==total_results}</ul>{/if}
    {
/exp:weblog:entries}
</div>

Profile
 
 
Posted: 28 August 2008 05:27 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12381
Joined  04-29-2002

It’s only happening on some posts, and i might be worth noting I imported a load of blog posts from wordpress (using the MT import untility)

Can you narrow it down to just those entries? Or is it happening on other “regular” entries?

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 29 August 2008 10:19 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

It seems to happen on regular entires…

“Blog” to “Projects” seems to be relating correctly. (on the blog templates)

But some “Projects” are relating to all “Blog” entries that have Catagory ID 1, even though that category group isn’t assigned to the projects weblog. (on the project templates)

I’ve actaully gone ahead and reinstalled EE since this was on a new site build that i just started.  I’m hoping I won’t get the bug this time.

I did save off the old DB and might play about with that at some point to see if i can figure out what was going on.

Profile
 
 
Posted: 29 August 2008 10:22 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  12381
Joined  04-29-2002

I can close this thread for now, but have you start a related thread, if it happens again..

 Signature 

Quick Reference - EE Trial Options - EE Wiki - Docs for updating a build

Profile
MSG
 
 
Posted: 29 August 2008 03:03 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

New install of EE.  Reimported the WP entires, setup weblogs… seems to be happening again :(

So maybe the MT Import is messing up the install, or there is a bug in EE (it happens with catagory ID 1 only), or my template code has an error in it…

Profile
 
 
Posted: 29 August 2008 04:08 PM   [ Ignore ]   [ # 5 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

Ok I have sussed out the problem… But not sure what the solution is

It appears some of my blog posts, and some of my project posts have the same URL titles (URL titles in different weblogs can share the same url name it seems). 

I not sure how I should be using the tag.

On the projects page, I want to show all blog entries that share the current tag from project that is currently being displayed.

Profile
 
 
Posted: 02 September 2008 12:57 PM   [ Ignore ]   [ # 6 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Joobs - I think I saw another post from you on this; did you still need this particular one addressed, or has it already been?

I believe you just need the weblog= parameter. =)

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 04:28 PM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

Yeah i still need help on this.

The problem is that I have two weblogs, that have entries with the same url title.  Projects weblog has only a few categoires assigned to it, Blog weblog has many categories assigned to it.

If im in weblog “projects” and want to show all “blog” posts that share the same categories i use something like this:

{exp:weblog:entries weblog="projects" orderby="date" sort="desc" limit="1" disable="pagination|member_data|trackbacks"}
    
... Showing a project here ...
{/exp:weblog:entries}

{exp
:weblog:entries weblog="blog" limit="5" related_categories_mode="on"}
    
... Showing blog posts that share the category from the post above ...
{/exp:weblog:entries}

That works fine for most of the posts…. until we get to one of the ones that shares the same url title.  What happens then is it seems to take the categories value for the “blog” weblog rather than the “projects” weblog, and the blog weblog post might have all sorts of categories assigned to it.  So this relates a blog post with blog posts, rather than a project with blog posts.

Does that make sense?

Profile
 
 
Posted: 02 September 2008 05:04 PM   [ Ignore ]   [ # 8 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

I remain confused, I’m sorry, Joobs. Bear with me?

The tag with related_categories_mode - are you specifically calling weblog=“blogs”, but you then say you want it from projects…. That’s where you’re losing me. Why not then just say weblog=“projects”?

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 05:26 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

Hmm i’ll try my best to explain.  It’s been a few days since i’ve worked on the related categories, so I think what i’m going to show is correct.

Projects Weblog Posts:
URL = Amaazing-Project-1
Cat = Projects

URL = Amazing-Porject-2
Cat = Projects

Blog Weblog Posts:
URL = Blog-Post-1
Cat = Projects

URL = Blog-Post-2
Cat = Misc

URL = Blog-Post-3
Cat = Projects

URL = Blog-Post-4
Cat = Misc

URL = Blog-Post-5
Cat = Misc

URL = Amazing-Project-2
Cat = Misc


Those are our posts in both the “projects” and “blogs” sections.

Now i go to the Projects tempalte group of the site and look at the pages:

====================================
Amazing-Projects-1
... some text ...

See all blog posts relating to this project:
Blog-Post-1
Blog-Post-3
====================================

Now the other projects page:

====================================
Amazing-Projects-2
... some text ...

See all blog posts relating to this project:
Blog-Post-2
Blog-Post-4
Blog-Post-5
(I want these to display blog posts 1 and 3)
====================================

In the second example the related categories code is looking at the url title (which belongs to both a Blog weblog, and a Projects weblog).  For what ever reason it assumes it’s on a blog page rather than a projects page, so it’s look at the categories assigned to the Blog post with that url name, rather than the categories assigned to the Projects weblog with that url name.

So in this example I need something like (which doesn’t exist?):

{exp:weblog:entries current_weblog="projects" related_categories_results_weblog="blog" related_categories_mode="on"}

Profile
 
 
Posted: 02 September 2008 05:57 PM   [ Ignore ]   [ # 10 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Ok, Joobs—

I need to see this, in a fully reduced template, to understand where you are having problems.

So, create a template with two weblog entries tags on it.  The first one should not have related_categories_mode but should just show the {title} and {weblog_short_name}

The second weblog entries tag *should* have related_categories_mode and show both of those variables as well.

That is *all* that should be on the template; otherwise blank. The output should be quite plain. =)

Now visit it with a valid URL title, and give us a link to that template with the URL title appended at the end of the link.

Thank you!

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 06:50 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

It’s not a live site at the moment… But I still don’t think i’ve explained my issue correctly. I’ll put a new EE install online if it’s still not clear after this post.

If I did what you suggest I would get a page like this:

Title: Project Title
Weblog
: projects

Weblog
: blog - Title: Blog Title 1
Weblog
: blog - Title: Blog Title 2
Weblog
: blog - Title: Blog Title 3
Weblog
: blog - Title: Blog Title 4

I’m not sure what that’s going to tell you…

The issue isn’t getting “projects” displaying in first entires tag, and “blog” posts in the second (related categories) tag.  That will happen whatever the URL is (assuming it valid).  The issue is that it’s displaying the wrong blog entires when URLs between weblogs match up.

What I want to happen:
It looks at the URL, find that URL title belongs to a project and a blog post, but it knows I am looking at a project post, looks at the categories assigned to the project post that has the URL title, shows all blog posts that share that category. Result is i’m relating a Project post with Blog posts.

What seems to actually happen:
It looks at the URL, finds that the URL title belongs to a project and a blog post, defaults with the blog post, looks at the categories assigned to that blog post that has the URL title, shows all blog posts that share those categories. Result is im relating a Blog post with other Blog post.

So say I had a project called “amazing-project-2” and it had no categories assigned, and I had a blog post called “amazing-project-2” which had hundreds of categories assinged.  When I go the the project page I would expect no related category entires to be found because that post has no categoires, but instead it lists many related blog posts because it’s reading the categories from blog post called “amazing-project-2” rather the project post with that name…  If i change their URLs to be unique then the problem doesn’t happen because it’s reading the categories from the correct weblog.

Profile
 
 
Posted: 02 September 2008 07:07 PM   [ Ignore ]   [ # 12 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Hi, Joobs -

I see what you think is happening; however, I don’t want to guess at that.  We need to see exactly what a template outputs, and that means reduction test and isolating.  What you are seeing may be a bug (not restricting to the weblog= you’ve declared), or it could be data confusion, or a template issue.

The only way to figure that out is a reduction test - get the simplest items into the template, and find out what about that reduced example is wrong - then move forward from there.

Right now, you’re typing in huge paragraphs abotu data i know nothing about.  I need you to work with me on reduction testing this so we can get to the bottom of it.

So, create a blank template and put this in it:

{exp:weblog entries weblog="projects" limit="1"}
{title}
| {weblog_short_name}<br />
{/exp:weblog:entries}

<h2>Related</h2>
{exp:weblog:entries weblog="projects" limit="5" related_categories_mode="on"}
{title}
| {weblog_short_name}<br />
{/exp:weblog:entries}

And give us a link to that template, and a URL Title we can use to test.

Thank you.

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 07:47 PM   [ Ignore ]   [ # 13 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

Ok I put a fresh install.

I’m using this code, which is slightly different:

<h2>Project Post</h2>
{exp:weblog:entries weblog="projects" limit="1"}
{url_title}
| {weblog_short_name}<br />
{/exp:weblog:entries}

<h2>Blog Posts Relating To This Project</h2>
{exp:weblog:entries weblog="blog" limit="5" related_categories_mode="on"}
{url_title}
| {weblog_short_name}<br />
{/exp:weblog:entries}

The “Project” post with title of “project_1” has no categories assigned.
There is a “Blog” post also called “project_1” which has a category of “blogging” assigned (which is shared by other blog posts).

http://curiositycollective.org/eetest/index.php/project/entry/project_1

So on the above page, nothing should be shown in the related entries, but instead EE is relating the blog post called “project_1” with other blog posts of the same category.

Profile
 
 
Posted: 02 September 2008 07:51 PM   [ Ignore ]   [ # 14 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

I see, so it looks like the weblog entries tag, when related categories mode is on, is possibly ignoring the weblog= parameter.  Does that sound about right?

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 07:59 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

I don’t think it’s ignoring the weblog parameter as it works as expected unless the URL title is shared by an entry in another weblog.  The weblog paramater is used to control which weblog entires are outputted, what happening here is EE is getting the categories from the wrong entry/weblog and then outputting related entires based on this incorrect information.

EE has no way to tell if it should be looking at the categories from weblog “blog” with title “project_1” or the categories from weblog “projects” with title “project_1”.

Profile
 
 
Posted: 02 September 2008 08:03 PM   [ Ignore ]   [ # 16 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Joobs - something is up, I can agree with that, but I’m not sure your assessment is spot on. That said, my brain is so looped around this thing that I can’t quite say.  I’m going to talk to the team and try to figure out what is going on here.  I am not sure if this is expected behavior at this point. 

I will keep you up to date on what I find - and thank you very much for working with me on this.  It’s a bit of a doozy!

 Signature 
Profile
MSG
 
 
Posted: 02 September 2008 08:06 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
RankRank
Total Posts:  271
Joined  07-04-2007

ok smile

for comparison here is the blog entry:
http://curiositycollective.org/eetest/index.php/blog/entry/project_1

Profile
 
 
Posted: 02 September 2008 08:07 PM   [ Ignore ]   [ # 18 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Thank you Joobs!  I will update as soon as I have more information, as I said. =)

 Signature 
Profile
MSG
 
 
   
1 of 2
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64912 Total Logged-in Users: 29
Total Topics: 81864 Total Anonymous Users: 26
Total Replies: 440105 Total Guests: 195
Total Posts: 521969    
Members ( View Memberlist )
Newest Members:  bjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkeybenekwhobutsb