What does this do?
This module provides an additional contenttype when adding/editing pages.
With this contenttype users can create custom input controls in backend to the add/edit page area by just using additional params in the page template when calling the content.
That means you can display the content blocks as dropdowns, multiple select lists, checkboxes etc.
You can also display the content blocks in different tabs or group them in fieldsets.
It also adds ability to grant access of pages or single blocks only to certain users of the
FrontEndUsers module and hide the content, replace it by the login form of the
FrontEndUsers module or redirect to a specified page showing the login form or
just redirect without doing anything else if the frontend user is not logged in or does not belong to a certain group.
Additionally pages can have a start and end date to activate/deactivate pages automatically.
The advanced content properties can be inherited from parent pages.
You can even use smarty logic in parameter values. That means you can use the
result of a plugin, an udt or even a module or just the content of a global
content block as parameter value to create dynamic values.
Notice: In some cases it is recomended to use the the {AdvancedContent} tag in template instead of the default {content} tag. (case sensitive)
e.g. the annoying message "Parameter [X] is not known by Module [Modulename]" can be avoided with it. (only affects the default content block at the moment)
How is it used?
After installation the module settings can be found in "Extensions->AdvancedContent".
Additionally you will have a new content type "AdvancedContent" available when adding/editing a page.
WARNING!
If you uninstall the module without reverting all pages of type AdvancedContent back to the default contenttype your CMSms won't work anymore!
Make sure to set all pages of type AdvancedContent back to default content or delete them before uninstalling! (use the module preference 'uninstall action' to do this automatically)
To use the modules functions use this content type and optionally add the following parameters to your content tag in your page template...
What parameters are available?
(all params are optional)
Default params:
(see also tag help of the default {content} tag)
-
(optional) block (string)
-
Allows you to have more than one content block per page. If multiple content tags are put on a template, that number of edit boxes will be displayed if the page is edited.
e.g.: {content block="Second Content block"}
Now, if you edit a page there will ba a textarea called "Second Content block".
Notice: The name of the content block may contain only letters, numbers, and underscores (no whitespaces, special chars, umlauts etc.). Otherwise it will be converted to a proper name (similar to the page alias).
-
(optional) wysiwyg (true/false)
- If set to false, then a wysiwyg will never be used while editing this block. If true, then it acts as normal.
-
(optional) oneline (true/false)
- If set to true, then only one edit line will be shown while editing this block. If false, then it acts as normal. Only works when block parameter is used.
-
(optional) default (string)
- Default content when creating a new page.
-
(optional) label (string)
- Prompt for this content block. Possible values are any expression. If blank, the unconverted block name is used.
-
(optional) assign (string)
-
Assigns the content to a smarty parameter, which you can then use in other areas of the page, or use to test whether content exists in it or not.
Example of passing page content to a User Defined Tag as a parameter:
{content assign=pagecontent}
{table_of_contents thepagecontent="$pagecontent"}
Advanced params:
-
(optional) block_type (text,checkbox,dropdown,select_multiple,date,multi_input,slider,colorpicker)
- Allows you to specify what content control type is used in the back end.
-
(optional) page_tab (string)
-
This parameter sets the tab in which the content block is displayed in the backend.
Possible values are "main" ( = Tab "Main Menu"), "options" ( = Tab "Options"), or any other arbitrary value
e.g. you can add a checkbox to the options tab or create new tabs.
-
(optional) block_tab (string)
- With this parameter, the blocks within a page tab can be further divided into tabs or can be grouped together. Any expression can be used as a possible value.
-
(optional) block_group (string)
- With this parameter, multiple blocks can be grouped in a fieldset. Any expression can be used as a possible value.
-
(optional) active (true/false)
-
Allows you to disable a content block. Disabled content blocks won't be shown in backend as well as in frontend. (only works with {AdvancedContent} plugin)
-
(optional) editor_groups (string)
-
A comma separated list of group names that are allowed to edit this block.
-
(optional) editor_users (string)
-
A comma separated list of user names that are allowed to edit this block.
Notice: if the params editor_users and editor_groups are empty the block may be edited by any user with sufficient permission to edit a page
-
(optional) feu_access
-
A list of feu group ids separated by a comma.
This shows the content block only to certain feu groups.
-
(optional) feu_action (true/false)
-
Specify if the login form of the feu module will be shown or not.
Notice: The login form will only be shown one time.
If there are multiple blocks with limited feu_access and feu_action set to true only the first blocks login form will be shown and all other blocks will just be empty.
-
(optional) allow_none (true/false)
- Set to true if the user may enter empty values.
If set to false and value is empty the default value of the param "default" will be used.
If set to true and block is of type image/file the option "none" (mode="dropdown") or a button to clear the selected file/image value (mode="filepicker") will be displayed.
-
(optional) smarty (true/false)
-
Turn smarty processing of values on/off.
If set to true any given value will be processed by the smarty engine.
Notice: Consider that you cannot use the default smarty delimiters that are used in the template. This will cause smarty errors in frontend.
So you need to use ::: as delimiter instead.
E.g.: {content block="Categories" label="Select a category" block_type="dropdown" items=":::global_content name='categorylist':::" smarty="true"}
-
(optional) description (string)
- Allows you to add a detailed description to that block for your editors.
-
(optional) collapse (true/false)
-
Set to true/false to display block in backend in collapsed/expanded mode by default.
Notice: will be always false if no_collapse=true is used.
-
(optional) no_collapse (true/false)
-
Set to false to disable folding of blocks.
Notice: if set to true param collapse is always false.
-
(optional) required (true/false)
-
Set to true if this block may not be empty.
Params of blocktype "checkbox":
-
(optional) default (true/false)
-
checks/unchecks the checkbox by default when adding a page
Notice: Use "1" for checked and "0" for unchecked by default
E.g. {content block_type="checkbox" default=1}
Parameter für Colorpicker: no additional parameters
Parameter für Slider: (see also documentation of the built in jquery slider plugin)
-
(optional) step (int)
-
amount of steps the slider changes the values
-
(optional) heterogeneity (string)
-
(optional) dimension (string)
-
(optional) limits (true/false)
-
(optional) scale (string)
-
(optional) skin (string)
-
the skin to use when rendering the slider
-
(optional) calculate (string)
-
a javascript function to calculate the displayed values
-
(optional) onstatechange (string)
-
a javascript function that will be processed when changing the value
-
(optional) callback (string)
-
a javascript function that will be processed after a value has been changed
Params of blocktype "dropdown"/"select_multiple":
-
(optional) items (string)
- Item label(s) of the field(s) (separated by a delimiter - default is | (pipe))
-
(optional) values (string)
- Value(s) of the items (separated by a delimiter - default is | (pipe))
Notice: if there are less values than items the item labels will be used as values (and vise versa).
-
(optional) default (string)
-
Preselected value(s) (separated by a delimiter - default is | (pipe))
Notice: Use the item values as default, not the item labels.
-
(optional) delimiter (string)
- A sign or string that will be used to devide the items/values (default is | (pipe))
- (optional) size (integer)
- Height of content block in back end if
block_type="select_multiple" is set. (Default is number of items)
- (optional) sortable (true/false) - select_multiple only
-
If set to true the items won't be shown as a multiple select input with options but as a list of checkboxes that can be reordered.
Each row contains the item label and a checkbox with the item value.
Notice: only the order of the selected items will be stored and always displayed on the top of the list when reloading the edit page.
Unselected items will appended in that order they are defined in the template
Params of blocktype "date":
-
(optional) step_hours (int)
-
steps of hours in the clock dropdown. (default is 1)
-
(optional) start_hour (int)
-
the start hour of the clock dropdown. (default is 0)
-
(optional) end_hour (int)
-
the end hour of the clock dropdown (default is 12 or 23)
-
(optional) show24h (true/false)
-
set to false if AM/PM is used. (default is true)
-
(optional) step_minutes (int)
-
steps of minutes in the clock dropdown. (default is 10)
-
(optional) start_minute (int)
-
the start minute of the clock dropdown. (default is 0)
(optional) end_minute (int)
-
the end minute of the clock dropdown (default is 59)
-
(optional) show_clock (true/false)
-
set to false if no time dropdown should be displayed (default is true)
Notice: If set to false 00:00 o'clock will be used
-
(optional) date_format (string)
-
The strftime date format to show in frontend.
Params of blocktype "multi_input":
-
(optional) inputs (csv of input ids you created in the backend)
-
(optional) value_delimiter (any string)
-
This defines a string that devides the values of the inputs of one multi_input when stored in the database.
Default is "<!-- multi_input_value_dellimiter -->"
-
(optional) input_delimiter (any string)
-
This defines a string that devides the multi_inputs you defined for this content block when stored in the database.
Default is "<!-- multi_input_dellimiter -->"
-
What is a multi_input for?
A multi_input block is a content block that consists of different input fields.
You can define them in the module administration using the same syntax you use in a template when defining a content block.
Multi inputs can be used if you want to store different values in one content block and provide different input types for each values.
This can be usefull if you want to create a dropdown to select a module to be shown in frontend and text input to define the module parameters.
Example for a multi_input in page template:
{content block="module" label="Page modules" block_type="multi_input" inputs="module,module,module,module"}
Example for the definition of the multi_input named "module":
{content block="module selection" block_type="dropdown" items="|News|Gallery|Menu"}
{content block="module params" block_type="text" oneline=true}
What happens if you edit a page?
It will show you a fieldset with legend "Page modules".
Inside this fieldset it shows the multi_input named "module" four times.
That means you see four lines with two input fields. A dropdown and a text input.
What happens if you save a page?
The module stores the values as one single content property (aka contentblock) and separates the inputs by a given delimiter.
Let's assume you select the News module four times with different module params like category="1", category="2", category="3", category="4".
In the database it stores this string:
News<!-- multi_input_value_delimiter -->category="1"<!-- multi_input_delimiter -->
News<!-- multi_input_value_delimiter -->category="2"<!-- multi_input_delimiter -->
News<!-- multi_input_value_delimiter -->category="3"<!-- multi_input_delimiter -->
News<!-- multi_input_value_delimiter -->category="4"
In your page template you can explode the content by the delimiters and call the selected modules.
Full Example:
{* define the content block *}
{content block="my_modules" block_type="multi_input" inputs="Module,Module,Module,Module" assign="modules"}
{* explode block content in an array to get the input groups *}
{assign var=modules value="<!-- multi_input_delimiter -->"|explode:$modules}
{* loop through the selected modules *}
{foreach from=$modules item="module"}
{if $module != ''}
{* explode the input values in modulname and module parameters *}
{assign var=module_items value="<!-- multi_input_value_delimiter -->"|explode:$module}
{if $module_items[0] != ''}
{* call the module *}
{if isset($module_items[1])}
{eval var=$smarty.ldelim|cat:'cms_module module="'|cat:$module_items[0]|cat:'" '|cat:$module_items[1]|cat:$smarty.rdelim}
{else}
{eval var=$smarty.ldelim|cat:'cms_module module="'|cat:$module_items[0]|cat:'"'|cat:$smarty.rdelim}
{/if}
{/if}
{/if}
{/foreach}
Support
This module does not include commercial support. However, there are a number of resources available to help you with it:
Feel free report any kind of feedback.
Copyright and License
Copyright © 2010-2011, Georg Busch (NaN). All Rights Are Reserved.
This module has been released under the GNU Public License. You must agree to this license before using the module.
As per the GPL, this software is provided as-is.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Or read it online: http://www.gnu.org/licenses/licenses.html#GPL
Please read the text of the license for the full disclaimer.