Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Front end template switch
Front end template switch
Front end template switch
Hi,
I'm using this excellent component to switch users to a mobile version. However, I'd like to be able to give users the option to view the desktop version on the homepage. I've checked the FAQ and I'm not sure how to incorporate the GET, POST, COOKIE into a button/link that does this. Any ideas?
Cheers
Darren
Re: Front end template switch
Hi Darren,
Yes, with Chameleon and MetaMod you can do a good job of hiding and showing stuff for mobile, and allowing people to override the default setting. Briefly, the rules in Chameleon would be:
1 - detect specific URL parameter e.g. "…&setmobile=0". If found, set session variable "A" and continue to next rule. This rule allows you to force the mobile template to NOT be used if the user clicks on a link that has that parameter in it. So session variable A means "don't use mobile template even if user is on mobile".
2 - detect specific URL parameter e.g. "…&setmobile=1". If found, reset session variable "A" and continue to next rule. This rule allows mobile users who have already overridden the template (so are seeing the desktop template) to return to the mobile template.
3 - detect session variable "A". If found, set the mobile template and quit processing rules.
4 - detect mobile device. If found, set the mobile template.
Then the challenge is to provide URLs on your site that point to the right pages with the right URL parameters. For a start, you can use MetaMod to place these in a module that's only going to display when a mobile device is detected. But the problem is making a link that goes back to the same page that you are already on, with the new part of the URL appended. Of course, it's no problem just to send people back to a fixed page (e.g. front page) e.g. http://www.example.com/?setmobile=0 and that would probably be ok for most people.
I've had a few thoughts about how best to get around this, e.g. making a system plugin that does a search & replace for {thispageurl} and replaces it with the appropriate with the appropriate URL, so you can more easily link back to the same page you are on. Even that idea is not quite ideal because you'd also want to remove any pre-existing "setmobile=x" terms from the URL before constructing the new one. But you see the predicament. The ideal would be to actually write a specific module for handling this. Actually it could be coded in "echo" statements from inside MetaMod but most people won't want to code that…
Anyway, hope that helps,
Cheers,
Stephen
- Index
- » MetaMod
- » MetaMod General Support
- » Front end template switch
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8026
- Newest User:
- rivas48750
- Members Online:
- 0
- Guests Online:
- 193
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked