Managed text blocks
This chapter explains how to create small manageable blocks of text outside main content area.
1 STEP - create parameter
- Log in to administration panel
- Open tab Developer -> Modules config
- Select "Configuration" on the left
- Press yellow icon near "Translations" on the right (you can create new group for your parameters also)
Here you see default parameter "copyright" and maybe some other parameters of your theme. You need to create new parameter. Press "New record" and insert data for your new parameter:
- Name - any name you like
- Key - unique identifier without special characters of spaces (will be used in PHP code)
- Value - select type of parameter. Usually "wysiwyg languages". "Languages" means that it will have different values for each language. Next to this field will appear appropriate value field. Enter required text.
- Admin - leave unchecked. Checking this box means that this parameter can be managed only in Developer -> Configuration tab. Leaving it unchecked enables management from Standard -> Configuration.
Press "Save".
Display parameter on the website
Open layout file in your theme (eg. ip_themes/ip_default/main.php) and add one of the following lines where you like the new text to appear:
<?php
//just display the value
echo $parametersMod->getValue('standard', 'configuration','translations','parameter_key');
//make this text manageable directly on the website
echo $parametersMod->generateManagement('standard', 'configuration','translations','parameter_key');
?>
Example
Default theme of ImpressPages CMS uses this technique to edit copyright notice at the bottom left corner. Open ip_themes/ip_default/main.php and look at the end of the file.
The only difference that it uses "string" type instead of "wysiwyg". That's why copyright is only one line of text. If you create your parameter as "wysiwyg languages" then rich text editor will appear.
Write a comment
You must be logged in to comment.