Two different layouts

marathoner

#3
Another option is to modify your template such that if page_id=1 (home page) then use 3 column otherwise use your 1 column format. Or, you could test a page to see how many section block and then use the appropriate format for that many section blocks. This approach allows you to maintain a single (but slightly more complex) template.

As an example, I sometimes use the following to switch from 1 column to 2 column (but there are probably better ways to write the code):

<div id="content">
<?php
    ob_start
(); // Start the outputbuffer
    
page_content(2); // Next call the block
    
$content2=ob_get_contents();  // Now fetch the output into a variable
    
ob_end_clean(); // Clean up old mess and stop buffering

    // Test $content2 to see if there is something in it. If so, include column wrappers for content1 and content2.
if ($content2<>"") {
    echo 
"<div id=\"content1\">\n";
    
page_content(1);
    echo 
"\n</div><!-- close div#content1 -->\n";
    echo 
"<div id=\"content2\">\n";
    echo 
$content2;
    echo 
"\n</div><!-- close div#content2 -->\n";
    }
else { 
// Otherwise, just output content1
    
page_content(1);
    }
?>

</div><!-- close div#content -->

BerndJM

Hi,

if you only need this specific 3-column template one one (or few) page(s) the easiset way would be to use another template for the remaining sites.

Regards Bernd
In theory, there is no difference between theory and practice. But, in practice, there is.

Kolb

Hello,

I just managed to port a design to WB. And everything seems to work fine!

This website in particular has a homepage were I divide the content in 3 columns (welcome/what to do/promotion). I manage to do this with blocks.

But when you visit another page (products/contact/etc) I would like to display my content in one column instead of 3 columns. How would I go about that? Do I just use a different template for the homepage, or is there a specific trick?

Thanks