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 »
  • Include Droplet
  • Print
Pages: [1]   Go Down

Author Topic: Include Droplet  (Read 5012 times)

Offline virtualadrian

  • Posts: 1
Include Droplet
« on: September 05, 2012, 07:11:01 AM »
Hi guys,

I realize that what I'm about to ask may end up being silly however .. here goes:

I would like to be able to include or require another php page within the WYSIWYG editor via droplet. However when I attempt to do that on the demo site it screams about security permissions. Is this just because of the demo, or does WB have said restriction where I cannot include or require_once ? I have used WB in the past, long long ago... like 5 years ago and if I can overcome this little stumbling block, I'm pretty sure I can use it for this project.

Anyway, is that possible?
Logged

Offline Bug

  • Posts: 237
Re: Include Droplet
« Reply #1 on: September 05, 2012, 07:42:43 AM »
Hi,
This is how I would do that

Create a new page, type: code
Probably with visibility:hidden
remember the section-number (not the pagenumber, it is the section number you need)

Use the showsection droplet (slightly modified version enclosed in this post)

Save it as f.i. 'includer'

Call it with

[[includer?sid=56]]
(56 being the section number of the page you want to include, so change 56 to the right value corresponding to the section nmber of your code page)

Code: [Select]
global $database, $wb, $TEXT;
$content = ' ';
$query_sec = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = '$sid' ");
if($query_sec->numRows() > 0) {
$section = $query_sec->fetchRow();
$section_id = $section['section_id'];
$module = $section['module'];
ob_start();
require(WB_PATH.'/modules/'.$module.'/view.php');
$content = ob_get_contents();
    ob_end_clean();
}

if (empty($content)){
$content = ' ';
}else{
$content = $content;
}

return $content;

(Modification: does not give an error when being empty)
Logged

  • Print
Pages: [1]   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.8.x) »
  • Droplets & Snippets »
  • Include Droplet
 

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