Vi ripropongo il mio problema ovvero quello di aggiungere le acceskeys ai menu standard di Joomla 3.0
Per ora ho fatto così:
ho creato una variabile globale nel file index.php
<?php /** * @copyright Copyright (C) 2012 AJoomlaTemplates.com - All Rights Reserved. '<div id="menu-icon">Menu<>' **/ defined( '_JEXEC' ) or die( 'Restricted access' );
$jquery = $this->params->get('jquery');
$scrolltop = $this->params->get('scrolltop');
$superfish = $this->params->get('superfish');
$logo = $this->params->get('logo');
$logotype = $this->params->get('logotype');
$sitetitle = $this->params->get('sitetitle');
$sitedesc = $this->params->get('sitedesc');
$app = JFactory::getApplication();
$doc = JFactory::getDocument();
$templateparams = $app->getTemplate(true)->params;
global $index;
$index = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
<jdoc:include type="head" />
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>
<?php include "functions.php"; ?>
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"/>
Poi ho modificato i file default.php e dafault_component.php che stanno nella cartella mod_menu del template da me usato:
default.php
<?php
/**
* @package Joomla.Site
* @subpackage mod_menu
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
// Note. It is important to remove spaces between elements.
?>
<ul class="menu<?php echo $class_sfx;?>"<?php
$tag = '';
if ($params->get('tag_id')!=NULL) {
$tag = $params->get('tag_id').'';
echo ' id="'.$tag.'"';
}
?>>
<?php
$access_index = $index;
foreach ($list as $i => &$item) :
$class = 'item-'.$item->id;
if ($item->id == $active_id) {
$class .= ' current';
}
if (in_array($item->id, $path)) {
$class .= ' active';
}
elseif ($item->type == 'alias') {
$aliasToId = $item->params->get('aliasoptions');
if (count($path) > 0 && $aliasToId == $path[count($path)-1]) {
$class .= ' active';
}
elseif (in_array($aliasToId, $path)) {
$class .= ' alias-parent-active';
}
}
if ($item->deeper) {
$class .= ' deeper';
}
if ($item->parent) {
$class .= ' parent';
}
if (!empty($class)) {
$class = ' class="'.trim($class) .'"';
}
$access_index = $access_index+1;
echo '<li'.$class.'>';
// Render the menu item.
switch ($item->type) :
case 'separator':
case 'url':
case 'component':
require JModuleHelper::getLayoutPath('mod_menu', 'default_'.$item->type);
break;
default:
require JModuleHelper::getLayoutPath('mod_menu', 'default_url');
break;
endswitch;
// The next item is deeper.
if ($item->deeper) {
echo '<ul>';
}
// The next item is shallower.
elseif ($item->shallower) {
echo '</li>';
echo str_repeat('</ul></li>', $item->level_diff);
}
// The next item is on the same level.
else {
echo '</li>';
}
endforeach;
?></ul>
default_component.php
<?php
/**
* @package Joomla.Site
* @subpackage mod_menu
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
// Note. It is important to remove spaces between elements.
$class = $item->anchor_css ? 'class="'.$item->anchor_css.'" ' : '';
$title = $item->anchor_title ? 'title="'.$item->anchor_title.'" ' : '';
if ($item->menu_image) {
$item->params->get('menu_text', 1 ) ?
$linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" /><span class="image-title">'.$item->title.'</span> ' :
$linktype = '<img src="'.$item->menu_image.'" alt="'.$item->title.'" />';
}
else { $linktype = $item->title;
}
switch ($item->browserNav) :
default:
case 0:
?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" accesskey="<?php $access_index; ?>" <?php echo $title; ?>><span class="menutitle" ><?php echo $linktype; ?></span> <span class="menudesc"><?php echo $item->anchor_title; ?></span></a><?php
break;
case 1:
// _blank
?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" accesskey="<?php $access_index; ?>" target="_blank" <?php echo $title; ?>><span class="menutitle"><?php echo $linktype; ?></span> <span class="menudesc"><?php echo $item->anchor_title; ?></span></a><?php
break;
case 2:
// window.open
?><a <?php echo $class; ?>href="<?php echo $item->flink; ?>" accesskey="<?php $access_index; ?>" onclick="window.open(this.href,'targetWindow','toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');return false;" <?php echo $title; ?>><span class="menutitle"><?php echo $linktype; ?></span> <span class="menudesc"><?php echo $item->anchor_title; ?></span></a>
<?php
break;
endswitch;?>
Adesso non stampa nulla, come se non venisse passato il valore delle variabili, altre volte che avevo provato a modificare il codice stampava per tutti i menu la solita serie di numeri, ripartendo da 1, rendendo inutilizzabili le acceskeys perché si sovrapponevano l' un l'altra.
Spero che qualcuno mi aiuti a risolvere questo problema.