Những gì tôi khuyên bạn nên làm là tạo một tập lệnh cài đặt thực thi một postflightchức năng. Chức năng này được tích hợp vào Joomla và sẽ được thực thi sau khi tiện ích mở rộng đã được cài đặt.
Bạn có thể sử dụng một cái gì đó như thế này:
function postflight($type, $parent)
{
// We only need to perform this if the extension is being installed, not updated
if (strtolower($type) === 'install')
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$fields = array(
$db->quoteName('enabled') . ' = 1',
$db->quoteName('ordering') . ' = 9999'
);
$conditions = array(
$db->quoteName('element') . ' = ' . $db->quote('plg_myplugin'),
$db->quoteName('type') . ' = ' . $db->quote('plugin')
);
$query->update($db->quoteName('#__extensions'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
Để biết thêm thông tin về tệp tập lệnh, hãy đọc Tài liệu Joomla:
http://docs.j Joomla.org/J2.5:Managing_Component_Updates_(Script.php)
Hi vọng điêu nay co ich
1và9999là số nguyên và không cần đúc kiểu;)