WebsiteBaker Community Forum

WebsiteBaker Support (2.8.x) => Templates, Menus & Design => Topic started by: mikejd on June 17, 2014, 10:42:13 AM

Title: Different page layouts in one template
Post by: mikejd on June 17, 2014, 10:42:13 AM
I don't know if this is possible - to have a number of different page layouts within one template. For example, single column or two column. I have done this on one or two sites but by using more than one template. Each template is more or less identical just with a different page layout. One template is set as default and the other can be selected for any page as required.

I am happy to carry on doing this but it does seem unnecessary to have to upload all the files for each layout every time.

cheers,
Mike
Title: Re: Different page layouts in one template
Post by: Re-Mi on June 19, 2014, 05:59:14 PM
Hi,

This is possible (maybe in other ways ) but i use the a little trick i read somewhere here on the forum.

between the head tags i will place as many from these codes as i need

   <?php ob_start(); page_content(1); $content1=ob_get_contents(); ob_end_clean(); ?>
   <?php ob_start(); page_content(2); $content2=ob_get_contents(); ob_end_clean(); ?>

They will have to correspond with the content tags in the info.php for example:

in info.php

Code: [Select]
$block[1] = 'main content full with';
 $block[2] = 'main content half with';

in index.php

between the head tags:

Code: [Select]
<?php ob_start(); page_content(1); $content1=ob_get_contents(); ob_end_clean(); ?>
<?php ob_start(); page_content(2); $content2=ob_get_contents(); ob_end_clean(); ?>

And at the place you need it:


Code: [Select]
<?php if(($content2) == true){ ?>
<div class="main half">
<!--
<div class="main full">
-->
<?php ?>
<?php page_content(1); ?>
</div>
<?php if(($content2) == true){ ?>
<div class="main half last">
  <?php page_content(2); ?>
</div>
<?php ?>

and in the template.css you define the classes :

Code: [Select]
.main{
background: #FF00FF;
height: 500px;
}

.full {
width: 680px;
}

.half{
width: 335px;
float: left;
}

.last{
margin-left: 10px;
}



I think this should work, i did similar things with webpages i made, the above code i wrote as an example (and i think its correct, just try it) .

You should only change the blocks when you make the pages in the admin

p.s. don't judge my code  he he he i know i'm not a pro just trying to help out.

Greetz,

Michel