Hi People
I call Preferences from a module made with CTLModuleMaker 2.0.3
For example I want to call a setting for somepref in my templace
I tried
{$this->GetPreference('somepref')} and got a error
{$this->GetPreference->somepref} not worked.
I would like show the valuable in my template and do a If valuable not blank print some text.
Sorry about my english. Hope someone can help.
Cheers
Get Preferences from a module [solved]
-
- Forum Members
- Posts: 127
- Joined: Fri Nov 28, 2008 10:28 pm
Get Preferences from a module [solved]
Last edited by andrewvideo on Thu Jun 02, 2011 10:46 pm, edited 1 time in total.
Re: I Get Preferences from a module made with CTLModuleMaker
Hi Andrew,
I think this is what you want:
Where 'prefName' is the name of the module variable you wish to call.
You can also do it like this:
/m
I think this is what you want:
Code: Select all
{if $item->prefName != ''}
{$item->prefName}
{else}
Pref Name Empty
{/if}
You can also do it like this:
Code: Select all
{if isset($item->prefName)}
{$item->prefName}
{else}
Pref Name Empty
{/if}
-
- Forum Members
- Posts: 127
- Joined: Fri Nov 28, 2008 10:28 pm
Re: I Get Preferences from a module made with CTLModuleMaker
Hi,
That dint work. I think that is only for the item entry.
I think there is a tag for it so you can all call any Preferences from any module.
I can see the entry in the sitepref in the datebase i want get the value.
Do anyone know how to do this?
Cheeers
That dint work. I think that is only for the item entry.
I think there is a tag for it so you can all call any Preferences from any module.
I can see the entry in the sitepref in the datebase i want get the value.
Do anyone know how to do this?
Cheeers
Re: I Get Preferences from a module made with CTLModuleMaker
Hi,
I think you need to make a User Defined Tag to get those values (as opposed to calling them directly with smarty).
Perhaps:
As a user defined tag might work.
What's the specific preference you are after?
/m
I think you need to make a User Defined Tag to get those values (as opposed to calling them directly with smarty).
Perhaps:
Code: Select all
global $gCms;
$prefName = get_site_preference('prefName');
return $prefName;
What's the specific preference you are after?
/m
-
- Forum Members
- Posts: 127
- Joined: Fri Nov 28, 2008 10:28 pm
Re: I Get Preferences from a module made with CTLModuleMaker
Thank you very much that did the job.
I want to read settings for my Module I made.
Thank you
I want to read settings for my Module I made.
Thank you
Re: Get Preferences from a module [solved]
You're very welcome Andrew.
Glad it worked. Happy coding!
/m
Glad it worked. Happy coding!
/m