Member
Member
SubJunk   2014-02-05, 02:44
#1

I've enabled the related_items plugin and tried to use printRelatedItems() and getRelatedItems() in a theme but they return nothing - getRelatedItems() returns an empty array and printRelatedItems() doesn't print anything.

I've added tags to the image pages I'm testing, and other images share the same tags so I think it should match.

Is there something else I need to do to use the plugin?

Administrator
Administrator
acrylian   2014-02-05, 10:18
#2

By default relatedItems gets those for Zenpage news articles. You have to set the parameter correctly:
http://www.zenphoto.org/documentation/plugins/_zp-extensions---related_items.php.html#functiongetRelatedItems

Member
Member
SubJunk   2014-02-07, 05:03
#3

Sorry I should have said this before, I was using it like this:

printRelatedItems("5", "images");

I also tried specifying all params but it was still blank

Administrator
Administrator
acrylian   2014-02-07, 10:47
#4

The first parameter is an integer so no quotes needed. Are you really sure your images are published and not protected otherwise and also have tags set?

We have to try to reproduce it. We are using it with articles on our own site and that at leat for sure works. (the display part is a modification for the theme though but besides that it is the same).

Member
Member
SubJunk   2014-02-07, 11:31
#5

I haven't tried with news articles, but here's a vanilla installation of zenphoto 1.4.5.8 where all I've done is add images, give them all the same tag ("arrow"), enable the related_items plugin and add the following code to the default theme's image.php:

                    `Related`

``

Link: http://beta.dualmonitorbackgrounds.com/test4/index.php?album=SubJunk&image=AnonWorld.jpg

I guess I'm doing something obviously wrong but can't see it

Administrator
Administrator
acrylian   2014-02-07, 13:30
#6

Actually looks correct. Please take a look at your search options. Are maybe images disabled for results? It should not make any difference as the plugin should bypass that.

I will try to reproduce later today.

Member
Member
SubJunk   2014-02-09, 00:27
#7

Images aren't disabled for search results, thanks for trying to reproduce

Administrator
Administrator
acrylian   2014-02-09, 13:36
#8

I am sorry to report that it works for me as intended with images.

Administrator
Administrator
fretzl   2014-02-09, 14:38
#9

Works for me too.

Administrator
Administrator
fretzl   2014-02-09, 14:42
#10

Have you tried to set the "Cache expiry" to 0 (zero) in admin => options => search ?

Administrator
Administrator
acrylian   2014-02-09, 15:50
#11

Good tip, forgot the search cache completely!

Member
Member
SubJunk   2014-02-10, 03:08
#12

Thanks for trying to reproduce it. I changed the search cache to 0 but it still doesn't work for me. I checked the error logs and can't see any related errors.

Member
Member
SubJunk   2014-02-20, 06:35
#13

Could it have something to do with the PHP version? I'm running 5.3

Administrator
Administrator
acrylian   2014-02-20, 10:58
#14

I really doubt that although I primarily test on PHP 5.4 but it should really not make any difference. All this plugin does is do a manual tag search directly, so basically the same that happens if you click on a tag (which apparently works above). Are all images/albums tested published? Other than that I have no idea, sorry.

Member
Member
SubJunk   2014-02-22, 02:13
#15

Yeah they're published. I also tried with a fresh install of the latest 1.4.6 code (45abde6) and got the same results: http://beta.dualmonitorbackgrounds.com/test-45abde6/new-album/3rdRockFromTheSun.jpg
You can click the tag and it does the tag search properly like that, but still the related part is empty.
I'll try looking into it more

Member
Member
SubJunk   2014-02-22, 02:31
#16

I made it work by removing lines 118 and 120 in related_items.php, it wasn't passing either of those conditions. Hopefully that helps narrow down the cause.

Administrator
Administrator
acrylian   2014-02-22, 10:39
#17

Hm, I would need to reproduce it… Those lines actually do just check on which theme page you are and what item type to get the related items of. A current iamge is always set on an image.php page.

Member
Member
SubJunk   2014-02-22, 23:45
#18

I see what it was now. The last part of the condition on line 118 ($current->getAlbum()->name != $item['folder']) prevents it from returning related results from the same album as the source image, and I was only using that tag within one album.

Is there a reason for disregarding related results from the same album? I think for a lot of people, tags tend to cluster with albums, so it may not be a condition that always makes sense.

Administrator
Administrator
acrylian   2014-02-23, 10:14
#19

No, indeed there is no reason. Looks like a clear oversight on the images check.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.