Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#76 2007-12-07 19:39:38

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

rad, if I do as you advise, the breakclass attribute will be gone. Is this OK?

When I was looking for “breakclass”, I found the line beginning with $atts = array_intersect_key at the very bottom of the plugin code. What about this attribute list, does it also have to reflect the changes?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#77 2008-04-08 07:26:47

derola
Member
Registered: 2006-03-09
Posts: 21

Re: [plugin] [ORPHAN] chh_related_articles

Thank you for this great plugin.

I use the plugin and works fine and show me all the related articles in a list but I’m trying to show the related articles separated by category (by example)

Now
Race 1 article
…. hotel 1
…. hotel 2
…. restaurant 1

Desired
Race 1 article
…. hotels
……….. hotel 1
……….. hotel 2
…. restaurants
……….. restaurant 1

Each articles has a Category (hotel or restaurant) and custom fields “carrera_directorio” (example: marathon) and “tipo_directorio” (example: restaurant).

Who are the correct way to show related articles as desired.

Thanks

Offline

#78 2008-04-08 08:19:49

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

As far as I know the only way to achieve this is to use several instances of the tag, each one restricted to one category.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#79 2008-04-08 08:24:28

derola
Member
Registered: 2006-03-09
Posts: 21

Re: [plugin] [ORPHAN] chh_related_articles

uli dijo:

As far as I know the only way to achieve this is to use several instances of the tag, each one restricted to one category.

I try to do this but don’t works :( Can you put an example?

Thank you

Offline

#80 2008-04-08 09:23:16

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

derola, I’m afraid I was too quick. By its nature any related article tag takes only the category of the current article, compares it to the list of existing articles and displays just those ones matching the criterion. Even txp:related_articles does so.

Have you tried something like …

Hotels
<txp:related_articles match=“Category1”/>

Restaurants
<txp:related_articles match=“Category2”/>

…with both categories being a subcategory of the current article’s category?

CAN NOT WORK! Sorry I couldn’t help you any further. But they have an excellent “How do I …” forum here ;)

Last edited by uli (2008-04-08 09:35:56)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#81 2008-04-08 13:27:17

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: [plugin] [ORPHAN] chh_related_articles

Hi Derola,
Are you trying to output a list of hotels and restaurants near a certain race, where the race is an article, and each hotel or restaurant is an article? Sounds tricky…how are you relating the two at the moment? I didn’t quite understand your post, but maybe <txp:if_different> might be of help?

Offline

#82 2008-04-08 13:59:04

derola
Member
Registered: 2006-03-09
Posts: 21

Re: [plugin] [ORPHAN] chh_related_articles

nabrown78 dijo:

Hi Derola,
Are you trying to output a list of hotels and restaurants near a certain race, where the race is an article, and each hotel or restaurant is an article?

Yes and I would like to list hotels separately from restaurants.

Any idea or other plugin to make this?

Offline

#83 2008-04-08 14:22:07

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: [plugin] [ORPHAN] chh_related_articles

Derola,
What about using neighborhoods/locations to relate the races and restaurants/hotels — I’m assuming that’s the real relationship? So category1 for each article would be whether it is a race, restaurant, or hotel, and the category2 would be the neighborhood. Then you could output a list of hotels and restaurants in the race article’s neighborhood. You could use <txp:if_different /> to sort them. If you haven’t used that tag before, it’s a little hard to get the hang of but can really come in handy. Check out graphicPush’s tutorial. If you need to slot any hotel or restaurant into more than one neighborhood, you might be able to use rss_unlimited_categories. Does any of that make sense?

Offline

#84 2008-04-08 22:03:33

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

Over and over again it turns out: morning wasn’t made for me ;) This should work (see article_custom, example 3):

Hotels
<txp:article_custom form="gastro_list" category="hotels" />

Restaurants
<txp:article_custom form="gastro_list" category="retsaurants" />

with the “gastro_list” article form containing:
<p><txp:permlink><txp:title /></txp:permlink></p>


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#85 2008-04-08 22:15:42

derola
Member
Registered: 2006-03-09
Posts: 21

Re: [plugin] [ORPHAN] chh_related_articles

Uli, your example show all the Hotels or Restaurants, but the website only must show the Hotels or Restaurant of the race (article)

Each article contain a custom_field called “carrera” with a value (example: Benahavis) this value is for link race (article) with Hotel/Restaurant.

Sorry for me poor english ;)

Offline

#86 2008-04-08 23:33:55

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

If the number of races is limited/constant you could embed my proposal into a “txp:if_custom_field” tag and repeat it as often as necessary, one for each race:

<txp:if_custom_field name="carrera" val="Benahavis"> 
Hotels
<txp:article_custom form="gastro_list" category="Benahavis_hotel" />
Restaurants
<txp:article_custom form="gastro_list" category="Benahavis_restaurant" />
</txp:if_custom_field>

<txp:if_custom_field name="carrera" val="Marbella">
...

It would be necessary then to create two categories for each race.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#87 2008-04-08 23:34:05

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: [plugin] [ORPHAN] chh_related_articles

Hi Derola,
The plugin asy_wondertag may be of use to you. What you want to do is something like this, right:
<txp:article_custom form="permalinked_title" category="<txp:custom_field name="carrera" />" />. With the appropriate code in the form permalinked_title, this would output a list of articles whose category matches the current (race) article’s “carrera” value. Normally you can’t use txp tags as attributes of other txp tags, but asy_wondertag usually allows you to do just that.
Now…I’m thinking that if you want to have a hotel or restaurant listed for more than one race, you run into a problem. But aside from that, this should work.

Offline

#88 2008-04-08 23:45:07

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

Re: [plugin] [ORPHAN] chh_related_articles

Nora, thanks for providing an elegant, less hardcoded solution than mine. That’s what you’ll rarely find in other forums, two people delivering ideas for the same problem :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#89 2008-04-09 08:11:58

derola
Member
Registered: 2006-03-09
Posts: 21

Re: [plugin] [ORPHAN] chh_related_articles

Thank you guys, with your help seems run ok.

This afternoon, I test it creating many races, hotels… to check it works correctly :)

The code used are:

<txp:asy_wondertag>
<txp:article_custom form="listado" carrera_directorio="<txp:custom_field name="carrera_directorio" />" category="Alojamiento" />
</txp:asy_wondertag>

Offline

#90 2008-04-12 04:11:12

rsskga
Member
From: San Francisco, CA USA
Registered: 2007-06-23
Posts: 50
Website

Re: [plugin] [ORPHAN] chh_related_articles

rad wrote:

BUG FIXED

Thank you for your most helpful suggestion!


Swim Kitten, A Magento Site
When nothing but incredibly revealing dresses and swimwear will do

Offline

Board footer

Powered by FluxBB