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)
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.
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.
Notice:
In some cases it is recomended to use the the {AdvancedContent} tag in the 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)
If your start page is of type advanced content and you change this to be the default contenttype you need to set this page as start page again.
If you use smarty to process the parameter values consider the following:
It is not recommended to use page related data such as {$content_id}, {title} or {$page_alias} etc. because these data does not exist if you create a page.
Make sure that you do not use template vars, plugins or udts that needs data that is only available when the page is rendered via frontend.
It is recommended to create a plugin or udt where you can decide what to return if there is no such data available.
To use the modules functions use this content type and optionally add the following parameters to your content tag in your page template...
If you have decent programming skills you can extend the module with custom blocktypes using the directory /module_custom/AdvancedContent/lib/ in your CMSms root directory.
If not exists create it but notice case sensitivity here.
In this directory create a php file named like this: class.acBlockType_[name of the block type].php
The name of the blocktype needs to be lower case only.
In this file create a class named exactly like the part of the filename between 'class.' and '.php'.
This class must extend a base class called 'acContentBlockBase'
In the constructor of that class you need to call the parent constructor as the very first.
Example...
Filename: class.acBlockType_foo.php
Content:
class acBlockType_foo extends acContentBlockBase
{
function __construct(&$content_obj, &$params = array())
{
parent::__construct($content_obj, $params);
# custom properties of the block type defined by the tag params
$this->SetBlockProperty('bar', isset($params['bar']) ? $params['bar'] : '');
}
public function GetBlockInput()
{
# create a custom input field for that block type
return 'Here should be a very special foo input.';
}
}
For more info about possible functions for a blocktype click here to read the genrated API documentation.
You may also take a look in /modules/AdvancedContent/lib/ to see some more detailed examples how blocktypes can be created.
(all params are optional)
Default params:
(see also tag help of the default {content} tag)
{content block="Second Content block"}{content assign=pagecontent}
{table_of_contents thepagecontent="$pagecontent"}Advanced params:
{content block="Categories" label="Select a category" block_type="dropdown" items=":::global_content name='categorylist':::" smarty="true"}
Additional params of blocktype "text":
Params of blocktype "checkbox": no additional parameters.
Notice: use param default=1 to set if a checkbox is checked by default.
Parameter of blocktype Colorpicker: no additional parameters
Parameter of blocktype Slider: (see also documentation of the used jquery slider plugin)
Params of blocktype "dropdown"/"select_multiple":
block_type="select_multiple" is set. (Default is number of items)Params of blocktype "date":
Params of blocktype "multi_input":
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}
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 © 2010-2012, 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.