Martedì 07 Febbraio 2012


scriptaculous_logo Nuovo template per joomla creato ad hoc per replicare un sito già esistente...tutto bene fino a che non ho dovuto re-implementare i vari effetti javascript realizzati con prototype e scriptaculous. Joomla monta di default un framework javascript molto potente e completo chiamato mootools ma che ha il brutto difetto di andare in conflitto con eventuali altri framework. E' stato quindi necessario rimuovere mootools dal nuovo template per far funzionare tutto come prima; ecco il codice da aggiungere nella "head" del proprio template per poter raggiungere il risultato:

<?php
$menu = &JSite::getMenu();
$view = JRequest::getVar('view');
$homepage = ($menu->getActive() == $menu->getDefault()
&& $view == 'frontpage');
$user =& JFactory::getUser();
$head = $this->getHeadData();
if (($homepage || ($view == 'category')) && ($user->get('guest')
== 1 || $user->usertype == 'Registered')){
foreach($head['scripts'] as $key => $value){
if(preg_match('/mootools/', $key)) unset($head['scripts'][$key]);
if(preg_match('/caption/', $key)) unset($head['scripts'][$key]);
}
}
$this->setHeadData($head);
?>
<jdoc:include type="head" />