pd_scripting - a CMSimple_XH - Plugin

Version: 2.0
©2010 by Holger Irmler http://www.HolgerIrmler.de/playground

@doku_version: 2010-04-02

The plugin is free for use in the scope of your own website, «commercial» or not. 
Professional web-designers, who are planning to deliver it as part of their service to their customers,
should allways be so fair to make a small donation.

But anyway, if you like it, consider donating a few bucks to me via PayPal.


About

This plugin is doing, as it's name says, managing plugin-calls and scriptings together with
pagedata.php - the database of CMSimple_XH.
So it's not necessary to write #CMSimple ...# code to your content to include a plugin or another function anymore.

Goals:


Installation

You need a CMSimple(_XH) installation >= v. 1.0 and/or  pluginloader >= version 2.1 to work with this plugin.
  1. Make a backup of your files!
    It's always nice to have a backup before you mess around with the system

  2. Download the plugin, unzip and keep the folder structure
    New versions should be available from http://www.HolgerIrmler.de/playground

  3. Upload the folder "hi_pd_scripting" and it's content to the folder called PLUGINS (the plugin loader)

  4. Login to CMSimple to edit/create pages.
    You'll find a new tab called "Plugins" by default above your editor.
  5. In order to get online-access to the configuration, the following folders has to made writable to the script:

Configuration

Note: The plugin knows two modes:
by default, only one script can be included at the end of a page.
In 'advanced_mode' - check config settings - it can handle up to five scripts per page
(It's limited just to prevent pollution of pagedata.php).

Select the "Hi_pd_scripting" plugin from the list of available plugins and chosse "Plugin Config" to change some configuratin settings.
Note: move your mouse to the little blue questionmark-icon to get a tooltip with a short help message.

Possible configuration-settings:

Setting Possible Values Description
destroy all fields: empty This setting is unused at the moment
mode advanced: 1 / 0 or empty Set to 1 to enable 'advanced-mode'. But remember to keep the amount of allowed scripts per page as short as possible.
scripts max on page: 1 ... 5 Add here the max. amount of allowed plugins/scripts per page (1 - 5). If you're not in 'advanced-mode', this setting will be set (and saved in config) to 1 by default.
tab hide from user: 1 / 0 or empty Set to 1 to hide the plugin-tab in admin-mode.

Usage

1. Scripts & Plugins
To add plugins, php-code or CMSimple-functions to a page, just select the "Plugins" - tab and fill out the required fields.
Write only the function or plugin-call into the field "Script Code".
Example:
If the code to activate a plugin in the content is something like:
#CMSimple $output.= pluginname(parameters);#
you should only enter
pluginname(parameters)
to the field "Script Code".

2. Variables
From version 2.0 it's also possible to change or create variables like language- or config settings at runtime.
Example:
If you want to change the heading "Submenu" on a single page you can redefine it this way
$tx['submenu']['heading']="read more...";
in the field "Script Code".

Note: It's possible to merge more than one varaible to a single field:
$tx['submenu']['heading']="read more...";$tx['menu']['mailform']="Contact me by email";
Just take care of correct PHP-syntax and don't forget the ending ";" !
Placeholders are ignored in this case.

1. Normal Mode

You can add one script of your choice to
the end of the selected page.

Just add the plugin-call or the function to
the field "Script-Code" and select "Yes" to
activate the script at runtime.

2. Advanced Mode

You can add up to five scripts of your choice
to the selected page.

Just add the plugin-call or the function to
the field "Script-Code" and select "Yes" to
activate the script at runtime.

As an option, you can add a unique
"placeholder" to your content into the
field "Placeholder in content (optional)".
The placeholder in the content will be
replaced by the output of your plugin or
your script.
This way you can place plugins at a
position of your choice within your page.

Note: Use really unique strings for the
placeholder and never use special
characters!

You'll get a warning in admin-mode,
if the plugin can't find the placeholder
in your page-content. If so, the output of
the plugin will be added to the end of your
page.

Limitations

The script may handle almost every CMSimple plugin. But some plugins may need their function call in the content.
An example is the Gallery Plugin from Svarrer. This plugin seeks in the content to find the installed galleries.
You can include galleries with pd_scripting but in admin mode, the Gallery Plugin can't find installed galleries
(but I'm working on that ;-) ).

Support

Support will be available at http://www.cmsimpleforum.com

Cangelog:

Version 1.0
Version 1.01
Version 2.0

License

This plugin is licensed under the GPL3.
Please do not remove comments and or links to the author(s) in the code or the output.

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.