Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[plugin] [ORPHAN] chh_related_articles
chh_related_articles is an enhanced version of txp:related_articles that can determine “relatedness” not just by comparing article categories, but also via keywords, authors, and/or custom fields. Additionally, fields may be mapped to different fields for comparison. You could, for example, find all articles with a custom field that matches any of the keywords from the current article.
Because my docs are a bit sketchy, I was going to wait until I could write some examples before announcing it here. But some people are already downloading it, so I might as well go ahead and make it official.
For a quick example, this is an actual tag I am using:
<txp:chh_related_articles relation="related->keywords" custommode="list" section="?" excerpted="y" sortby="Title" sortdir="asc" wraptag="ul" break="li" label="related" labeltag="p" />
This means, in a mouthful, “list all excerpted articles in the current section, sorted by Title, with keywords that match one of the terms in the custom field named related.” Whee…
Little update: the plugin now can use an article form for list output instead of just the standard wraptag/break stuff.
Last edited by takshaka (2005-12-08 00:58:00)
Offline
Re: [plugin] [ORPHAN] chh_related_articles
takshaka,
Thanks! I have a site this will fit perfectly with. Yaaa!
Offline
Re: [plugin] [ORPHAN] chh_related_articles
i hope to try this, thanks for the plugin
EDIT: worked flawlelssly – using the keyword example as that’s what I wanted to use. thanks again
Last edited by sekhu (2005-12-08 14:36:43)
Offline
Re: [plugin] [ORPHAN] chh_related_articles
i doesn’t work on a article list page, just in a individual article page. is there a way do make it work on a article list page?
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Okay, I’ve made a couple of bugfixes. The tag now returns results on any article page or whenever it is included in an article form (for use in article lists).
Try the latest version
Offline
Re: [plugin] [ORPHAN] chh_related_articles
THANKS, it works great! :D
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Takshaka,
This plugin is awesome! Thank you so much. I am having a small issue when I use the tag to call a form from within a form.
This is inside a form called “artist”<code>
<div class=“releasesSM”></div>
<txp:chh_related_articles section=“releases” relation=“artist_name” form=“releases_excerpt” />
</div>
<div class=“artistname”><h6><txp:custom_field name=“artist_name” /></h6></div><div class=“artistbody”><txp:body /></div></code>
everything works fine, except once it processes the form “releases_excerpt” no other TXP tags get parsed.
so essentially the form will process the chh_related_articles tag, but any tags after that don’t work.
any ideas? It doesn’t seem to matter what’s inside the “releases_excerpt” form…if it calls a form at all , the subsequent tags don’t work.
using 4.0.2
Thanks for the help.
—
Tom
Offline
Re: [plugin] [ORPHAN] chh_related_articles
I had suspected such a problem would exist, but my shoddy testing didn’t manifest it. Thanks for doing my work. :)
At any rate, this shiny new version should take care of it.
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Ah! All is well. Many, Many thanks for the great plug-in and speedy response. Excellent work!
Cheers,
—
Tom Reno
Gainesville, Florida
Offline
Re: [plugin] [ORPHAN] chh_related_articles
takshaka-
relation=“author” was not working for me so after looking through your code I found a bug. At around line 80 where it says $search_words[] = $current_article['author']; it should be $search_words[] = $current_article['authorid'];
Thanks for the great plugin.
Refresh Dallas and other Refreshing Cities.
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Oops. I’m going to set a record for most public revisions in a day — that’s three. Thanks, tinyfly.
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Hey, takshaka, this is a really useful plugin, thank you for making it available.
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Very great plugin! Thank you.
One question for keywords: how can you separate words?
eg. “credit spread”, “equity”
I would like to get only related articles which have “credit spread” oder “equity” and not “credit” or “spread”. Is the comma separating?
When I get the plugin right, it will use either labels, wraptags etc. or forms? How can I get a label, when I use an article form? Could you integrate a conditional “if related articles” tag? This would be really great!
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Just separate the words or phrases with commas: “credit spread,equity”. There should be no space before or after the comma (this will change; the next revision will ignore leading/trailing whitespace).
Also keep in mind that keywords are matched by substring, so that “equity” will also match “home equity” and “gender equity,women’s rights”.
EDIT: You can now use the strict attribute to force exact matches.
Could you integrate a conditional “if related articles” tag?
I take it you don’t want the label (or whatever text) to show unless there are articles listed. That is a problem with all article_custom style form-based lists.
To that end, I wrote a conditional tag (chh_if_not_empty) that I’ve been using myself. Perhaps I should make it available as a plugin, neh?
NOTE: This plugin has appeared, though with a different name: chh_if_data
Last edited by takshaka (2006-02-07 22:39:43)
Offline
Re: [plugin] [ORPHAN] chh_related_articles
Thanks for your anweser.
To that end, I wrote a conditional tag (chh_if_not_empty) that I’ve been using myself. Perhaps I should make it available as a plugin, neh?
Perhaps you can even integrate that to your plugin :-)
Offline