Yii Framework Forum: Best Way To Define Params For A Widget? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Best Way To Define Params For A Widget? Rate Topic: -----

#1 User is offline   darkheir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 25-July 11

Posted 18 December 2012 - 06:03 PM

Hi,

I'm creating a widget where there will be 2 types of params:
- The one that can change depending on where we call the widget, those one will be defined in the widget call:

<?php $this->widget('ext.myWidget', array(
    'someParams' => 'someValues',
)); ?>


- The one that are the same for all the call to the widget (a path to a library, a place to save an image, ...)

I would like to know what is the best way to define the second type of parameters.
I'm hesitating between making the user define it in the params array in the config file or defining it in an array in the Widget file. The main advantage of the first option is that the user won't have to modify the Widget file so in case of update his modifications won't be overwritten, but this is not a specific user params so putting it in the parmas array in config file might seem strange.

So what would be the best solution? If there is another one better thant the 2 above please tell me!
My blog (in french) => http://blog.devsa.org
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,041
  • Joined: 16-February 11
  • Location:Japan

Posted 19 December 2012 - 02:06 AM

I would make them configurable parameters, but with some decent default values. :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users