Related Items in 1.6

Ralf Member

Hi,
probably i am blind, but where can i find the correct usage of
<?php printRelatedItems(5,'news',null,null,'news'); ?>

in zenphoto 1.6. ?

The above code does not work anymore in 1.6.
Neither when adding it to the codeblock of one article nor when adding it to news.php.

Would be great if someone can help.

Ralf

Comments

  • acrylian Administrator, Developer

    Actually nothing changed, the above code should work although the last "news" is actually wrong as that is a boolean parameter:
    https://docs.zenphoto.org/1.6.1/namespaces/default.html#function_printRelatedItems

  • acrylian Administrator, Developer

    Did you clear the search cache?

  • Ralf Member

    Hi ,
    yepp. did this multiple times.

    It does not matter if i change the last 'news' to 'false'

    Any other ideas?

  • fretzl Administrator, Developer

    Something was indeed wrong. This is now fixed. Please try the Support build.

  • acrylian Administrator, Developer

    We can sadly confirm meanwhile that this is unwantedly broken. Somehow that slipped through although I was sure I tested it…

  • Ralf Member

    No problem at all :-)
    Will use the support build as soon as i have time to finish my site.

  • Ralf Member

    Hi,
    could you tell me which file from the support build I need to use?
    When using the support built as a fresh install, the completed Backend is in english first and all plugins have english messages like the contact form
    (send copy instead of Kopie senden etc).

    Changing the language in the settings does not change the text. It stays english.

  • acrylian Administrator, Developer
    edited January 20

    Normally you should not use just files from a support build but the support build in total because of dependencies in numerous files. Regarding related items and the early stage of 1.6.2a you can just use the plugin files


    Regarding the language. Please use a separate topic. "1.6" is pretty generic - it's even about 1.6.1 ;-) - and this is a general topic.

    Please see: https://www.zenphoto.org/news/problems-with-languages/

    Also this may still apply: https://www.zenphoto.org/news/translations-gettext-not-working-on-some-servers/

    If using MAMP 6.8 locally gettext does not work using PHP 8.2 for unknown reasons on the MAMP vendor knows. It otherwise works including our own server.

  • Ralf Member

    Thanks for your answer - what makes me wondering:
    The language works without problems with the official build.
    When setting the username/password after the install I see different language flags at the bottom (german, netherland, english).
    With the support built it is only the english/american flag.

    Anyway: I only need the related items plugin :-)

  • acrylian Administrator, Developer
    edited January 20

    I don't think there has been any change between 1.6 and 1.6.1 regarding languages.

    Note that if you user account has a language set it may override the general setting. But that's not new either.

  • Ralf Member

    OK, thanks.

  • Ralf Member

    Hi,

    with related items from the support built there seems to be something wrong - sometimes the related items are not shown and the error protocol in the backend shows:
    ANWENDUNGS-FEHLER: mysqli Fehler: (INSERT INTO [Vorsilbe]search_cache (criteria, data, date) VALUES ('a:5:{s:4:\"item\";s:4:\"news\";s:6:\"fields\";s:4:\"tags\";s:1:\"s\";s:197:\"a:11:{i:0;s:15:\"Bildbearbeitung\";i:1;s:1:\"|\";i:2;s:4:\"Blog\";i:3;s:1:\"|\";i:4;s:10:\"Fotografie\";i:5;s:1:\"|\";i:6;s:13:\"ON1 Photo Raw\";i:7;s:1:\"|\";i:8;s:3:\"RAW\";i:9;s:1:\"|\";i:10;s:13:\"RAW Konverter\";} \";s:4:\"sort\";s:11:\"date desc\";s:4:\"user\";s:5:\"guest\";}', 'a:8:{i:0;a:3:{s:5:\"title\";s:50:\"a:1:{s:5:\"de_DE\";s:24:\"Seite wird überarbeitet\";}\";s:9:\"titlelink\";s:24:\"Seite-wird-ueberarbeitet\";s:6:\"weight\";i:1;}i:1;a:3:{s:5:\"title\";s:44:\"a:1:{s:5:\"de_DE\";s:18:\"ON1 Photo RAW 2024\";}\";s:9:\"titlelink\";s:18:\"ON1-Photo-RAW_2024\";s:6:\"weight\";i:8;}i:2;a:3:{s:5:\"title\";s:44:\"a:1:{s:5:\"de_DE\";s:18:\"Experiment Beendet\";}\";s:9:\"titlelink\";s:18:\"Experiment-Beendet\";s:6:\"weight\";i:1;}i:3;a:3:{s:5:\"title\";s:44:\"a:1:{s:5:\"de_DE\";s:18:\"Zurück Zu Windows\";}\";s:9:\"titlelink\";s:18:\"Zurueck-Zu-Windows\";s:6:\"weight\";i:1;}i:4;a:3:{s:5:\"title\";s:47:\"a:1:{s:5:\"de_DE\";s:21:\"Multimendia und Linux\";}\";s:9:\"titlelink\";s:21:\"Multimendia-und-Linux\";s:6:\"weight\";i:1;}i:5;a:3:{s:5:\"title\";s:50:\"a:1:{s:5:\"de_DE\";s:24:\"Update Auf Kubuntu 23.10\";}\";s:9:\"titlelink\";s:24:\"Update-Auf-Kubuntu-23.10\";s:6:\"weight\";i:1;}i:6;a:3:{s:5:\"title\";s:32:\"a:1:{s:5:\"de_DE\";s:7:\"Photils\";}\";s:9:\"titlelink\";s:7:\"Photils\";s:6:\"weight\";i:2;}i:7;a:3:{s:5:\"title\";s:30:\"a:1:{s:5:\"de_DE\";s:5:\"KMail\";}\";s:9:\"titlelink\";s:5:\"KMail\";s:6:\"weight\";i:1;}}', '2024-01-20 23:01:23')) fehlgeschlagen. mysqli gab den Fehler Duplicate entry 'a:5:{s:4:"item";s:4:"news";s:6:"fields";s:4:"tags";s:1:"s";s:197' for key 'zen_search_cache.criteria' zurück in /path_to_zenphoto/zp-core/classes/class-dbmysqli.php in Zeile 83

    trigger_error called from dbMySQLi->query (class-dbmysqli.php [83])

    from SearchEngine->cacheSearch (class-searchengine.php [1968])

    from SearchEngine->getSearchArticles (class-searchengine.php [1918])

    from SearchEngine->getArticles (class-searchengine.php [1850])

    from getRelatedItems (related_items.php [63])

    from printRelatedItems (related_items.php [156])

    from include (news.php [55])

    from include (index.php [128])

    from index.php [79]


    As far as i can see the error is only produced with a logged in user. For non-logged in users everything seems fine.

  • acrylian Administrator, Developer

    The change has nothing to do with the search cache actually. Please clear and/or disable the search cache.

  • Ralf Member

    Ok,
    clearing the search cache solved the problem as far as i can see.

  • acrylian Administrator, Developer
    edited January 21

    Great. Let us know if it happens again.

  • Ralf Member

    Will do - what maked me wonder is that this happend only with an article which has number in the title and title link like "My Article 2024"
    But since the search cache is cleared it did not happened again until now.

Sign In or Register to comment.