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.

 

Change template variation only

Change template variation only

Hola folks,

Right erm dunno if this is possible, but is there a way to set a template variation instead of an entirely different template. I'm using rockettheme and yootheme templates and they add:

&color=black or something similar to the url string to load the variation of the template.

This would be a real time saver for me!

Thanks for your input in advance, i've rinsed MetaMod and now im looking forward to using MetaTemplate on a new site!

I'm using metatemplatepro 1.0 (errk i will upgrade it, promise)

lordbarron
Guest
useravatar
Offline
Administrator has disabled public posting

Re: Change template variation only

Hmmm, if it's just an additional URL parameter that's being added, then that should be possible to add sneakily. I'll look this up during the weekend and see if I can make it work. It's probably just a couple of lines to add in the PHP box in the SUCCEED rule, and should not require a page refresh.

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: Change template variation only

Hi there! Any news on this subject? Because this is really what I need. If this option was added let me know to purchase the Pro version.

Thank you.

pablotll
Beginner Modder
ranks
useravatar
Offline
1 Posts
Administrator has disabled public posting

Re: Change template variation only

Hi pablotll,

Do you know if it's possible to control the variation in the same way as lordbarron's RocketTheme one, in post#1 above? i.e. by adding a URL parameter?

If it's possible to do that on your site at the moment, by adding "&color=black" (etc) to any URL on your site to control the variation, then you can add this into the PHP box in the "Succeed Action":

JRequest::setVar("color", "black", "get", true);

That line tells Joomla to simulate "color=black" in the URL, for "GET" requests.

Now, it's very possible, perhaps likely, that your template doesn't check the URL parameters like that - in which case, that technique won't work.

I just tried working with RocketTheme "Affinity" to see how I could control the variations, and it didn't work that way. However, it was still easy to control the template variation using MetaTemplate (+ Pro).

1 - Look in the template's index.php. If it's anything like RT Affinity, there will be a line like this:

$default_theme = $this->params->get("defaultTheme", "theme1");

That's the line that retrieves the value of the default theme from the parameters.

So after that line, I added the following:

if (defined("MMP_THEME")) $default_theme = MMP_THEME;

This provides the mechanism for changing the default theme, as long as we get MetaTemplate to define the MMP_THEME constant.

2 - edit your MetaTemplate rule:

in the PHP box in the Succeed Action, put the following:

define("MMP_THEME", "theme1");

3 - that's all there is to it. As long as that MetaTemplate rule succeeds, the new theme name will be put into the constant. When the template is being constructed, it checks for the presence of that constant, and if found, this overrides the previous value.


Now, you might wonder what values of "MMP_THEME" are actually allowed. That's going to depend on your template. I found the list of values by examining the normal template edit page in Firebug, and looking at the list of values in the dropdown list. It's also found in the template's templateDetails.xml. For this particular template:

        <param name="presetStyle" type="list" default="style1" label="PRESET_STYLE" description="PRESET_DESC">
            <option value="style1">STYLE1</option>
            <option value="style2">STYLE2</option>
            <option value="style3">STYLE3</option>
            <option value="style4">STYLE4</option>
            <option value="style5">STYLE5</option>
            <option value="style6">STYLE6</option>
        </param>

... so values of "style1" to "style6" are allowable in this case. Note: this is going to be unique to every template, so check your own settings.

If there are other parameters to control, then you can use this technique to control any of them, as long as you can find the place in the template's index.php (or possibly other php files in the template folder) where the parameters are assigned, and then override them as I did above.


Hope that helps,
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: Change template variation only

Also in yootheme, I'm pretty sure the template params are loading in the same way. And as Stephen said the values ie "style2" are different.
YooTheme values are usually like "yt-black" or "red" or "combsred"
Just check their demo site and see the url for each variation for the name.

lordbarron
Guest
useravatar
Offline
Administrator has disabled public posting

Re: Change template variation only

Stephen,

I have a quick follow up question to this post.  You said that you got Chameleon to function against an Affinity preset styles - will it also work against a custom Rocketheme style that is based on a duplicate of the default Rockettheme template style (with Gantry etc) ?

I'm using Momentum, and want to iframe some pages into a Facebook app that requires a narrower styled template.  I'd like to configure Chameleon to select the narrow page style for requests coming from my FB app.

ie
1. use the admin duplicate action to make a copy of the default (Master) Affinity template style
2. rename it to something else, alter the style as needed.
3. configure Chameleon to switch between the master and the duplicate Rockettheme template styles.

you can see the issue if you compare:

http://www.ecoreefs.com/

https://www.facebook.com/EcoReefs/app_231647996930497

Thanks

Michael

ecoreefs
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Change template variation only

Hi Michael,

I just took at look at the Ecoreefs site - that's an amazing product that you're producing!

As to the template issue:

1 - yes, you would need to use the standard Joomla Style duplication to make a new style of the template,
2 - and customise that style for width etc
3 - and use Chameleon to switch between the two.

I've just been looking at a standard Momentum template. I see a possible problem trying to reduce the width. It seems quite hard-coded that the main body is going to be 960px (in css: rt-container), and all the other parts of the grid system rely on this. Yes, you could make overrides for all the CSS, and that's not impossible if you are (or have access to) someone who is great with CSS.

Chameleon can also load in these additional CSS override files at the same time as it loads a new template style.

If you can solve that width issue, then what I would recommend as the easiest way to do the switching is to make a "parked domain" (in cPanel terms) of fb.ecoreefs.com. This means that you get the same content whether you go to fb.ecoreefs.com or www.ecoreefs.com.

Where it helps greatly is that Chameleon can then switch template style based on domain name. You would embed the fb.ecoreefs.com address into Facebook, and use the other main domain as usual for your site.

Doing it this way avoids complications that can occur when you rely on the session to remember which version of the site people are on. Issues can arise when people try to access the raw site outside of Facebook, and the embedded Facebook version at the same time, so using separate domain names basically solves the 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

Re: Change template variation only

Stephen

Perfect - great suggestions.

There is a easy way to change Gantry template widths - file this away for future reference:

http://www.rockettheme.com/forum/index. … =viewtopic

and, for 1.7

http://www.rockettheme.com/forum/index. … 45#p698654

-- basically a quick php patch that reveals a dynamic col width setting in the feature tab of the RocketTheme template config pages for Gantry templates.  Super slick, and really powerful.  You can change Gantry Rockettheme template widths essentially on the fly - remember to clear the system caches to see the change take effect.

Michael

ecoreefs
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Change template variation only

Thanks for the links - I had no idea it was that easy! Looks like this is all going to come together nicely now.

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:
1679
Total Polls:
6
Total Posts:
5913
Dormant:
User Info:
 
Total Users:
10778
Newest User:
negina4qx
Members Online:
0
Guests Online:
165

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