WebsiteBaker 2.13.8 is now available!
R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WBhttps://forum.websitebaker.org/index.php/topic,32355.0.html
global $wb;$wb->page_id = 14;page_content(2);$wb->page_id = 16; //I am not sure this is really necessary but just in case.
<!-- 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 = '$section_id' "); if($query_sec->numRows() > 0) { $section = $query_sec->fetchRow(); $section_id = $section['section_id']; $module = $section['module']; require(WB_PATH.'/modules/'.$module.'/view.php'); } } else { echo '<div align="center">'; echo $topl; echo '</div>'; } ?> </div> <!-- end of the global block -->
<?php include WB_URL.'/pages/name_of_hidden_page.php'; ?>
Hi lousou76I tried your code and it works great but not with an image gallery. Is there a way to make that work too?ThanksHans
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 = '$section_id' "); if($query_sec->numRows() > 0) { $section = $query_sec->fetchRow(); $section_id = $section['section_id']; $module = $section['module']; require(WB_PATH.'/modules/'.$module.'/view.php'); } } else { echo '<div align="center">'; echo $topl; echo '</div>'; } ?> </div> <!-- end of the global block -->
<?php //pseudocodeif block 2 has content - echo block 2 ....else echo section that is set in the codesnippet...
BUT if you setup on one of your pages a different page_content(2); (manage sections) the default view (section) change ONLY on this site to the block 2 content you like!
<!-- global block starts here --> <div id="topleft"> <!-- change to your favorite css #id --> <?php ob_start(); page_content(2); //PAGE CONTENT who should be replaced with global block $topl=ob_get_contents(); ob_end_clean(); if ($topl=="") { global $wb; $wb->page_id = 14; // page_id of the global block page_content(1); // set up the block to show } else { echo $topl; } ?> </div> <!-- end of the global block -->
<!-- global block starts here --> <?php ob_start(); page_content(2); //PAGE CONTENT who should be replaced with global block $topl=ob_get_contents(); ob_end_clean(); if ($topl=="") { global $wb; $wb->page_id = 14; // page_id of the global block ?> <div id="topleft"> <!-- change to your favorite css #id --> <?php page_content(1); // set up the block to show ?> </div> <?php } else { echo $topl; } ?> <!-- end of the global block -->
if it does not work, try curl instead:Code: [Select]$ch = curl_init();$timeout = 5; // set to zero for no timeoutcurl_setopt ($ch, CURLOPT_URL, WB_URL.'/pages/pagename.php');curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);$file_contents = curl_exec($ch);curl_close($ch);// display fileecho $file_contents;
$ch = curl_init();$timeout = 5; // set to zero for no timeoutcurl_setopt ($ch, CURLOPT_URL, WB_URL.'/pages/pagename.php');curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);$file_contents = curl_exec($ch);curl_close($ch);// display fileecho $file_contents;
Have you tried the droplet sectionpicker instead?
Depending on the installed WB Version the Module is already included, have a look at the admin tools. A bit more info can be found here: http://www.websitebakers.com/pages/droplets/about-droplets.phpYou copy the droplet code and past it into a "new" droplet which you can create in the admin of your WebsiteBaker installation. Name the droplet exactly like found on the site "ShowSection" and call it with [[showsection?section=xx]] (replace xx with the ID of your Section).The Call can be placed in your template or in a section.cheersKlaus