Keywords Plugin: Showing keywords in related_entries
Posted: 16 July 2005 10:12 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003

Can I accomplish the following using the Keywords plugin?

<h1>Item Title</h1>
<
p>Blah blah blah.</p>

<
h2>Entries related to this item</h2>
{exp:keywords:some_function}
  
<p><a href="http://path_to_item/">{title}</a><br />
  
Related to this entry by: {keyword}</p>
{/exp:keywords:some_function}


I tried something like the following, to no avail:

{exp:keywords:related_entries entry_id="{segment_3}" weblog="news" keyword_fields="news_tags" limit="5"}
  
<p><a href="http://path_to_item/">{title}</a><br />
  
Related to this entry by: {keyword}</p>
{/exp:keywords:related_entries}


Can anybody with experience with the Keywords plugin help me out?

(EDIT: Very important clarification I left out originally: the {keyword} tag that isn’t getting parsed. The rest of the related_entries tag functions as expected.)

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 16 July 2005 10:35 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

Do you mean like here?  Better to clarify first, this time. wink

 Signature 
Profile
MSG
 
 
Posted: 16 July 2005 11:00 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003

I don’t think so. You’re using the {exp:keywords:entries} tag there, aren’t you? If I’m correctly interpreting what you’re doing, you already know which tag you are looking for (defined in {segment_4} it seems). With the {exp:keywords:related_entries} tag, I don’t know which keywords are in play. As the docs say,

This function returns entries that share <em>any</em> keyword with the entry specified.

So I can’t know in advance which keywords are available. To illustrate:

Entry 1
Keywords: alpha|beta|omega

Entry 2
Keywords: omega|fatty acids

Entry 3
Keywords: sasquatch|beta|filibuster

Entry 4
Keywords: alf|alpha|elf|elsif|turnip

Entry 5
Keywords: male pattern baldness|disestablishmentarianism|i am spartacus

Let’s say a visitor arrives at http://domain.com/news/item/entry_1. I want to display all the other entries that share <em>any</em> keyword in common with this entry. The exp:keywords:related_entries tag will return Entry 2 (match on omega), Entry 3 (match on beta), and Entry 4 (match on alpha), but not Entry 5 (no match). But the keywords:related_entries tag will not, as far as I can tell, return the keyword (as variable {keyword}) that links Entry 1 with each of the other entries it shares a relationship to.

That isn’t the end of the world, of course. But to a user, it can be confusing. He wants to know not only which entries are related to the one he’s viewing, but also <em>how</em> they are related. He might be interested in reading more about entries with the keywords alpha and omega, but not those with the keyword beta.

That’s a long-winded way of asking: can I do what I’m trying to do without hacking the Keywords plugin or harassing the author to add this feature to the plugin?

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 16 July 2005 11:03 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

No, I meant at the bottom of that page.  Did you scroll down?  It’s headed by “Tags in common with…”  Which sounds like what you want, I think.  This is the code that I used:

<p>Tags in common with {segment_3}:<br />
{exp:keywords:related_keywords keyword="{segment_3}" keyword_fields="main_tags|quotes_tags" weblog="{current_blog}|sayings" backspace="3"}
<a href="{path=tags/tag}{keyword}">{keyword}</a>,
{/exp:keywords:related_keywords}
</p>

 Signature 
Profile
MSG
 
 
Posted: 16 July 2005 11:20 AM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  752
Joined  08-16-2003

Oh, no, not that either. (Am I being a big enough pain in the rear yet?)

Your list is the tags in common with a given tag. Unless I’m looking at it incorrectly, individual entries really have nothing to do with your list. Your list just describes relationships between tags. I want to describe the relationship between two <em>entries</em>. I think the difference between what you’re doing and what I want is something like this:

Your example:
Here is a keyword.
These other keywords are used on some of the same entries as the first keyword.
Here are those keywords.

What I’m looking for:
Here is an entry.
This other entry shares a keyword with the first entry.
Here is that keyword.

It’s the difference between keywords that share an entry, and entries that share a keyword. Does that make any sense?

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 16 July 2005 11:22 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33276
Joined  05-14-2004

So you mean entries that share multiple keywords? Because thet top list with all entries with the one keyword…

Or did you want to specify several entries and show all the keywords amongst them?

Or wait, you mean on a single entry page, as opposed to a dedicated keywords page?

As far as I can tell, the code you showed in your first post, as per here would be the correct code.  What happened when you tried it, and what was the URL of the page you were trying it on?

 Signature 
Profile
MSG
 
 
   
 
 
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: 66467 Total Logged-in Users: 27
Total Topics: 84860 Total Anonymous Users: 15
Total Replies: 455330 Total Guests: 163
Total Posts: 540190    
Members ( View Memberlist )