ZenphotoCMS Forum
rewrite token for gallery page url - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: rewrite token for gallery page url (/thread-13030.html)

Pages: 1 2


rewrite token for gallery page url - acrylian - 19-10-2017

You need a plugin that also hooks on the getLink filter and then modify the url before returning it to match the rewritten one.

zp_register_filter('getLink', 'modify_url'); function modify_url($link, $page) { if($page == "index.php") { // $link the is the url you need to modify to your rewrittten one } return $link; }

Very quick example offhand, not tested.




rewrite token for gallery page url - sbillard - 19-10-2017

There are two problems (bugs) that need to be fixed. First, the template-functions.php function getPageNumURL() needs to be fixed to handle custom pages:

$pg = stripSuffix($_zp_gallery_page); if (array_key_exists($pg, $_zp_conf_vars['special_pages'])) { $pagination1 = preg_replace('~^_PAGE_/~', _PAGE_ . '/', $_zp_conf_vars['special_pages'][$pg]['rewrite']) . '/'; } else { $pagination1 = '/' . _PAGE_ . '/' . $pg . '/'; }

Then the galleryToken plugin needs to have added a rewrite rule for handling the page numbers:

$_zp_conf_vars['special_pages'][] = array('define' => false, 'rewrite' => '%GALLERY_PAGE%/([0-9]+)', 'rule' => '^%REWRITE%/*$ index.php?p=gallery&page=$1' . ' [L,QSA]');




rewrite token for gallery page url - acrylian - 19-10-2017

Thanks for this actual contribution. Will look into that as soon as I get the time.




rewrite token for gallery page url - acrylian - 19-10-2017

@vincent3569 I have decided I will add this to core tomorrow.




rewrite token for gallery page url - vincent3569 - 23-10-2017

thanks Malte and Stephen!
I made a pull request to fix a typo on the new getCustomGalleryIndexPage() function.

with that, it works fine for my needs.




rewrite token for gallery page url - mikapi - 27-02-2018

I do not see a "PAGE/gallery" value in admin>options>extensions>rewriteToken.

Is it the right place to set the gallery url ?
I use Zenphoto 1.4.14




rewrite token for gallery page url - acrylian - 27-02-2018

The change discussed is not in 1.4.14 but in the coming version 1.5. You can preview that as the support build (or master) from Github.




rewrite token for gallery page url - mikapi - 28-02-2018

That's that, I just understand that the master branch is the one with the last commits. I have tested it, it's ok.

The zip linked on the homepage is Zenphoto 1.4.14 Jan 28, 2017, and the new function since october 2017, so I mistakenly thought it was included.




rewrite token for gallery page url - acrylian - 28-02-2018

We only will change the numer when we actually release it. Until then we keep the old version. Remember to re-run setup in case it doesn't request to run automatically.