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) »
  • Droplets & Snippets »
  • Global blocks - or how to get the same content on every page
  • Print
Pages: 1 2 [3]   Go Down

Author Topic: Global blocks - or how to get the same content on every page  (Read 80679 times)

mr-fan

  • Guest
Re: Global blocks - or how to get the same content on every page
« Reply #50 on: May 31, 2010, 10:18:58 AM »
Quote from: Housy on May 31, 2010, 01:03:49 AM
What else can i try?

Tnx, Housy

hi Housy,

try this one in code section or in your template... :wink:

Code: [Select]
<?php
// here your section 
$section_id = 65;

// query for section call
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = &#39;$section_id&#39; ");

// query to check if section exists and output with fitting mod view.php
if($query_sections->numRows() > 0) {
$section = $query_sections->fetchRow();
$section_id = $section[&#39;section_id&#39;];
$module = $section[&#39;module&#39;];
require(WB_PATH.&#39;/modules/&#39;.$module.&#39;/view.php&#39;);
} 
?>

best regards
martin
Logged

Housy

  • Guest
Re: Global blocks - or how to get the same content on every page
« Reply #51 on: May 31, 2010, 04:46:35 PM »
Quote from: mr-fan on May 31, 2010, 10:18:58 AM
Quote from: Housy on May 31, 2010, 01:03:49 AM
What else can i try?

Tnx, Housy

hi Housy,

try this one in code section or in your template... :wink:

Code: [Select]
<?php
// here your section 
$section_id = 65;

// query for section call
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = &#39;$section_id&#39; ");

// query to check if section exists and output with fitting mod view.php
if($query_sections->numRows() > 0) {
$section = $query_sections->fetchRow();
$section_id = $section[&#39;section_id&#39;];
$module = $section[&#39;module&#39;];
require(WB_PATH.&#39;/modules/&#39;.$module.&#39;/view.php&#39;);
} 
?>

best regards
martin

Martin I love you man :-D

Thank you very much, finally working :wink:

Thank you both, Martin and Klaus.

Housy
Logged

mr-fan

  • Guest
Re: Global blocks - or how to get the same content on every page
« Reply #52 on: May 31, 2010, 05:00:43 PM »
nice that it works for you!

best regards martin
Logged

Offline lavric

  • Posts: 10
  • Gender: Male
  • blond...
Re: Global blocks - or how to get the same content on every page
« Reply #53 on: September 09, 2010, 01:49:32 PM »
Quote from: mr-fan on March 05, 2009, 09:23:48 AM
Code: [Select]
               <!-- global block starts here -->
                <div id="topleft"> <!-- change to your favorite css #id -->
                <?php
                ob_start
();
                
page_content(2); //INFOBOX PAGE CONTENT 2 in my case
                
$topl=ob_get_contents();
                
ob_end_clean();
                if (
$topl=="") {
                
$section_id = 65; // ID from the section that stays always if pagecontent 2 has no content
                
$query_sec = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = &#39;$section_id&#39; ");
                if(
$query_sec->numRows() > 0) {
                
$section = $query_sec->fetchRow();
                
$section_id = $section[&#39;section_id&#39;];
                
$module = $section[&#39;module&#39;];
                
require(WB_PATH.&#39;/modules/&#39;.$module.&#39;/view.php&#39;);
                
}
                } else {
                echo &
#39;<div align="center">&#39;;
                
echo $topl;
                echo &
#39;</div>&#39;;
                
}
                
?>

                </div>
                <!-- end of the global block -->


Hi guys,

i use this piece of code for global blocks!

I've got it from vyni!

The Trick is that you can have default view for a global block (with the section_id you choose) and if you want another content on one or more sites only set up a section and set it up to the content of the global block - and on this page the content is like you want it!

regards martin


This is WOW USEFUL!!! THANKS MAN!!!
Logged
I thought it wasn't too much trouble, but it was too much to ask...

Offline tkche

  • Posts: 12
Re: Global blocks - or how to get the same content on every page
« Reply #54 on: October 30, 2010, 12:49:42 PM »
Hi,
I am trying to make a global block for a contact-form on my template.
the above code works great and gets the job done, but for some reason it includes the CSS style into the page's code.
any ideas?
Logged

edwardca

  • Guest
Re: Global blocks - or how to get the same content on every page - Easy solution
« Reply #55 on: November 02, 2010, 03:50:50 PM »
Quote from: masju on January 31, 2009, 04:58:16 PM
Hi!

If your server does not allow the include-command in your template's index.php
<?php include (WB_URL."/pages/blocks/block1.php"); ?>
due to security-settings, try this instead:

<?php
$handle = fopen (WB_URL."/pages/blocks/block1.php", "r");
while (!feof($handle))
   {
    $buffer = fgets($handle, 4096);
    print_r ($buffer);
   }
 ?>

Works well :-)

greets masju

Yes!  Solved my problem - you rock dude!!
Logged

Offline Ruud

  • Posts: 3671
  • Gender: Male
  • Do not use PM for help! Please use the forum!
    • Dev4Me - Professional WebsiteBaker Development
Re: Global blocks - or how to get the same content on every page
« Reply #56 on: March 07, 2012, 10:16:42 PM »
The solution. The globalBlock snippet.

https://forum.WebsiteBaker.org/index.php/topic,23587.msg159797.html#msg159797
Logged
Dev4me - WebsiteBaker modules - WBhelp.org

  • Print
Pages: 1 2 [3]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Global blocks - or how to get the same content on every page
 

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