Different default home page for mobile

Advanced and professional portal news Joomla template with community features and various content display layouts.
GK User
Mon Sep 16, 2013 2:16 am
I have created a separate menu for mobile versions of my site.

I have a category called latest, which shows my most recent articles.

I would like this to be the default home page, only for the mobile version.

If I make this the default page in the mobile menu it applies to my main site too.

Is there a way to easily create a different home page for mobile, based on an item in the mobile menu?
User avatar
Fresh Boarder

teitbite
Mon Sep 16, 2013 5:16 am
Hi

I'm afraid joomla allows just one default menu element, so the only option is to make this one page look differently for desktop and mobile. You can use modules to show the content and than module class suffix like " nomobile" or " mobileonly" to hide or show this modules on desired layout.
User avatar
Moderator

GK User
Mon Sep 16, 2013 5:22 am
Or is there a way to change a file to send the mobile redirect to a specific menu item? In my case, to http://phildobbie.com/main/latest
User avatar
Fresh Boarder

teitbite
Tue Sep 17, 2013 3:44 am
Hi

Brilliant idea :)

Add this code to /layout/iphone.php and /layout/handheld.php

Code: Select all
if(JRequest::getVar(Itemid) = 'ID_OF_HOME'):
    header('Location: http://www.redirection.com/');
    exit;
endif;
User avatar
Moderator

GK User
Tue Sep 17, 2013 4:31 am
Where in the file - within the body?


I seem to get errors wherever I put it.
User avatar
Fresh Boarder

teitbite
Wed Sep 18, 2013 4:20 am
Hi

Before any HTML starts. Try right before:

Code: Select all
// No direct access.
defined('_JEXEC') or die;
User avatar
Moderator

GK User
Wed Sep 18, 2013 4:41 am
Sorry for being slow, what do substitute for 'ID-OF-HOME')

This is what I used:
if(JRequest::getVar(Itemid) = 'ID_OF_HOME'):
header('Location: http://www.phildobbie.com/main/latest');
exit;
endif;

and I get Fatal Error - can't use function return value in write context
User avatar
Fresh Boarder

teitbite
Thu Sep 19, 2013 4:50 am
Hi

'ID-OF-HOME' means that You should put an ID of a home element. But I've just noticed one mistake. Please use this fixed version of this code:

Code: Select all
if(JRequest::getVar(Itemid) == 'ID_OF_HOME'):
header('Location: http://www.phildobbie.com/main/latest');
exit;
endif;
User avatar
Moderator


cron