Recent Topics

Call a $param to display into SkinBeginHtmlHead( & $para

Started by on Jun 11, 2011 – Contents updated: Jun 11, 2011

Jun 11, 2011 04:27    

Hi, Can you please give me some direction please? I am developing this plugin and all works well, except I am not successful to display a setting in SkinBeginHtmlHead( & $params ) specified in my get_widget_param_definitions( $params )

here is a sample:

PHP

function get_widget_param_definitions$params )
    {
        return array(
 
        'theme' => array(
                'label' => $this->T_('theme'),
                'note' => $this->T_('Modify this option with the desired theme name'),
                'type' => 'select',
                'options' => array'default' => 'default''metallic' => 'metallic' ),
                'defaultvalue' => 'true'
            ),
        );
    }
 
 
 
 
 
    function SkinBeginHtmlHead( & $params )
                            {      global $Plugins$plugins_url;                            
                                
                                $comm_start '<!-- Start plugin -->';
                                $comm_end '<!-- End plugin -->';
                                
                                $jvscode '
                                            
jQuery.noConflict();
            (function($) {
    $(function () {
        $("#theme").theme({
        
[b]theme : "'.$params['theme'].'",[/b]
 
 
        });
 
          });
            })(jQuery);';
                                
                            
                                $plug_url $this->get_plugin_url();
                                
                                                                
                                require_js$plug_url 'js/demo.js'true );
                                add_headline$comm_start );
                                add_js_headline$jvscode );
                                add_headline$comm_end );
                                                        
                                
                                return true;
                            }
}

When this code is rendered in the browser everything works except theme shows up empty-> theme : ""

Any ideas for me please? Thanks.

Jun 13, 2011 20:49

PHP

'defaultvalue' => 'true'

This value should be the one defined in options.

I believe you can only use "get_widget_param_definitions" in widget context e.g. when called from SkinTag hook. You specify widget params there.

All global params should go in "GetDefaultSettings"

PHP

/**
 * Define settings that the plugin uses/provides.
 */
function GetDefaultSettings()
{
    return array();
}

In your case you can simply rename "get_widget_param_definitions" to "GetDefaultSettings" and then replace $params['theme'] with

PHP

$this->Settings->get('theme')


Form is loading...

Advanced CMS – This forum is powered by b2evolution CMS, a complete engine for your website.