我正在进行Joomla 3组件编辑。现在我遇到了一个问题:当我安装组件时,在我保存组件的配置之前它不起作用。
在我的情况下,我的模型获取项目,检查他们的参数,如果没有,它应该传递全局值。但在保存我的组件配置之前,它没有采用它的值,因为它们尚未保存在数据库中。
答案 0 :(得分:2)
1.如何通过安装将默认值保存到数据库? (组件配置 - >默认参数)
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.这是在模型中做到这一点的正确方法吗? (更改视图模型中的参数..)
您可以使用默认"值键#34;
<field name="dbname" type="text" default="" label="Name" description="name" />