WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: schwoortz on April 08, 2010, 06:08:15 PM

Title: can i use multiple templates?
Post by: schwoortz on April 08, 2010, 06:08:15 PM
I'm about to do a site where the designer has created at least 3 different page types (layouts, like two columns, three colums and smething completely different) so that I need more than ONE template in WebsiteBaker. Is this possible (within one theme)? Actally the person who writes pages needs to choose from 3 different templates...

I kind of doubt it, as there is ohnly one index.php an no option to choose a template when addind a new page.

Any ideas anyone?
Title: Re: can i use multiple templates?
Post by: mr-fan on April 08, 2010, 07:15:59 PM
You could use different page_content() Blocks and check if they have content then view specific Layout or HTML...

little example with a simple submenu (found somewhere in the forum i think it was ruud some time ago)

Code: [Select]
<?php 
// Submenu region, only shown when submenu&#39;s are available
ob_start();
show_menu2(1SM2_ROOT+1SM2_STARTfalse,&#39;[li][a][menu_title]</a>&#39;,&#39;</li>&#39;, &#39;<ul>&#39;);
$childmenu=ob_get_contents();
ob_end_clean();
if (
$childmenu!="") {?>

<div id="submenu">
<?php echo $childmenu?>
</div>
<?php ?>

there is also a german tutorial here with the same function but it use page_content(x) for check...

http://www.beesign.com/WebsiteBaker/pages/posts/vier-in-einem-das-variable-template20.php

i will try to translate the code for you:

Code: [Select]
<?php 
// start buffer -> write contentblock/menu or other stuff -> put it in a variable
ob_start();
page_content(2);
$rechts=ob_get_contents();
ob_end_clean();
if (
$rechts =="") {
//ceck if this contentblock (2) has content ->that your autor create in the backend and set this content to the reffered block
echo &#39;<div id="content-breit">&#39; page_content(1); echo &#39;</div>&#39;  //normal page content block 1
} else {
// here goes the HTML output if second content block has content!
echo &#39;<div id="content-schmal">&#39;; page_content(1);
echo &#39;</div><div id="rechts">&#39; . $rechts . &#39;</div>&#39;;
}
?>

You could create a block (info.php) called "thirdcolum" and if this colum ("contentblock") is used then the HTML needed for this colum + the page_content(x); is displayed on this page......

I hope you'll see what i basicly mean?

this works good for additional colums or contentblocks or menus but not for complete layout changes......then the multi template methode is much better as 3 pressed different layouts in one.... :wink:

regards
martin

Title: Re: can i use multiple templates?
Post by: Fisherman on April 12, 2012, 11:37:19 PM
I know this is an old thread but I also need to do this. Will the new version handle multiple templates? I have to do a cms for a website that has 4 page layouts and it's 11 years old. Check it out. www.labiche.com
Title: Re: can i use multiple templates?
Post by: CaptainRob on April 13, 2012, 12:57:27 AM
Go to "Change Settings" of a page, there you can choose for each page a template.
Title: Re: can i use multiple templates?
Post by: Fisherman on April 13, 2012, 01:14:22 AM
Thanks!
Title: Re: can i use multiple templates?
Post by: sky writer on April 13, 2012, 02:06:48 AM
I checked out your current site.  I might be wrong, but I don't think this design would require different templates for each page.  It's the same basic layout, it would just require some specific show_menu2 and section/block settings to make it work.