back to Modules

Custom Global Settings

Contents


The Custom Global Settings Project Page

Current version: 1.2


Module Help

What Does This Do?

This module extends the Global Settings with some customized parameters. You can define an unlimited number of fields which can be used as smarty-variable in templates or pages.


How Do I Use It

To start you have to add {CustomGS} in the top of your template(s).

In the templates or pages of your website you will now have all smarty variables available that are defined in the Custom Global Settings module Fielddefinitions tab. The exact way to call each variable is shown in the fielddefinitions table. You can also check which variables and values are available by placing {CustomGS showvars=1} in the content field of a page.

Warning: better not place the {CustomGS} tag in the <head> section of your template, because that's the last section that will be parsed by the Smarty templating system.


Permissions

This module provides two different permission groups:

1. Custom Global Settings - Use A permission to use for editors. It will only show the General tab in the admin page.

2. Custom Global Settings - Manage A permission to use for administrators. It will show all module tabs.


Examples

1. Change frontend theme Define a checkbox 'Christmas now' which will activate a special theme on the frontend when checked

{if $CustomGS.Christmas_now == '1'}
 {* Show Christmas frontend theme *}
{else}
 {* Show default frontend theme *}
{/if}

2. Magic with a checkbox Define a checkbox 'MyCheckbox' which will do some magic stuff when unchecked

{if $CustomGS.MyCheckbox != '1'}
 {* Do some magic stuff *}
{/if}

3. Show current trainer Define a textfield or pulldown field 'Trainer' which will contain the current trainers name.

<p>This weeks trainers name is: {$CustomGS.Trainer}</p>

4. Display page content only in a specific timeframe Define two timepicker fields 'starttime' and 'endtime'. Replace the {content} tag in your page template with this code and the normal page content is only visible when the current time is between the starttime and endtime.

{if $smarty.now|date_format:'%H:%M' >= $CustomGS.starttime && $smarty.now|date_format:'%H:%M' <= $CustomGS.endtime}
 {content}
{else}
 {content block="SiteClosedContent"}
{/if}

5. Change frontend color Create a Radiobutton group named "textcolor" Properties value:

#ff0000|red
#00f|blue
#101010|almost black

Also click the checkbox 'Clear Cache'. This will automatically clear the site cache after a changing this setting. This is necessary because the stylesheet is cached.

Add to the top of your stylesheet:

[[CustomGS]]

To change for example the color of the p-text add:

p {
 color: [[$CustomGS.textcolor]];
}

6. Pulldown for Featured Newsarticle Define a pulldown field that contains the titles of articles from the News module, so the user can choose a featured article which can be displayed on a special section on the site.

First create a new summarytemplate in the News module, named "CustomGS_pulldown" with the following content:

{foreach from=$items item=entry}
{$entry->id}|{$entry->title}
{/foreach}

Then define a new field in the Custom Global Settings module

  • Name: Featured News
  • Type: Pulldown
  • Properties: {news summarytemplate='CustomGS_pulldown'}

Finally put this tag in your page template to display the featured newsarticle:

{news action='detail' articleid=$CustomGS.Featured_News}


Parameters

(optional) showvars="1" - Set this parameter to show all available variables and their values. For testing purposes only.


Troubleshooting

Smarty error

Error: Smarty error: [in temporary template line 4]: [plugin] unknown tag...

Solution: You probably have entered curly bracket { } signs in the properties field of a pulldown or radiobutton fielddefinition. These are interpreted by Smarty. Delete them, or use {literal} {/literal} tags.

Other Errors

Error: My problem was not described here.

Solution: Set Debug to 'true' in config.php and see if any error messages appear. Look also for error messages in the html sourcecode. Maybe the error message tells you enough to solve the issue yourself. Someone else may have encountered the same problem before you, so you could also search the CMSms forum for possible solutions. If you haven't found any related topics, please feel free to open a new forumtopic.



back to Modules


This page in: English - Deutsch - Español - Français - Italiano - Lietuvių - Nederlands - Norsk - Polski - Česky - Русский - Svenska - Tiếng Việt - عربي - 日本語 简体中文

User Handbook/Admin Panel/Extensions/CustomGlobalSettings

From CMSMS

Arvixe - A CMSMS Partner