The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Apr 30, 2012 6:44 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu May 21, 2009 3:12 am
Posts: 179
I have a script in my template to show different stylesheet to mobile devices but I want to entirely switch the default template to one specifically created for mobile phones.

Here is what I have tried in my default template. Note that this is just my idea of what I want to achieve
<?php defined( '_JEXEC' ) or die ( 'Restricted access' );
$template =& JFactory::getTemplate();

include_once './templates/devices.php';
$browser = new Browser();
if( $browser->getBrowser() == Browser::BROWSER_IPHONE) {
$template = ('mobile');
} else {
show joomla default template for desktop
}

It seems the detection really should be done in index2.php but that only caused errors. Please suggest options.


Top
 Profile  
 
PostPosted: Fri May 04, 2012 7:59 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu May 21, 2009 3:12 am
Posts: 179
I tried redirection and it does return the template but it is stuck on the home page, naturally because it keeps see the same command. How can I do this correctly? Do I need to use a cookie?

include_once './templates/devices.php';
$browser = new Browser();
if( $browser->getBrowser() == Browser::BROWSER_IPHONE) {
header(location:index.php?template=mobile)
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group