Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.



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


Randomized Template by own variable.

Randomized Template by own variable.

Hey out there. I'm trie to get this Thing working:
I Have 10 Difrent Templates witch should be randomized chaged. So I Setted up this small script below, but it wasn't working.
What I'm doing wrong?

$zufall = mt_rand(1,10);
if ( $zufall == 1 )
    return "Walkerbau1_1";
if ( $zufall == 2 )
    return "Walkerbau1_2";
if ( $zufall == 3 )
    return "Walkerbau1_3";
if ( $zufall == 4 )
    return "Walkerbau1_4";
if ( $zufall == 5 )
    return "Walkerbau1_5";
if ( $zufall == 6 )
    return "Walkerbau1_6";
if ( $zufall == 7 )
    return "Walkerbau1_7";
if ( $zufall == 8 )
    return "Walkerbau1_8";
if ( $zufall == 9 )
    return "Walkerbau1_9";
if ( $zufall == 10 )
    return "Walkerbau1_10";

Beginner Modder
1 Posts
Administrator has disabled public posting

Re: Randomized Template by own variable.

Hi kochlehrling,

at first glance I'd say that the code looks fine.

The main issue is sometimes with the capitalisation of the template names.

I'd suggest starting off by using the following rule (just this 1 single line) to see if you can get the entire site to use the new template:

    return "Walkerbau1_1";

As long as the rule is enabled, and no other form controls have been changed in the rule, then this should change your entire site to the Walkerbau1_1 template.

If it doesn't, try with a lower-case "w". I think from memory that this name has to match the name of the folder that the template is sitting in, not the name of the template in the XML file, if this is different.
The list of template names on the right hand side of the MetaTemplate rule editor should indicate the name of the folder, if it's different from the display name of the template.

Also, are you able to set Walkerbau1_1 as the default template using the normal Joomla mechanism, and does that work properly?

Hope that helps,
please write back if you continue to have problems with it,

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

3330 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
Total Topics:
Total Polls:
Total Posts:
Total Posts Today:
User Info:
Total Users:
Newest User:
Members Online:
Guests Online:

There are no members online

Forum Legend:

 New Sticky