Php 如何在joomla中通过数据库修改模板参数
我想通过joomla框架外的数据库修改当前模板参数。我设法设置了“预设”参数,但无法将其写回数据库。这是我的密码 非常感谢Php 如何在joomla中通过数据库修改模板参数,php,templates,joomla,Php,Templates,Joomla,我想通过joomla框架外的数据库修改当前模板参数。我设法设置了“预设”参数,但无法将其写回数据库。这是我的密码 非常感谢 // Initialize The Joomla Framework // ----------------------------------------------------------------------------------- define('_JEXEC', 1); // this is relative to the current script, s
// Initialize The Joomla Framework
// -----------------------------------------------------------------------------------
define('_JEXEC', 1);
// this is relative to the current script, so change this according to your environment
define('JPATH_BASE', '/home/kristof/public_html/joomla1');
define('DS', DIRECTORY_SEPARATOR);
// Require Joomla libraries
require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php');
require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php');
require_once(JPATH_CONFIGURATION . DS . 'configuration.php');
require_once(JPATH_LIBRARIES . DS . 'joomla' . DS . 'database' . DS . 'database.php');
require_once(JPATH_LIBRARIES . DS . 'import.php');
// -----------------------------------------------------------------------------------
$app = JFactory::getApplication('site');
$template = $app->getTemplate(true);
$param=$template->params->set('preset','preset3');
$template = JFactory::getApplication('site')->getTemplate();
$db = JFactory::getDBO();
$sql = "select params from #__template_styles where template = ".$db->quote($template);
$db->setQuery($sql);
$params = json_decode($db->loadResult());
$params->PARAM_NAME= PARAM_VALUE;
$sql = "update #__template_styles set params = ".$db->quote(json_encode($params))." where template = ".$db->quote($template);
$db->setQuery($sql);
return $db->query();