Joomla 3.x 如果使用代码修改组件的参数
今天再做微信同步组件的时候,遇到一个问题需要动态的修改组件的参数。我感觉这是一个通用的问题,就看了一下代码。最后得到解决方案
代码如下:
希望对其他的朋友能有所帮助
代码如下:
$params = JComponentHelper::getParams("com_zmaxwechat");
$params->set('show_newsqueue_msg', 0);
$componentid = JComponentHelper::getComponent('com_zmaxwechat')->id;
$table = JTable::getInstance('extension');
$table->load($componentid);
$table->bind(array('params' => $params->toString()));
if (!$table->check())
{
$ajaxData->setError($table->getError());
}
if (!$table->store())
{
$ajaxData->setError($table->getError());
}
希望对其他的朋友能有所帮助