Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Question regarding MetaTemplate

Question regarding MetaTemplate

Hello!

Just installed MetaTemplate on our Joomla to modify the template used depending on browser.

Used the code the guru post on a thread but seems not working first of all, later I add at advanced php funtion just the line

return false;

and at Fail Actions setTemplate 'template2', but it shows always template1, the "default".

My second test was to modify at Available Templates the default template to template2, and it worked like a charm so I get that result:

The Rule is loading correctly, if not, the default template would not be modified.
The Rule is not reading the Advanced part, the coded used:

-----------------
$UA  = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';

$CH  = strstr($UA, 'Chrome/') ? true : false;

$CHV = $CH ? preg_match('#Chrome/([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)#',$UA, $matches) : false;

$CHV = $CHV ? $matches[1] : false;

$IPD = strstr($UA, 'iPad;') ? true : false;

$IP  = strstr($UA, 'iPhone') ? true : false;

$SF  = !$CH && strstr($UA, 'Safari') ? true : false;

$OP  = strstr($UA, 'Opera') ? true : false;

$OPV = $OP ? preg_split('/opera\//i', $UA) : false;

$OPV = $OPV ? floatval($OPV[1]) : false;

$FF  = strstr($UA, 'Firefox') ? true : false;

$FFV = $FF ? preg_split('/firefox\//i', $UA) : false;

$FFV = $FFV ? floatval($FFV[1]) : false;

$IE  = strstr($UA, 'MSIE') ? true : false;

$IEV = $IE ? preg_split('/msie/i', $UA) : false;

$IEV = $IEV ? floatval($IEV[1]) : false;



// customise the template names as appropriate for your site

if ($IE and $IEV >= 7) return false; // any version of IE greater or equal to 7

if ($IE and $IEV >= 6) return false; // any version of IE greater or equal to 6

if ($IE) return false; // any version (at all) of IE

--------------

Also returned instead of false the template to load, also typed just a line with 'return false;' but didnt work at all.

There is any solution ?

Thanks you in advance!

rboza
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Question regarding MetaTemplate

Hi rboza,

First of all, we need to find out why a simple "return false;" in the PHP box is not using the template that you set in the "FAIL Action". You did the right test! This is supposed to work.

Can you check a couple of things:
1 - are you using any kind of SEF extension? e.g. sh404SEF or something similar? If so, the order of the system plugins matters. You need to ensure that the sh404sef system plugin occurs before the MetaTemplate system plugin.
2 - is the MetaTemplate plugin actually turned on? It should install itself already turned on, but perhaps it got turned off at some point.

If you like I'd be happy to log in to your site and check these things and do some other tests. If you want me to do this, please just send me some login details in a Private Message, or via the Contact page.

Lastly, instead of using all that PHP code, you can reduce this a lot by using JomGenius. This has the builtin ability to detect various versions of IE, like this:

if ( $core_genius->check("browsertype = ie") ) return false;

You can also detect particular versions. See http://www.metamodpro.com/jomgenius/par … dcheckcore for full details. But of course this will only work once the rules themselves are working... let's try to get those working first.

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Re: Question regarding MetaTemplate

Hello!

Unfortunatelly our development is on private network and I cannot give you access to log in sad

So I will try to show you exactly how it is structured.

On Plugin window, it is shown as follows:
http://img24.imageshack.us/img24/8803/metatemplate1.jpg

And the only Rule I have is the following:
http://img249.imageshack.us/img249/8636/metatemplate2.jpg

So, always GIS-INTERIOR is shown, never the one with -00

So many thanks for your time smile

rboza
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Question regarding MetaTemplate

hello Again!

Good news smile, it works properly now, very good plugin wink

Where is my error, so if anyone get caught in the same situation, as a developer when something does not work as expected, before trying metaTemplate, I modified joomla core code, in concret, application.php and I forgot it, headless man!

I restored the code from application.php and it works like a charm big_smile, so many thanks you wink

rboza
Beginner Modder
ranks
useravatar
Offline
3 Posts
Administrator has disabled public posting

Re: Question regarding MetaTemplate

Oh, that's good to hear! Thanks for reporting back - it was a very confusing problem!

Best regards,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3313 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5910
Total Posts Today:
1
User Info:
 
Total Users:
10152
Newest User:
kasautiizindagiikay
Members Online:
0
Guests Online:
341

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