ZenphotoCMS Forum
Add variable to rewrite_path function - 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: Add variable to rewrite_path function (/thread-8952.html)



Add variable to rewrite_path function - mjahkoh - 2011-08-09

I want to add a variable to the following($eid). Problem is that rewrite_path adds it as the last item. so it will not show the images(image context). whats the workaround.

This: rewrite_path("/" . pathurlencode($albumname) . "/", "/index.php?album=" . urlencode($albumname)."&id=$eid");

Results to : http://localhost/Zenphoto/index.php?album=poly-parent%2Fsubalbum-ya-poli&image=262.jpg&eid=86

when i exchange the &eid=86, it works.




Add variable to rewrite_path function - acrylian - 2011-08-09

It would easier to help if you tell what you are trying to do why actually.

Anway, you nede to do it differently for both url types:

  • nonmodrewrite: &eid=123
  • modrewrite: ?eid=123



Add variable to rewrite_path function - mjahkoh - 2011-08-10

All albums in my gallery are hosted in 'parents albums' which are numerical. consequently i need to pass the parent album as url variable to display images and albums correctly.

For example: rewrite_path("/" . pathurlencode($albumname) . "/", "/index.php?album=" . urlencode($albumname)."&id=90");

Results in: http://localhost/Zenphoto/index.php?album=poly-parent%2Fsubalbum-ya-poli&image=262.jpg&eid=90

Required output: http://localhost/Zenphoto/index.php?album=poly-parent%2Fsubalbum-ya-poli&eid=90&image=262.jpg

That is my variables should come before 262.jpg to display images correctly. They dont

Regards all
Jackson




Add variable to rewrite_path function - acrylian - 2011-08-10

I admin I don't understand what you are doing. New parameters are appended, if you want a different order (which may confuse modrewrite btw) you need to create your own custom functins.

Why do you need to pass the parent's album via the url at all when you can get it easily via the object model?




Add variable to rewrite_path function - sbillard - 2011-08-10

Just so you are clear about something.

Query parameters (what you are trying to set with the "&eid=xxx" must always follow the url, so indeed they go at the end of the url when mod_rewrite is in effect.

If mod_rewrite is not set it makes absolutely no difference what order the query parameters are in--infact, unless you analize the $_SERVER array you will not even know the order.

So just exactly why is this a problem for you? Anyway, if it is a problem you just have to manually create the url. Or use acrylian's suggestion and retrieve the id from the object model and don't pass it at all.