WebsiteBaker Support (2.8.x) > Templates, Menus & Design
I need the template switcher code
Luckyluke:
Hi Vincent,
Thanks very much. And yes, this works!
Grtz,
Luc
gottfried:
Hi ! :-D
I extented the code above by
--- Code: ---
// Display the filtered output on the frontend
echo filter_frontend_output($frontend_output);
// from here , Template switcher -----------------------------------------------------------------
echo "<body><html><div style='position: absolute; right: 0px ; top: 10px; width: 170px; height: 30px;' >" ;
$return= '';
$lineBreak = "\n";
$lang_theme_selection = array(
'reset_theme' => 'Standard-Design',
'choose_theme' => 'Wähle Design',
);
$CurrentTheme.="template=";
// get list of available themes
$value = $CONFIG['template'];
$theme_dir = WB_PATH.'/templates/';
$dir = opendir($theme_dir);
while ($file = readdir($dir)) {
if (is_dir($theme_dir . $file) && $file != "." && $file != ".." && $file != 'CVS' && $file != 'sample' && $file != '.svn') {
$theme_array[] = $file;
}
}
closedir($dir);
//start the output
$return.= $lineBreak . '<form name="ChooseTheme" id="ChooseTheme" action="' . $_SERVER['PHP_SELF'] . '" method="get" style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;display:inline">' . $lineBreak;
$return.= '<select name="ThemeSelect" class="listbox" onchange="if (this.options[this.selectedIndex].value) window.location.href=\'' . '?' . $CurrentTheme . '\' + this.options[this.selectedIndex].value;">' . $lineBreak;
$return.='<option selected="selected">' . $lang_theme_selection['choose_theme'] . '</option>';
foreach ($theme_array as $theme) {
$return.= '<option value="' . $theme . '"'.($value == $theme ? ' selected="selected"' : '').'>' . strtr(ucfirst($theme), '_', ' ') . ($value == $theme ? ' *' : ''). '</option>' . $lineBreak;
}
$return.= '</select>' . $lineBreak;
$return.= '</form>' . $lineBreak;
echo $return;
echo "</div></body></html>" ;
// to here -> Templatewechsel Ende ------------------------------------------------------------------------
--- End code ---
between
--- Code: --- echo filter_frontend_output($frontend_output);
--- End code ---
and
--- Code: --- die;
--- End code ---
in the index.php of the wbroot
So you get a template switcher in the upper right corner of every wb-page
thanks for your code !
lausianne:
Hi gottfried,
thanks a lot to you and the "above" coders. Really cool.
It took me a moment to figure out what you meant by "code above".
For others who don't get it right away:
1. Apply the replacement of $wb->get_page_details(); as described by Vincent
2. Add gottfrieds code
Any experiences with this in WB2.8? Or is there an even better option in 2.8?
Cheers,
Ralf.
pm. Added my personal reminder file to this post to slightly simplify copy/paste.
[gelöscht durch Administrator]
crnogorac081:
Hi,
I can ot find these lines :
--- Quote ---between
Code:
echo filter_frontend_out put($frontend_output);
and
Code:
die;
--- End quote ---
in wb 2.8 ?? any tips please ?
--- UPDATE:
Ok I just addet this to the end of file, just before ?> tag.. Is it ok ??
Now another question.. Since we are not calling the DB in this code, is there a way to filter somehow this ? For example to choose just a frontend templates..?? Because if you select background theme, the site will turn into white screen ??
cheers
ufferichter:
I try to edit the index.php, but i dont know about the code echo filter_frontend_out put($frontend_output);
Where to go
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version