![]() |
|
Url rewriting - removing parameter from image.php pages - 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: Url rewriting - removing parameter from image.php pages (/thread-12451.html) |
Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 Hi, I don't know how to code a working rule to rewrite an url for the images pages of my gallery. For some reason, I had to pass a parameter in the url of my images, so I have an url of this form : /portfolio/album/subalbum/image.jpg?limit=12 I would like to rewrite this url without the parameter ?limit=12 : /portfolio/album/subalbum/image.jpg I've tried some urlrewriting rules in the .htaccess I've found at the root of my portfolio directory, but with no success... If someone have an idea? Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 Most rewriting is done internally. Even if you rewrite the parameter it still must be there as otherwise the url does not match it. For example the image url of Zenphoto is you would have to add something like Btw. we strongely recommend to use the rewrite suffix so you have urls like Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 Thank you Acrylian, This parameter is the way I used to limit the number of my images in my last images album (I've already posted something on the forum about a year ago about it and you greatly helped me ). Now I will try to pass this parameter into a session variable. I've another parameter to pass to get something different : I'm adaptating my gallery to mobile device. In that way, I've made a differenciation between mobile and desktop use of my gallery :
Thank you again for your help Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 If you like to do different things on desktop/mobile you could for example have two different links and hide one on certain media query breakpoints. Alternatively if you need to do things servers side via PHP you could use hte mobileTheme plugin. The name is a bit misleading as you don't need to define a separate mobile theme at all. It also includes a framework named mobile_dectect you can use on your theme directly: http://mobiledetect.net There is also a filter hook to link generation that should be listed on our plugin tutorial. But maybe above ways are easier, at least to try first. Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 Thank you acrylian. I already use mobile_detect. It's fine I'm back after some trying with session variable. If I do the same thing with a session variable, only the last variable will be stored (ie if my album has 12 images, the session variable will be 12 for each image of the album), wich is logic as the variable is updated for each iteration of the loop... Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 Pardon me that I maybe not fully understand what you are trying Maybe the session is then not the right way. I thought you use the limit to jump back to a specific image id? Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 In fact, the limit parameter allow me to stop navigation (by hiding the navigation tools) when the visitor reach the 12th image of the last image album Maybe can I find something by storing an array in a session variable... I'll try to find. Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 So basically you just want to hide the page nav on mobile if you have more than 12 images? Then you could just use Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 I thought about using getNumImages, but it does not really do what I want. It gives me the total number of images. Is there something else to find a unique ID (instead of the name of the image file) for each image, such as a number that would be displayed in the order of the images inside the album? Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 Such an id does exist: There is Also http://www.zenphoto.org/news/zenphotos-global-variables Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 imageNumber() !!! Acrylian, you're my hero . (and I know, I should have searched more in that direction...) Thank you, it solves all my problems. No use of these dirty parameters in url now! Thank you again for your great work. ZenPhoto is GREAT! Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 Glad I could help ;-) Quote:Now I'll work on the url rewriting to obtain the .html at the end of my images urls. Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 Well, done for the html. Perfect. Just a last question about url rewriting. /portfolio/album/subalbum/#ID14 where ID14 is the name of my anchor where my link back point to. Can I remove it with url rewriting? Promise, that was my last question Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 No, because that #id in the urltells the browser to scroll to specific element with that "id" on loading the page. If you remove that it will not work anymore. Without you would have to use JS/jQuery to scroll to a specific element. But then you have the problem to know what that is since you have to transfer that info it somehow. Url rewriting - removing parameter from image.php pages - XavierJ - 17-02-2016 Thanks. That is what I was thinking. But I think JS would be heavier than this little code, so I think I will conserve it like that. Thanks again for all Acrylian. Url rewriting - removing parameter from image.php pages - acrylian - 17-02-2016 To scroll would probably be only a few lines jQuery. jQuery itself is loaded already anyway. |