New Module Custom Global Settings

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

New Module Custom Global Settings

Post by Rolf »

The Custom Global Settings 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.

The initial module (with limited options) was created by me, but *Gallery* Jos will continue the development of this module! Jos already added some new features, making it a very flexible and versatile module.

In the Custom Global Settings module Fielddefinitions tab you can define several field definitions. In the templates or pages of your website you will have all smarty variables available!
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.

Available fielddefinitions
- Textfield
- Pulldown
- Checkbox
- Radiobutton group
- Datepicker
- DateTimepicker
- Timepicker
- Text Area
- WYSIWYG Area
- Button

Some examples
Start with adding the moduletag in the top of your template

Code: Select all

{CustomGS}
Define a checkbox 'Christmas now' which will activate a special theme on the frontend when checked.

Code: Select all

{if $CustomGS.Christmas_now == '1'}
     {* Show Christmas frontend theme *}
{else}
     {* Show default frontend theme *}
{/if}
Define a checkbox 'MyCheckbox' which will do some magic stuff when unchecked

Code: Select all

{if $CustomGS.MyCheckbox != '1'}
     {* Do some magic stuff *}
{/if}
Define a textfield or pulldown field 'Trainer' which will contain the current trainers name.

Code: Select all

<p>This weeks trainers name is: {$CustomGS.Trainer}</p>
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.

Code: Select all

{if $smarty.now|date_format:'%H:%M' >= $CustomGS.starttime && $smarty.now|date_format:'%H:%M' <= $CustomGS.endtime}
     {content}
{else}
     {content block="SiteClosedContent"}
{/if}
Upgrading? The way smarty variables should be called has changed. If you upgrade from 1.0 you have to rename the smarty variables in your templates or pages

Have fun!!

Jos & Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: New Module Custom Global Settings

Post by Jo Morg »

Looks great! I needed something like this a few ears back. :D
Another tool on the web-designer sleeve. Can't wait to try it.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: New Module Custom Global Settings

Post by Rolf »

Change color on the frontend
Another option of the Custom Global Settings module, with a little imagination...

Option 1, Page or template
Create a Dropdown named "textcolor"
Values:
red|Red
blue|Blue
#000|Black
Because the stylesheets are cached, you need to clear the cache after each change. Check the checkbox "Clean cache"

Put in your page or template:

Code: Select all

{CustomGS}
<p style="color:{$CustomGS.textcolor}">Lorem Ipsum</p>
Option 2, Stylesheet
Add in the top of your stylesheet:

Code: Select all

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

Code: Select all

p {
color: [[$CustomGS.textcolor]];
}
Grtz. Rolf
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: New Module Custom Global Settings

Post by Wishbone »

Very nice!! I was about 30% into coding something similar (AdvancedGlobalContent), which presented a bunch of GCBs of different types (text, checkbox, etc) and had tab support, but stopped because I found another way

I currently put a bunch of content blocks in the template called 'settings', either using AdvancedContent or CGContentUtils, and have the user edit the fields in the 'settings' page that uses the 'settings' template... The values can easily be accessed through CGSimpleSmarty..

I'll check out your module.. Sounds fantastic!
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: New Module Custom Global Settings

Post by Rolf »

Thanks Wishbone
But the most credits go to Jos now! ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: New Module Custom Global Settings

Post by Jos »

A new version of Custom Global Settings is just released.

Changelog:
- Minimum required CMSms version set to 1.10
- Add GetAdminSection setting (FR #7618)
- Added option to automatically clear cache after changing a setting
- Added fieldtype 'Button'
- Support Value|OptionName pairs and Smarty tags for pulldown fields and radiobuttons
- Bug fixed: Editing a field changes the fieldname
- Bug fixed: SendEvent on changing a checkbox setting

Also created a Wiki page in the CMSms documentation at http://wiki.cmsmadesimple.org/index.php ... alSettings
User avatar
requish
Forum Members
Forum Members
Posts: 183
Joined: Sat Jan 24, 2009 3:12 pm

Re: New Module Custom Global Settings

Post by requish »

This module is AWESOME! Thanks to You very much!!!
Post Reply

Return to “Modules/Add-Ons”