Welcome, Guest. Please login or register.
Did you miss your activation email?
May 26, 2012, 06:32:48 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155547 Posts in 21714 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Droplet to show a non-wysiwyg section  (Read 890 times)
javaguy78

Offline Offline

Posts: 24


« on: June 20, 2011, 11:56:51 PM »

I use the following code throughout my site to show various sections on various other pages.
Code:

// Change this to the section number you need!
$section_id = 35;

// Get requested section for requested page
$query_sections = $database->query("SELECT section_id,module FROM ".TABLE_PREFIX."sections WHERE section_id = '$section_id' ");

// Make sure there is one
if($query_sections->numRows() > 0) {
$section = $query_sections->fetchRow();
$section_id = $section['section_id'];
$module = $section['module'];
require(WB_PATH.'/modules/'.$module.'/view.php');
}


and it works like a charm in PHP sections in the code AND it works like a charm in the index.php of my theme. I wanted to change it to a droplet, but the require word is not available in droplets, incidentally, I can't get it working.

I did find the ShowSection droplet, but it only works on WYSIWYG sections, not on other sections that I want to show (such as my own custom built BLOG section). I don't want to copy and paste the exact same code to hundreds of sections when I can just create a droplet to do the work.

My question is this: Has anyone had success in creating a droplet that copies the contents of a specified non-wysiwyg section to another location?

the other problem is that ShowSection droplet doesn't process droplets down the chain, so if I stuff a droplet into a wysiwyg section, then use showsection to display that section elsewhere, it fails.

All I want to do is propagate data from one page to another, allowing both pages to show the same section.
« Last Edit: June 21, 2011, 12:01:10 AM by javaguy78 » Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2297



WWW
« Reply #1 on: June 21, 2011, 09:29:24 AM »

You could use the section_picker module.
http://www.websitebakers.com/pages/modules/listings/section-pages/section-picker.php

It will allow "reusing" any section.
Since this is a normal pagetype module, droplets will be processed.
Logged

Professional WebsiteBaker Solutions
javaguy78

Offline Offline

Posts: 24


« Reply #2 on: June 21, 2011, 01:54:51 PM »

Thanks, that might work.

What I'm trying to do is show the contents of a section on a page within a div that is positioned with css, hence the need for a droplet since the WYSIWYG editor doesn't let you leave a table cell or div open to encapsulate the following section inside the element. The idea is that the homepage of my site will consist of little snippits of the rest of the site, like a greatest hits.

I'll see if this works.
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #3 on: June 21, 2011, 02:20:06 PM »

allmost offtopic

And another good use of require example down the drain...


You work in wb 2.8.2?

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
dbs
WebsiteBaker Org e.V.

Offline Offline

Posts: 3719


WWW
« Reply #4 on: June 21, 2011, 02:38:59 PM »

there is also a droplet sectionpicker:
http://www.websitebakers.com/pages/droplets/downloads.php

you can import this droplet with droplet-version 1.51
http://www.websitebakers.com/pages/droplets/module-wb2.8.php
Logged

pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #5 on: June 21, 2011, 03:35:21 PM »

droplet sectionpicker needs command require as well. Won't work

Problem lies here in the 'security'measure not to use inclide/require/eval etc in a droplet.

John
« Last Edit: June 21, 2011, 03:37:02 PM by pcwacht » Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
javaguy78

Offline Offline

Posts: 24


« Reply #6 on: June 21, 2011, 09:28:55 PM »

the SectionPicker droplet does exactly what I need it to. I guess I won't be upgrading my websitebaker. and if I do, I'll backup the droplet's module and roll it back to on the new version!

thanks for pointing me in the right direction.

(P.S. perhaps you can release a copy of the droplet's module without the security measures so people who understand the risks or do not have a team of admins can run legacy droplets that include Require. Just a thought) 
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #7 on: June 21, 2011, 09:56:37 PM »

People who understands  the risk can edit the files..... there lies no magic.

I don't release, I am just a happy contributing user.

Just take the last droplet modules from amasp

But... the code module will be 'secured' as well.

There is some thread(s) in the forum where some are talking about the benefits and drawbacks about this.
I don't know what way it will go.
Just pointing to this errors cause of the 'security'


Happy wb-ing.

john
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
NorHei
Forum administrator
*****
Offline Offline

Posts: 485



WWW
« Reply #8 on: June 22, 2011, 11:11:24 AM »

One Workaround i can think off is to encapsulate the Content of the Droplet into a snippit.
So your droplet would only contain the function call.

Quote
$section_id = 35;
return fetchpage($section_id);

But i am not perfectly sure if they blocked that too.

The whole idea of removing functionality from Droplets for some fake security is simply the wrong way .
As long as Droplets only can be installed by the main Admin there is no more risk that having the Admin change some files via file editor(either via FTP or via the WB file editor plugin.)

To have perfectly secure Droplets you need to remove Include, require, fopen, database access, curl, eval, sockets and a lot more. So they get almost useless.

So just get the Droplet Module from AMASP replace the core module  and you are done.


 

Logged

It is easier to change the specification to fit the program than vice versa.
Stefek
WebsiteBaker Org e.V.

Offline Offline

Posts: 4884



« Reply #9 on: June 22, 2011, 11:13:58 AM »

The whole idea of removing functionality from Droplets for some fake security is simply the wrong way .
As long as Droplets only can be installed by the main Admin there is no more risk that having the Admin change some files via file editor(either via FTP or via the WB file editor plugin.)

100% agreement.
It's one big pain in the *.
Seems to be volkssport these days.  evil
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
pcwacht
AddOn Development
*
Offline Offline

Posts: 2859



WWW
« Reply #10 on: June 22, 2011, 12:36:48 PM »

Ah well

Dunnoh what current ideas are from the devs about the 'security' .

I know I won't take it for granted, will tear the pain stuff out of it.
And maybe release it as a non-secure but more sensible edition in the forum for others.
Hmmm, might need a name for it, like portable-wb?

Something like sane-wb or easydoesit-wb or.....  Tongue

Hmmm.

Wish some dev would shine a light on the current path they are taking. We are somewhat in the dark on this and simular (form - ftan) issues.

John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
javaguy78

Offline Offline

Posts: 24


« Reply #11 on: June 22, 2011, 04:32:12 PM »

One Workaround i can think off is to encapsulate the Content of the Droplet into a snippit.
So your droplet would only contain the function call.

Oooh, I like this idea!
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!