joomla > 笔记1
**?在TITLE?后加网站名字
在?<jdoc:include?type="head"?/>之前加進:
?<?php$mydoc?=&?JFactory::getDocument();
$mytitle?=?$mydoc->getTitle();?
$conf?=&?JFactory::getConfig();
$sitename?=?$conf->getValue('config.sitename');?//取得網站名稱?
$mydoc->setTitle($mytitle.'?-?'.$sitename);
?>
**??列表查询
?
$db->setQuery("SELECT?*?FROM??`jos_users`?WHERE??`block`?=0??AND??`gid`?=24");
$q_user=$db->loadObjectList();
foreach($q_user?as?$q_user_list){
echo?$q_user_list->name.'<BR>';
}
**??用户注册
?
$db**?获取?新?插入?ID
echo?$db->insertid();
?
**?$user?=?&JFactory::getUser();??$user->get('gid')?等于?jos_core_acl_aro_groups??表中的?id,???jos_users?中的gid?即?groups?的IP
**??组件开发?参考?这个地址?http://wenku.baidu.com/view/32cff33383c4bb4cf7ecd167.html
**???JOOMLA??弹出?BOX?
**?module?读取?xml??在?module.php??,?$params->get(?'custom_code'?)
** 输出JOOMLA 跟目录 路径 的常量?JPATH_ROOT ? ??JPATH_ADMINISTRATOR
** 库
$app = JFactory::getApplication();
$app->input->getCmd('Itemid', '');
?
$app = JFactory::getApplication();
$menu = $app->getMenu();
$mytitle = $menu->getActive(); ?//输出当前页相关属性
$menu->setActive(627); $menu->setActive($_REQUEST['Itemid']); //设置当前Item
$site_name = $app->getCfg('sitename');
?
** 跳转到登录 再 跳转
123$app
?= JFactory::getApplication();
?$app
->redirect(JRoute::_(
'index.php?option=com_users&view=login&return='
.
base64_encode
(JRoute::_(
'index.php?option=com_joomfaq&view=category'
)), false),?
'请先登录'
);
?
** 网站 主域名?JURI::base()
** 修改 configuation.php?
123456789101112131415161718192021222324252627282930313233343536$config
?= JFactory::getConfig();
$config
->set(
'joom_faq_need_check'
,?
'3333'
);
writeConfigFile(
$config
);
function
?writeConfigFile(JRegistry?
$config
)
{
????
jimport(
'joomla.filesystem.path'
);
????
jimport(
'joomla.filesystem.file'
);
?????
// Set the configuration file path.
????
$file
?= JPATH_CONFIGURATION .?
'/configuration.php'
;
?????
// Get the new FTP credentials.
????
$ftp
?= JClientHelper::getCredentials(
'ftp'
, true);
?????
// Attempt to make the file writeable if using FTP.
????
if
?(!
$ftp
[
'enabled'
] && JPath::isOwner(
$file
) && !JPath::setPermissions(
$file
,?
'0644'
))
????
{
????
JError::raiseNotice(
'SOME_ERROR_CODE'
, JText::_(
'COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'
));
????
}
?????
// Attempt to write the configuration file as a PHP class named JConfig.
????
$configuration
?=?
$config
->toString(
'PHP'
,?
array
(
'class'
?=>?
'JConfig'
,?
'closingtag'
?=> false));
????
if
?(!JFile::write(
$file
,?
$configuration
))
????
{
????
$this
->setError(JText::_(
'COM_CONFIG_ERROR_WRITE_FAILED'
));
????
return
?false;
????
}
?????
// Attempt to make the file unwriteable if using FTP.
????
if
?(!
$ftp
[
'enabled'
] && JPath::isOwner(
$file
) && !JPath::setPermissions(
$file
,?
'0444'
))
????
{
????????
JError::raiseNotice(
'SOME_ERROR_CODE'
, JText::_(
'COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'
));
????
}
?????
return
?true;
}