CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: mod_perl: Re: [ndhaundiyal] Extra desktop/mobile selector is appearing while browsing: Edit Log



Zhris
Enthusiast

Aug 14, 2014, 12:09 PM


Views: 94941
Re: [ndhaundiyal] Extra desktop/mobile selector is appearing while browsing

One way could be to put a condition around the splice.


Code
splice @uri_elements, 1, 0, $model_group unless @uri_elements[1] eq $model_group;


This ensures the splice isn't performed if the second uri element is equal to the model group. A regexp may be more suitable if you need to check against multiple model groups:


Code
splice @uri_elements, 1, 0, $model_group unless @uri_elements[1] =~ /^(mobile|desktop)$/;


Lastly, the condition could be better positioned in your code, but I didn't want to hinder the rejoining of the uri elements / updating the uri, inevitably I am uncertain of your intentions beyond this specific problem.

Chris


(This post was edited by Zhris on Aug 14, 2014, 12:23 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Aug 14, 2014, 12:19 PM
Post edited by Zhris (Enthusiast) on Aug 14, 2014, 12:20 PM
Post edited by Zhris (Enthusiast) on Aug 14, 2014, 12:22 PM
Post edited by Zhris (Enthusiast) on Aug 14, 2014, 12:23 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives