Page 1 of 1
how do I put a template chooser on my site?
Posted: Sat Aug 19, 2006 9:10 pm
by zeroality
I want to set up a template chooser. I tried a search for topics and modules on this and I could only find a stylesheet chooser, not a template chooser.
I want to set up separate templates so that I can design different layouts for the user to choose from. Anybody know how to do this?
I am running CMSMS 0.13.
Re: how do I put a template chooser on my site?
Posted: Sun Aug 20, 2006 3:10 am
by Dr.CSS
You will have to go to Dynamic Drive .com to find a JS script to use, not tested it but would like one myself.
I couldn't figure out how to change stylesheet switcher in to template switcher.
Re: how do I put a template chooser on my site?
Posted: Sun Aug 20, 2006 3:36 am
by zeroality
Looks like the CMSMS community has another module that needs to be developed.
I'll check around for a script. Thanks.
Re: how do I put a template chooser on my site?
Posted: Sun Aug 20, 2006 4:21 am
by Elijah Lofgren
zeroality wrote:
I want to set up a template chooser. I tried a search for topics and modules on this and I could only find a stylesheet chooser, not a template chooser.
I want to set up separate templates so that I can design different layouts for the user to choose from. Anybody know how to do this?
I am running CMSMS 0.13.
To be able to choose the template id via a URL variable you could:
1. Open index.php and find this line:
Code: Select all
$pageinfo = PageInfoOperations::LoadPageInfoByContentAlias($page);
2. After it put:
Code: Select all
if (FALSE == empty($_GET['template_id']))
{
$pageinfo->template_id = $_GET['template_id'];
}
3. Then make a template chooser that adds ?template_id=15 to the URL (replace 15 with the id of the template your want used)
Should get you started.
Hope this help,
Elijah
Re: how do I put a template chooser on my site?
Posted: Sun Aug 20, 2006 5:13 am
by Dr.CSS
So I could use this in my index.php on line 183 and it wont mess it up?
And then find the stylesheet call in stylesheet switcher and replace it with ?template_id=, wonder if there is some way to get it pointed at the template db like it does for CSS to put in it's drop down?
hhmmmm....
Re: how do I put a template chooser on my site?
Posted: Sun Aug 20, 2006 1:11 pm
by zeroality
I'm not a PHP guru but I am definitely interested in this. Could someone finish the code above and tell us dummies how it's done?

Re: how do I put a template chooser on my site?
Posted: Tue Aug 22, 2006 9:02 pm
by zeroality
Well, I suppose this is how threads go at CMSMS. Somebody gets you excited about something but doesn't follow up.
Edit: I don't mean to sound bitchy. "Oh, he didn't get his problem solved so now he's whining." No, this isn't just "my" problem. I can only imagine how many people using CMSMS would love a template switcher so I don't understand why someone can't take time to help probably 25% of the CMSMS customer base. =\
Re: how do I put a template chooser on my site?
Posted: Sun Sep 09, 2007 11:59 pm
by calguy1000
Are you talkking 'stylseheet switching', or 'template switching'.
TemplateManager as of now allows you to specify prefererred, and alternate stylesheets....
Template manager would infer allowing users to specify completely different layouts for their pages.
CMS Doesn't support this at this time.
You couold have different numbers of content blocks on each template? what if one or more weren't fillde out?
Re: how do I put a template chooser on my site?
Posted: Mon Sep 10, 2007 2:17 pm
by streever
Your attitude toward Elijah and the rest of the community is upsetting. No one is obligated to help you.
My answer would have been:
simply use divs appropriately. Then, use the stylesheet switcher.
Think I'm crazy?
csszengarden.com
The whole point is that STRUCTURE (html) should be the same. CSS is where you change things.
Personally, I'm trying to come up with one layout that will work for every site I do. Then I have my css files, and just modify one of them.
Re: how do I put a template chooser on my site?
Posted: Thu Sep 27, 2007 8:27 am
by Johann
My answer would have been:
simply use divs appropriately. Then, use the stylesheet switcher.
I agree with streever, an I use this technique myself; your site must be valid, and must use css for layout (well, at least thats my point of view).
But there is a drawback on the styleswitcher: lets say, you want to deliver a different DOCTYPE (e.g. XHTML Basic for handheld users). Or you need to send a different IE-Stylesheet, enclosed in a conditional comment. Or you want to use different JavaScript (for instant, if you use JS to compansate IE incapabilities).
For that a templateswitcher would be quite usefull.