Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2005-12-07 18:34:58

takshaka
Archived Plugin Author
From: Below the Manson-Nixon line
Registered: 2004-06-02
Posts: 97
Website

[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

#2 2005-12-08 02:32:33

soulship
Member
From: Always Sunny Charleston
Registered: 2004-04-30
Posts: 669
Website

Re: [plugin] [ORPHAN] chh_related_articles

takshaka,

Thanks! I have a site this will fit perfectly with. Yaaa!

Offline

#3 2005-12-08 13:26:13

sekhu
Member
Registered: 2005-05-12
Posts: 428
Website

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

#4 2005-12-17 12:32:05

himynameisjonas
Archived Plugin Author
From: Sweden
Registered: 2004-10-15
Posts: 21
Website

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

#5 2005-12-17 20:07:22

takshaka
Archived Plugin Author
From: Below the Manson-Nixon line
Registered: 2004-06-02
Posts: 97
Website

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

#6 2005-12-17 20:52:13

himynameisjonas
Archived Plugin Author
From: Sweden
Registered: 2004-10-15
Posts: 21
Website

Re: [plugin] [ORPHAN] chh_related_articles

THANKS, it works great! :D

Offline

#7 2005-12-20 18:50:13

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#8 2005-12-20 19:35:36

takshaka
Archived Plugin Author
From: Below the Manson-Nixon line
Registered: 2004-06-02
Posts: 97
Website

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

#9 2005-12-20 19:53:54

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#10 2005-12-20 20:17:18

tinyfly
Member
From: Dallas, Texas
Registered: 2004-05-10
Posts: 462
Website

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.

Offline

#11 2005-12-20 22:32:44

takshaka
Archived Plugin Author
From: Below the Manson-Nixon line
Registered: 2004-06-02
Posts: 97
Website

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

#12 2005-12-23 19:03:26

jordi
Member
From: Barcelona
Registered: 2005-09-14
Posts: 94
Website

Re: [plugin] [ORPHAN] chh_related_articles

Hey, takshaka, this is a really useful plugin, thank you for making it available.

Offline

#13 2006-01-05 22:30:47

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

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

#14 2006-01-06 17:50:54

takshaka
Archived Plugin Author
From: Below the Manson-Nixon line
Registered: 2004-06-02
Posts: 97
Website

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

#15 2006-01-06 18:55:47

The-Exit
Member
From: Berlin
Registered: 2005-07-16
Posts: 175
Website

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

Board footer

Powered by FluxBB