Search code examples
joomlajoomla3.0joomla-extensions

How to directly access the default param values in Joomla components?


I'm going through the Joomla 3 component editing. Now I'm kind of stuck with a problem: When I install my component, it doesn't work until I saved my component's configuration.
In my case, my model's getting items, checking for their params, and if there are none, it should pass the global values in there. But before saving my components configuration, it doesn't take it's values, as they haven't been saved in the database.

  1. How to accomplish that the default values are saved to the db by installation? (Component Config->Default Params)
  2. Is this a proper way to do it in the model? (Changing the params in the model for the view..)


Solution

  • 1.How to accomplish that the default values are saved to the db by installation? (Component Config->Default Params)

    Please read it below link
    https://docs.joomla.org/J2.5:Managing_Component_Updates_(Script.php)
    find the string "The entire script.php file" inside the file
    use the method of " function setParams($param_array) {..} " 
    

    2.Is this a proper way to do it in the model? (Changing the params in the model for the view..)

    you can use the default "key of value"

    <field name="dbname" type="text" default="" label="Name" description="name" />