Add variable to rewrite_path function

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/subalbum-ya-poli&image=262.jpg&eid=86

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

Comments

  • acrylian Administrator, Developer
    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
  • 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/subalbum-ya-poli&image=262.jpg&eid=90

    Required output: http://localhost/Zenphoto/index.php?album=poly-parent/subalbum-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
  • acrylian Administrator, Developer
    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?
  • 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.
Sign In or Register to comment.