module - Trying to get params from list in joomla -


i have joomla 3 module. works great. want add parameters in administration section can use in tmpl->default.php file, i'm struggling find out how it.

i have in xml file:

<config>     <fields name="params">         <fieldset name="basic">             <field             name="show_category"             type="list"             label="what display"             description="what display"             default="">                 <option value="0">day/time/event</option>                 <option value="1">day/time/event/description</option>             </field>         </fieldset>     </fields> </config> 

and in default.php file:

<?php defined('_jexec') or die;      $module = jmodulehelper::getmodule('mod_calendar_ajax_google');     $moduleparams = new jregistry();     $moduleparams->loadstring($module->params);     $param = $moduleparams->get('show_category', '');      $dashboardid =  $param['show_category']; 

but doesn't work.

better not call params directly in default.php file rather can call params in mod_calendar_ajax_google.php file this

$category = $params->get('show_category','day/time/event'); 

this give name if set in options, else gives default value day/time/event.

to call in default.php file, can directly call $category. hope made myself clear.

if @ need call param directly anywhere in joomla need remove last line. should this

$module = jmodulehelper::getmodule('mod_calendar_ajax_google'); $moduleparams = new jregistry(); $moduleparams->loadstring($module->params); $dashboardid = $moduleparams->get('show_category', ''); 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -