WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Multiple Content Blocks
  • Print
Pages: [1]   Go Down

Author Topic: Multiple Content Blocks  (Read 9067 times)

rdsaunders

  • Guest
Multiple Content Blocks
« on: January 16, 2008, 09:29:08 AM »
Hi There,

I've read http://help.WebsiteBaker.org/pages/en/advanced-docu/designer-guide/content-blocks.php and I've been able to create multiple content blocks within my template and edit their content independantly. I've been unable to find the answer to my question on this forum or through our friend google.

I have attached a drawing of my requirement. The top section of the attachment shows three content blocks which i'm able to achieve styling with CSS.

However I want my homepage only to display these content blocks. This is obviously done in the Modify Sections page which I understand. However due to the styling of these content blocks these will appear on each of the other pages. Even those that i have only one content block specified in the sections page.

Code: [Select]
<div class="content">
        <?php page_content(1); ?>
    </div>
    <div class="bottomleft">
        <?php page_content(2); ?>
    </div>
    <div class="bottomright">
        <?php page_content(3); ?>
    </div>

The code snippet above is an example, I need some way of saying only show these DIV containers (bottomleft & bottomright) if these content blocks have any content.

If anyone is able to help me it would be greatly appreciated.






[gelöscht durch Administrator]
Logged

doc

  • Guest
Re: Multiple Content Blocks
« Reply #1 on: January 16, 2008, 10:20:30 AM »
Hello,

please have a look on this forum thread here.

Using the advanced forum help with the keywords: ob_start and block would provided some more information. If time allows, we put this information to the Help website.

Regards Christian
Logged

rdsaunders

  • Guest
Re: Multiple Content Blocks
« Reply #2 on: January 16, 2008, 10:37:49 AM »
Thank you for your quick response.

I shall attempt this today and feedback, thank you for the search criteria. I'm sure to have some reading to do.

I'm new at php i'm happy to sit with HTML/CSS but need to begin to understand PHP a little  :?



Logged

rdsaunders

  • Guest
Re: Multiple Content Blocks
« Reply #3 on: January 16, 2008, 12:18:59 PM »
Well its now working!

This is the code i utilised.

Code: [Select]
<!--  This routine checks for content in content area two before rendering the containers -->     
<?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
?>
   
<?php if ($content2<>"") { // Next test $content2 to see if there is something in it
    
echo "<div class=\"bottomleft\">\n";
    echo 
$content2;
    echo 
"\n</div><!-- close div#bottomleft-->\n";
}
?>


This needs to be in the template for each block you what to check and render on the page.

Ensure you change the variable name and change the page_content(2) number that relates to the block you are referring to.
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Templates, Menus & Design »
  • Multiple Content Blocks
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2