WebsiteBaker Support (2.8.x) > Templates, Menus & Design

I need the template switcher code

<< < (7/7)

Ruud:
I had the impression it would be clear now.
Create a small form somewhere in your template (where you want it to show up) that creates the links to another template.

--- Code: (Untested example) ---<form name="myform" method="get" action="">
  <select name="template" onchange="javascript: document.myform.submit();">
    <option value="round">The nice Round template</option>
    <option value="allcss">Only using CSS</option>
    <option value="someother">Some other template</option>
  </select>
</form>

--- End code ---
Replace the option values by your installed template directory names.

ufferichter:
Hi Ruud

Yes its working, but have to install the form on every theme you wanna to show, i cant understand there not a a modul there is working all over.

But Ruud, i got a problem now, i was not thinking, so i choose the theme argos_theme, and now my site is gone, i have tryed to find the cookie but no luck, and remove my my old ie temp file, do you have a solution..

Ruud:
Adding it to each template is one option. The discussion earlier in this tread was to put it in your main index.php.
The problem there is that you cannot tell where the dropdownlist will show up in the selected template.
Since the template switcher is a modification in the core files it makes no sense to create a module for it. The module would not function without modifying the core files.

The theme is stored in a session, so if you close your browser (all instances) and retry with a new browserwindow it should show your original template again.

ufferichter:
Hi Ruud

Yes i understand, but i must say, its not the prober solution for me, and if its not possible to make a modul for that, i must say, its a petty...

But thanks for helping me...

Boudi:
Easiest way is:

create some templates (eg: yellow, red)
create some homepages (eg: home_yellow, home_red)
link every homepage to it's own template
Place in every index.php from each template a pulldownmenu like:

HEAD:

--- Code: ---<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--

function openURI() {
var control = document.name.templates;
if (control.options[control.selectedIndex].value != '') {
location.href = control.options[control.selectedIndex].value;
}
}

//-->
</SCRIPT>
--- End code ---

BODY:

--- Code: ---<FORM ACTION="" NAME="name">
<SELECT NAME="templates" onchange="openURI()">
<OPTION VALUE="home_yellow.php" selected="selected">Template 1</OPTION>
<OPTION VALUE="home_red.php">Template 2</OPTION>
</SELECT>
</FORM>
--- End code ---

Don't forget to change the SELECTED into the template that is show at that moment.

Navigation

[0] Message Index

[*] Previous page

Go to full version