Author Topic: Include Droplet  (Read 1954 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?

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)

 

postern-length