Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 05:44:15 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Theme switcher  (Read 4480 times)
aktiv

Offline Offline

Posts: 6


« on: September 23, 2007, 02:02:00 PM »

Hi,

I`m Looking for a theme switcher on users frontpage.

Does anyone know if this modul is existing for websitebaker?

Thanks

Franz
Logged
Waldschwein
Guest
« Reply #1 on: September 23, 2007, 03:44:00 PM »

Hello!

Yes, the forum search knows it. Wink Or look here, or here or here.

Regards Michael
Logged
aktiv

Offline Offline

Posts: 6


« Reply #2 on: September 23, 2007, 06:16:45 PM »

Thanks a lot. Got a solution.

Franz
Logged
aktiv

Offline Offline

Posts: 6


« Reply #3 on: September 23, 2007, 06:50:16 PM »

Hello!

Yes, the forum search knows it. Wink Or look here, or here or here.

Regards Michael


Does anyone know how to use cookies to keep chosen template when clicking some links?
Got this solution so far:
http://multitimes.com/websitekit/


Thanks

Franz


Logged
aktiv

Offline Offline

Posts: 6


« Reply #4 on: September 24, 2007, 07:03:45 AM »

Ok, finally everything works the way i wanted. For those who want a Theme Switcher as well here what i did.
First example: http://multitimes.com/websitekit/

Add this code in red to  index.php file (root)

// Figure out which page to display
// Stop processing if intro page was shown
$wb->page_select() or die();

// get the template to display from URL
if ($_GET['template']!="") {
   if(file_exists(WB_PATH.'/templates/'.$_GET['template'].'/index.php')) {
      define('TEMPLATE',$_GET['template']);
      $_SESSION['TEMPLATE']=TEMPLATE;
    }
}

// get the template to display from Session Variable
else {
    if(isset($_SESSION['TEMPLATE']) AND $_SESSION['TEMPLATE'] != '')
        define('TEMPLATE',$_SESSION['TEMPLATE']);


Create a WB page (i.e. Home) and add this code on top. (change urls)

<script>
var vers = navigator.appVersio n;
var name = navigator.appName;
vers_ie = vers.substring(22,23);
vers_nc = vers.substring(0,1);
if ((name == "Microsoft Internet Explorer" && vers_ie == 5) || (name == "Netscape" && vers_nc == 5)){
function auswahl(link) {
 if(link == "leer") {
   document.forms[0].reset();
  document.forms[0].elements[0].blur();
   return;
 }else {
   location.href = link;
   document.forms[0].reset();
   document.forms[0].elements[0].blur();
  }
 }
}
</script>

<form action="">
                                      <div align="center">
                                        <select size=1 name="Auswahl" onChange="auswahl(this.form.Auswahl.o ptions[this.form.Auswahl.options.selectedIndex].value)" style="width:300px; background-color:#FFFFFF; font-size:16; font-weight:normal; font-family:verdana; Color:#003399;" width="300" class="countriesform">
                                        <option value="" selected>Choose a Theme</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=allcss" >All CSS</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=round" >Round</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=1024px" >1024 PX</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=blueleaves" >Blue Leaves</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=dvize-gray" >Dvize Gray</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=greenery" >Greenery</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=internetcorporation" >internetcorporation</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=Roundx" >Roundx</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=simple" >Simple</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=templeron" >Templeron</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=uccellini" >Uccellini</option>
                                        <option value="http://multitimes.com/websitekit/pages/home.php?template=zakbluecream2" >Zakbluecream2</option>

       
                        </select>
                                      </div>
                                    </form>



Logged
Vincent

Offline Offline

Posts: 360


WWW
« Reply #5 on: September 28, 2007, 08:02:42 AM »

Franz, this is awsome! I tried hard to solve the same matter, and didn't get near the solution you just provided.
Thanks.

Vincent
Logged
aktiv

Offline Offline

Posts: 6


« Reply #6 on: September 28, 2007, 08:17:05 AM »

Franz, this is awsome! I tried hard to solve the same matter, and didn't get near the solution you just provided.
Thanks.

Vincent

Great, makes me happy that i could help you!!

Franz
Logged
wwwMARKLEYcouk

Offline Offline

Posts: 288


WWW
« Reply #7 on: September 28, 2007, 09:11:22 AM »

dont know what i've done wrong but i get an error
Code:
Parse error: syntax error, unexpected $end in /home/markley/public_html/play/index.php on line 72
ive added the code in the places that you suggested so whats going on?
Logged

aktiv

Offline Offline

Posts: 6


« Reply #8 on: September 28, 2007, 09:21:01 AM »

Here the whole code of my index file:


<?php

// $Id: index.php 399 2006-12-24 07:50:44Z Ruebenwurzel $

/*

 WebsiteBaker Project <http://www.websitebaker.org/>
 Copyright (C) 2004-2007, Ryan Djurovich

 WebsiteBaker is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 WebsiteBaker is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with websitebaker; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

$starttime = array_sum(explode(" ",microtime()));

// Include config file
require_once(dirname(__FILE__).'/config.php');

// Check if the config file has been set-up
if(!defined('WB_PATH')) {
    header("Location: install/index.php");
    exit(0);
}

require_once(WB_PATH.'/framework/class.frontend.php');
// Create new frontend object
$wb = new frontend();

// Figure out which page to display
// Stop processing if intro page was shown
$wb->page_select() or die();

// Figure out which page to display
// Stop processing if intro page was shown
$wb->page_select() or die();

// get the template to display from URL
if ($_GET['template']!="") {
   if(file_exists(WB_PATH.'/templates/'.$_GET['template'].'/index.php')) {
      define('TEMPLATE',$_GET['template']);
      $_SESSION['TEMPLATE']=TEMPLATE;
    }
}

// get the template to display from Session Variable
else {
    if(isset($_SESSION['TEMPLATE']) AND $_SESSION['TEMPLATE'] != '')
        define('TEMPLATE',$_SESSION['TEMPLATE']);
}

// Collect info about the currently viewed page
// and check permissions
$wb->get_page_details();


// Collect info about the currently viewed page
// and check permissions
$wb->get_page_details();

// Collect general website settings
$wb->get_website_setting s();

// Load functions available to templates, modules and code sections
// also, set some aliases for backward compatibility
require(WB_PATH.'/framework/frontend.functions.php');

// Display the template
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');

?>
Logged
wwwMARKLEYcouk

Offline Offline

Posts: 288


WWW
« Reply #9 on: September 28, 2007, 09:23:55 AM »

its ok i figured it out.. you missed off a bit of syntax for the index file.. use this instead:
Code:
// get the template to display from URL
if ($_GET['template']!="") {
   if(file_exists(WB_PATH.'/templates/'.$_GET['template'].'/index.php')) {
      define('TEMPLATE',$_GET['template']);
     $_SESSION['TEMPLATE']=TEMPLATE;
   }
}

// get the template to display from Session Variable
else {
   if(isset($_SESSION['TEMPLATE']) AND $_SESSION['TEMPLATE'] != '')
      define('TEMPLATE',$_SESSION['TEMPLATE']);
}
Logged

heth

Offline Offline

Posts: 54


« Reply #10 on: November 28, 2007, 04:16:17 PM »

brilliant bit of code. I needed this to change font sizes... so I've used text links instead of the form which makes it even simplier!

Thank you sooooooooooooo much

Heather
Logged
gillweb

Offline Offline

Posts: 83



« Reply #11 on: March 04, 2008, 01:32:23 AM »

Quote
Create a WB page (i.e. Home) and add this code on top. (change urls)
A WYSIWYG page or a code page?  I have had no luck implementing this   sad
Logged
Vincent

Offline Offline

Posts: 360


WWW
« Reply #12 on: March 04, 2008, 08:52:32 AM »

I struggled over the same thing till I found out that you just have to put it in the WYSIWYG section.
Press the 'Code'-button, since you're inserting html code in your page, which (apart from the form) you don't want to see.

Good luck,

Vincent
 
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!