Related entries extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Related entries extension

Postby hansfn » Mon Aug 22, 2011 7:16 am

This is the discussion topic for the Related entries extension.

Visit http://extensions.pivotx.net/entry/58/related-entries for more info or download.
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Related entries extension

Postby carlus6306 » Fri Sep 30, 2011 8:37 pm

I can only make it work with tags. I want to use it only with a specific category (like the extension documentation describes, but I can't make it work that way, I get no related links). Could you give me an example code using a category as related? for instance the category News.
Thank you in advance.
carlus6306
 
Posts: 1
Joined: Thu Sep 29, 2011 5:13 pm

Re: Related entries extension

Postby Marsz » Fri Oct 14, 2011 11:17 am

Cheers, i was waiting for such an extension for a long time!

It works fine with the latest version of PivotX.
Marsz
 
Posts: 23
Joined: Wed Jan 23, 2008 7:43 am

Re: Related entries extension

Postby Logfather » Fri Nov 04, 2011 10:50 am

Does it work well for you guys? With the example code in the help doc I just got a random selection of a few entries..? :D
Logfather
 
Posts: 163
Joined: Sun Jul 12, 2009 9:29 am
Location: Amsterdam

Re: Related entries extension

Postby hansfn » Tue Nov 29, 2011 10:16 pm

I'm happy to announce version 1.1 (written by me):
- Added support for extrafields replacements. (Explained in the docs.)
- Removed a lot of duplicated code and reorganized code (DRY).
- Various other fixes.

@Logfather: The reason the old example code didn't work was the hard coded "related" parameter - just remove it. (It's not included in the code example in the new version.)
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Related entries extension

Postby Gerard113 » Mon Jan 16, 2012 8:50 pm

I tried the Related entries extension and was testing the reation between the results

the used code is:
Code: Select all
[[related_entries
    pre="<ul class='related-entries'>"
    post="</ul><!--end related entries-->"
    format="<li><a href='%link%' rel='bookmark'>%title%</a><br />%relation%</li>\n"
    amount=5
    search="tags"
    method="strict"
    order="desc"
    excerpt_length=100
    list_separator=", "
    date_format="%day% %month% %ye% - %hour24%:%minute%"
    ]]


when i look at the results see the following:

used tags in entrie: Gebruikte Tags: petticoat, rosalie de jong, simone breukink, willemijn de vries

Result gives: no results but when i click on the tags there are results enough:

[Edited by hansfn - removed username/password and debug log.]

Can anyone help me to find out what's going wrong?
Gerard113
 
Posts: 183
Joined: Fri Aug 07, 2009 9:58 pm
Location: nederland

Re: Related entries extension

Postby hansfn » Tue Jan 17, 2012 8:26 am

You found a bug. I'll upload a new version of the extension today, but until then open the file extensions/related_entries/snippet_related_entries.php and replace

Code: Select all
        if ($orderby == "random") {
            $qry['order'] = "RAND()";
        } elseif ($orderby == "asc") {
            $qry['order'] = "target_uid ASC";
        } else {
            $qry['order'] = "target_uid DESC";
        }

with

Code: Select all
        if ($orderby == "random") {
            $qry['order'] = "RAND()";
        } elseif ($orderby == "asc") {
            $qry['order'] = "t.target_uid ASC";
        } else {
            $qry['order'] = "t.target_uid DESC";
        }

Explanation: You have to use "t.target_uid" since "target_uid" matches several table columns in the SQL SELECT query.
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Related entries extension

Postby lomi » Mon Jun 10, 2013 6:53 pm

carlus6306 wrote:I can only make it work with tags. I want to use it only with a specific category (like the extension documentation describes, but I can't make it work that way, I get no related links). Could you give me an example code using a category as related? for instance the category News.
Thank you in advance.


i'm also looking for this. So if you're browsing in an entry in one specific cateogry ( news ) it just would display related entries that match the tags and are in that same category (news ).
lomi
 
Posts: 25
Joined: Fri Jun 17, 2011 6:27 pm

Re: Related entries extension

Postby hansfn » Tue Jun 11, 2013 6:44 am

Post the code you are using (and the version of the extension and PivotX). You are using MySQL as the backend for PivotX?
hansfn
Developer
 
Posts: 3280
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Related entries extension

Postby lomi » Tue Jun 11, 2013 9:53 am

I'm using MySql as backend and the version of the extension is -> 1.1.1, last updated: 2012-01-17
The code i'm using now is this one:

Code: Select all
 [[related_entries pre="<div id='related-entries'>" post="</div>"
  format="<a href='%link%'>%title%</a><br />"
  amount=20
  order="desc"
  excerpt_length=100
  ]] </div>
lomi
 
Posts: 25
Joined: Fri Jun 17, 2011 6:27 pm

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 2 guests