Constante :
echo dirname(__FILE__).DS;
=> E:\tmp\joomla2\modules\mod_gmapsearch\tmpl\
echo JURI::base().'modules/'.$module->module
=> http://localhost/tmp/joomla2/modules/mod_gmapsearch
Créer un composant :
Très bon article mais 1.5
http://dev.joomla.fr/tutoriels/item/56-creation-dun-composant-mvc-hello-world
Composant 2.5
http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!2.5
http://tutoriels-joomla.joomlack.fr/tutoriels-joomla/tutoriels-developpement/creer-un-module.html
Afficher des variables joomla dans le template
http://tutoriels-joomla.joomlack.fr/tutoriels-joomla/tutoriels-de-template/14-astuces-templates-joomla16.html
http://docs.joomla.org/JModuleHelper/getModule
http://docs.joomla.org/JSite
A LIRE ABSOLUMENT :
http://api.joomla.fr/joomla15/d2/df1/classJSite.html
La catégorie du menu n'est pas dans le SQL
setQuery($query);
/* Récuperer la configuration */
echo '
';
echo '
Affichage de la configuration :
';
$config = JFactory::getConfig();
$user = '
'.$config->get('user', '');
$prefix = '
'.$config->get('dbprefix', '');
$password = '
'.$config->get('password', '');
$db = '
'.$config->get('db', '');
$host = '
'.$config->get('host', '');
echo $user;
echo $prefix;
echo $password;
echo $db;
echo $host;
/* Lecture d'une ligne donnée */
echo '
';
echo 'Affiche le titre de l\'article :
';
$db = JFactory::getDBO();
$db->setQuery('SELECT title FROM #__content WHERE id = 20');
$title = $db->loadResult();
print_r($title);
/* Lecture d'une table */
echo '
';
echo 'Affiche les données d\'une table :
';
$query = 'select title, alias, introtext FROM #__content WHERE state = 1 AND catid = 64';
$db->setQuery((string)$query);
$rows = $db->loadObjectList();
print_r($rows);
?>
/***** Données de formulaires *****/
JRequest::getString('url', '');
JRequest::getVar('return', null, 'default', 'base64');
JRequest::getBool
/***** Détection de la home *****/
// Detecting Home
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
$siteHome = 1;
echo "c la home";
}else{
$siteHome = 0;
echo "c pas la home";
}
/***** Détection getParams *****/
$test = JSite::getParams();
print_r($test);
/***** Détection getPathWay *****/
$test = JSite::getPathWay();
print_r($test);
=> Affiche les ID .i.e: index.php?Itemid=177 (numéro du menu principal)
/***** Détection getRouter *****/
Affiche des infos type :
JRouterSite Object ( [mode:protected] => [_mode:protected] => 1 [vars:protected] => Array ( ) [_vars:protected] => Array ( [Itemid] => 185 [option] => com_hikashop ) [rules:protected] => Array ( [build] => Array ( ) [parse] => Array ( ) ) [_rules:protected] => Array ( [build] => Array ( ) [parse] => Array ( ) ) [_errors:protected] => Array ( ) )
/***** Détection getRouter *****/