
Zhris
Enthusiast
Aug 14, 2014, 12:09 PM
Post #2 of 4
(93220 views)
|
Re: [ndhaundiyal] Extra desktop/mobile selector is appearing while browsing
[In reply to]
|
Can't Post
|
|
One way could be to put a condition around the splice.
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:
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)
|