Author Topic: I need the template switcher code  (Read 20284 times)

Offline Ruud

  • Posts: 3669
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: I need the template switcher code
« Reply #25 on: February 13, 2011, 11:13:02 PM »
That block does not do the switching, it is just a list that will use the function I pointed yo you.

The list will not work properly in WB2.8.x because now there are also backend themes.
The list could created manually just like any other form that uses a select (method GET).

First start with the code for the index.php. Try to see if it works by typing on the addressbar website.com?template=round.
If that works, you could think of the next step..

Offline ufferichter

  • Posts: 36
  • Gender: Male
    • websitebaker.dk
Re: I need the template switcher code
« Reply #26 on: February 15, 2011, 03:45:39 PM »
If it so, that the list will not work properly in WB2.8.x, i think this is a petty, i will hope that will be possible to make a solution with dropdown box, every cms have it.

If any can make a template switcher in a dropdownbox, that will be great
Regards Uffe

WebsiteBaker.dk

Offline Ruud

  • Posts: 3669
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: I need the template switcher code
« Reply #27 on: February 15, 2011, 03:53:45 PM »
You can just create the dropdown manually..

I do not assume you add many templates on a regular basis.. So the list using the templates you want to offer to the visitors should not have to be "generated".

Offline ufferichter

  • Posts: 36
  • Gender: Male
    • websitebaker.dk
Re: I need the template switcher code
« Reply #28 on: February 16, 2011, 08:19:46 PM »
Hi Ruud

Ok i try to listen after now!

I incert the chances in index.php on my testsite, and try to call this url http://testzone.uffe.it/?template=round and the template was chance allright.,., please note that not the official site og WebsiteBaker in Denmark, but only where i am testing!

What i am doing next to make a dropdown manualy.
Regards Uffe

WebsiteBaker.dk

Offline ufferichter

  • Posts: 36
  • Gender: Male
    • websitebaker.dk
Re: I need the template switcher code
« Reply #29 on: February 20, 2011, 10:49:45 PM »
Ruud, are you still with me?
Regards Uffe

WebsiteBaker.dk

Offline Ruud

  • Posts: 3669
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: I need the template switcher code
« Reply #30 on: February 21, 2011, 10:26:17 PM »
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) [Select]
<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>
Replace the option values by your installed template directory names.

Offline ufferichter

  • Posts: 36
  • Gender: Male
    • websitebaker.dk
Re: I need the template switcher code
« Reply #31 on: February 22, 2011, 12:43:44 AM »
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..
Regards Uffe

WebsiteBaker.dk

Offline Ruud

  • Posts: 3669
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: I need the template switcher code
« Reply #32 on: February 22, 2011, 10:16:12 AM »
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.

Offline ufferichter

  • Posts: 36
  • Gender: Male
    • websitebaker.dk
Re: I need the template switcher code
« Reply #33 on: February 25, 2011, 02:12:17 AM »
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...
Regards Uffe

WebsiteBaker.dk

Offline Boudi

  • Posts: 1190
  • Gender: Male
  • //o_-\\
    • Yze Webdesign
Re: I need the template switcher code
« Reply #34 on: September 07, 2011, 02:40:20 PM »
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: [Select]
<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>

BODY:
Code: [Select]
<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>

Don't forget to change the SELECTED into the template that is show at that moment.
« Last Edit: September 08, 2011, 10:33:01 PM by Boudi »
...:: Bake the Unbakable ::...

 

postern-length