Visualizzazione dei risultati da 1 a 10 su 10
  1. #1

    Aggiungere freccette voce menu

    Salve, prima di chiedere un aiuto vi spiego bene cosa stò facendo:
    allora,stò creando un template in joomla e ho adattato un menu css che avevo al template,
    è un menu orizzontale con 3 livelli, ora mi servirebbe un aiuto per dire al menu che quando in na voce del menu ci sono dei sotto menu di aggiungerci affianco delle freccette per far capire ovviamente al visitatore del sito che in quella voce del menu ci sono dei sotto menu.

    Sicuramente sarà una sola riga di codice in php, ma solo ora stò iniziando a studiarlo e quindi a me risulterebbe difficile quello che a qualcuno di voi è una cosa banale.

    Spero di essere stato chiaro.

    grazie.

    P.S.
    per capire di che stò parlando potete vedere qui
    si vede il menu in fase di realizzazione , per esempio nella voce "contattaci" ci dovrebbero essere delle freccette ( >> ) oppure se è possibile un'immagine, perchè contiene un sotto menu.

  2. #2
    Moderatore di PHP L'avatar di Alhazred
    Registrato dal
    Oct 2003
    Messaggi
    12,505

    Re: Aggiungere freccette voce menu

    Originariamente inviato da albyxt
    ...
    Sicuramente sarà una sola riga di codice in php, ma solo ora stò iniziando a studiarlo e quindi a me risulterebbe difficile quello che a qualcuno di voi è una cosa banale.
    ...
    Il problema è che non siamo maghi, se non ci fai vedere il codice col quale generi il menu è impossibile dirti come intervenire.

  3. #3

    Re: Re: Aggiungere freccette voce menu

    Originariamente inviato da Alhazred
    Il problema è che non siamo maghi, se non ci fai vedere il codice col quale generi il menu è impossibile dirti come intervenire.
    Allora se parli del codice php quello è contenuto in un file del modulo "mod_mainmenu" di joomla, ce ne sono 3:



    mod_mainmenu.php

    Codice PHP:
    <?php

    /**

    * @version        $Id: mod_mainmenu.php 14401 2010-01-26 14:10:00Z louis $

    * @package        Joomla

    * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.

    * @license        GNU/GPL, see LICENSE.php

    * Joomla! is free software. This version may have been modified pursuant

    * to the GNU General Public License, and as distributed it includes or

    * is derivative of works licensed under the GNU General Public License or

    * other free or open source software licenses.

    * See COPYRIGHT.php for copyright notices and details.

    */



    // no direct access

    defined('_JEXEC') or die('Restricted access');



    // Include the syndicate functions only once

    require_once (dirname(__FILE__).DS.'helper.php');



    $params->def('menutype',             'mainmenu');

    $params->def('class_sfx',             '');

    $params->def('menu_images',         0);

    $params->def('menu_images_align',     0);

    $params->def('expand_menu',         0);

    $params->def('activate_parent',     0);

    $params->def('indent_image',         0);

    $params->def('indent_image1',         'indent1.png');

    $params->def('indent_image2',         'indent2.png');

    $params->def('indent_image3',         'indent3.png');

    $params->def('indent_image4',         'indent4.png');

    $params->def('indent_image5',         'indent5.png');

    $params->def('indent_image6',         'indent.png');

    $params->def('spacer',                 '');

    $params->def('end_spacer',             '');

    $params->def('full_active_id',         0);



    // Added in 1.5

    $params->def('startLevel',             0);

    $params->def('endLevel',             0);

    $params->def('showAllChildren',     0);



    require(
    JModuleHelper::getLayoutPath('mod_mainmenu'));

  4. #4
    il secondo

    helper.php

    Codice PHP:

    <?php

    /**

    * @version        $Id: helper.php 14401 2010-01-26 14:10:00Z louis $

    * @package        Joomla

    * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.

    * @license        GNU/GPL, see LICENSE.php

    * Joomla! is free software. This version may have been modified pursuant

    * to the GNU General Public License, and as distributed it includes or

    * is derivative of works licensed under the GNU General Public License or

    * other free or open source software licenses.

    * See COPYRIGHT.php for copyright notices and details.

    */



    // no direct access

    defined('_JEXEC') or die('Restricted access');





    jimport('joomla.base.tree');

    jimport('joomla.utilities.simplexml');



    /**

     * mod_mainmenu Helper class

     *

     * @static

     * @package        Joomla

     * @subpackage    Menus

     * @since        1.5

     */

    class modMainMenuHelper

    {

        function 
    buildXML($params)

        {

            
    $menu = new JMenuTree($params);

            
    $items = &JSite::getMenu();



            
    // Get Menu Items

            
    $rows $items->getItems('menutype'$params->get('menutype'));

            
    $maxdepth $params->get('maxdepth',10);



            
    // Build Menu Tree root down (orphan proof - child might have lower id than parent)

            
    $user =& JFactory::getUser();

            
    $ids = array();

            
    $ids[0] = true;

            
    $last null;

            
    $unresolved = array();

            
    // pop the first item until the array is empty if there is any item

            
    if ( is_array($rows)) {

                while (
    count($rows) && !is_null($row array_shift($rows)))

                {

                    if (
    array_key_exists($row->parent$ids)) {

                        
    $row->ionly $params->get('menu_images_link');

                        
    $menu->addNode($params$row);



                        
    // record loaded parents

                        
    $ids[$row->id] = true;

                    } else {

                        
    // no parent yet so push item to back of list

                        // SAM: But if the key isn't in the list and we dont _add_ this is infinite, so check the unresolved queue

                        
    if(!array_key_exists($row->id$unresolved) || $unresolved[$row->id] < $maxdepth) {

                            
    array_push($rows$row);

                            
    // so let us do max $maxdepth passes

                            // TODO: Put a time check in this loop in case we get too close to the PHP timeout

                            
    if(!isset($unresolved[$row->id])) $unresolved[$row->id] = 1;

                            else 
    $unresolved[$row->id]++;

                        }

                    }

                }

            }

            return 
    $menu->toXML();

        }



        function &
    getXML($type, &$params$decorator)

        {

            static 
    $xmls;



            if (!isset(
    $xmls[$type])) {

                
    $cache =& JFactory::getCache('mod_mainmenu');

                
    $string $cache->call(array('modMainMenuHelper''buildXML'), $params);

                
    $xmls[$type] = $string;

            }



            
    // Get document

            
    $xml JFactory::getXMLParser('Simple');

            
    $xml->loadString($xmls[$type]);

            
    $doc = &$xml->document;



            
    $menu    = &JSite::getMenu();

            
    $active    $menu->getActive();

            
    $start    $params->get('startLevel');

            
    $end    $params->get('endLevel');

            
    $sChild    $params->get('showAllChildren');

            
    $path    = array();



            
    // Get subtree

            
    if ($start)

            {

                
    $found false;

                
    $root true;

                if(!isset(
    $active)){

                    
    $doc false;

                }

                else{

                    
    $path $active->tree;

                    for (
    $i=0,$n=count($path);$i<$n;$i++)

                    {

                        foreach (
    $doc->children() as $child)

                        {

                            if (
    $child->attributes('id') == $path[$i]) {

                                
    $doc = &$child->ul[0];

                                
    $root false;

                                break;

                            }

                        }



                        if (
    $i == $start-1) {

                            
    $found true;

                            break;

                        }

                    }

                    if ((!
    is_a($doc'JSimpleXMLElement')) || (!$found) || ($root)) {

                        
    $doc false;

                    }

                }

            }



            if (
    $doc && is_callable($decorator)) {

                
    $doc->map($decorator, array('end'=>$end'children'=>$sChild));

            }

            return 
    $doc;

        }



        function 
    render(&$params$callback)

        {

            switch ( 
    $params->get'menu_style''list' ) )

            {

                case 
    'list_flat' :

                    
    // Include the legacy library file

                    
    require_once(dirname(__FILE__).DS.'legacy.php');

                    
    mosShowHFMenu($params1);

                    break;



                case 
    'horiz_flat' :

                    
    // Include the legacy library file

                    
    require_once(dirname(__FILE__).DS.'legacy.php');

                    
    mosShowHFMenu($params0);

                    break;



                case 
    'vert_indent' :

                    
    // Include the legacy library file

                    
    require_once(dirname(__FILE__).DS.'legacy.php');

                    
    mosShowVIMenu($params);

                    break;



                default :

                    
    // Include the new menu class

                    
    $xml modMainMenuHelper::getXML($params->get('menutype'), $params$callback);

                    if (
    $xml) {

                        
    $class $params->get('class_sfx');

                        
    $xml->addAttribute('class''menu'.$class);

                        if (
    $tagId $params->get('tag_id')) {

                            
    $xml->addAttribute('id'$tagId);

                        }



                        
    $result JFilterOutput::ampReplace($xml->toString((bool)$params->get('show_whitespace')));

                        
    $result str_replace(array('<ul/>''<ul />'), ''$result);

                        echo 
    $result;

                    }

                    break;

            }

        }

    }



    /**

     * Main Menu Tree Class.

     *

     * @package        Joomla

     * @subpackage    Menus

     * @since        1.5

     */

    class JMenuTree extends JTree

    {

        
    /**

         * Node/Id Hash for quickly handling node additions to the tree.

         */

        
    var $_nodeHash = array();



        
    /**

         * Menu parameters

         */

        
    var $_params null;



        
    /**

         * Menu parameters

         */

        
    var $_buffer null;



        function 
    __construct(&$params)

        {

            
    $this->_params        =& $params;

            
    $this->_root        = new JMenuNode(0'ROOT');

            
    $this->_nodeHash[0]    =& $this->_root;

            
    $this->_current        =& $this->_root;

        }



        function 
    addNode(&$params$item)

        {

            
    // Get menu item data

            
    $data $this->_getItemData($params$item);



            
    // Create the node and add it

            
    $node = new JMenuNode($item->id$item->name$item->access$data);



            if (isset(
    $item->mid)) {

                
    $nid $item->mid;

            } else {

                
    $nid $item->id;

            }

            
    $this->_nodeHash[$nid] =& $node;

            
    $this->_current =& $this->_nodeHash[$item->parent];



            if (
    $item->type == 'menulink' && !empty($item->query['Itemid'])) {

                
    $node->mid $item->query['Itemid'];

            }



            if (
    $this->_current) {

                
    $this->addChild($nodetrue);

            } else {

                
    // sanity check

                
    JError::raiseError500'Orphan Error. Could not find parent for Item '.$item->id );

            }

        }



        function 
    toXML()

        {

            
    // Initialize variables

            
    $this->_current =& $this->_root;



            
    // Recurse through children if they exist

            
    while ($this->_current->hasChildren())

            {

                
    $this->_buffer .= '<ul>';

                foreach (
    $this->_current->getChildren() as $child)

                {

                    
    $this->_current = & $child;

                    
    $this->_getLevelXML(0);

                }

                
    $this->_buffer .= '[/list]';

            }

            if(
    $this->_buffer == '') { $this->_buffer '<ul />'; }

            return 
    $this->_buffer;

        }



        function 
    _getLevelXML($depth)

        {

            
    $depth++;



            
    // Start the item

            
    $rel = (!empty($this->_current->mid)) ? ' rel="'.$this->_current->mid.'"' '';

            
    $this->_buffer .= '<li access="'.$this->_current->access.'" level="'.$depth.'" id="'.$this->_current->id.'"'.$rel.'>';



            
    // Append item data

            
    $this->_buffer .= $this->_current->link;



            
    // Recurse through item's children if they exist

            
    while ($this->_current->hasChildren())

            {

                
    $this->_buffer .= '<ul>';

                foreach (
    $this->_current->getChildren() as $child)

                {

                    
    $this->_current = & $child;

                    
    $this->_getLevelXML($depth);

                }

                
    $this->_buffer .= '[/list]';

            }



            
    // Finish the item

            
    $this->_buffer .= '';

        }



        function 
    _getItemData(&$params$item)

        {

            
    $data null;



            
    // Menu Link is a special type that is a link to another item

            
    if ($item->type == 'menulink')

            {

                
    $menu = &JSite::getMenu();

                if (
    $newItem $menu->getItem($item->query['Itemid'])) {

                    
    $tmp = clone($newItem);

                    
    $tmp->name     '<span><![CDATA['.$item->name.']]></span>';

                    
    $tmp->mid     $item->id;

                    
    $tmp->parent $item->parent;

                } else {

                    return 
    false;

                }

            } else {

                
    $tmp = clone($item);

                
    $tmp->name '<span><![CDATA['.$item->name.']]></span>';

            }



            
    $iParams = new JParameter($tmp->params);

            if (
    $params->get('menu_images') && $iParams->get('menu_image') && $iParams->get('menu_image') != -1) {

                switch (
    $params->get('menu_images_align'0)){

                    case 


                    
    $imgalign='align="left"';

                    break;

                    

                    case 
    :

                    
    $imgalign='align="right"';

                    break;

                    

                    default :

                    
    $imgalign='';

                    break;

                }

                    

                

                
    $image '[img]'.JURI::base(true).'/images/stories/'.$iParams->get('menu_image').'[/img]alias.'" />';

                if(
    $tmp->ionly){

                     
    $tmp->name = null;

                 }

            } else {

                
    $image = null;

            }

            switch (
    $tmp->type)

            {

                case 'separator' :

                    return '<span class="
    separator">'.$image.$tmp->name.'</span>';

                    break;



                case 'url' :

                    if ((strpos(
    $tmp->link, 'index.php?') === 0) && (strpos($tmp->link, 'Itemid=') === false)) {

                        
    $tmp->url = $tmp->link.'&amp;Itemid='.$tmp->id;

                    } else {

                        
    $tmp->url = $tmp->link;

                    }

                    break;



                default :

                    
    $router = JSite::getRouter();

                    
    $tmp->url = $router->getMode() == JROUTER_MODE_SEF ? 'index.php?Itemid='.$tmp->id : $tmp->link.'&Itemid='.$tmp->id;

                    break;

            }



            // Print a link if it exists

            if (
    $tmp->url != null)

            {

                // Handle SSL links

                
    $iSecure = $iParams->def('secure', 0);

                if (
    $tmp->home == 1) {

                    
    $tmp->url = JURI::base();

                } elseif (strcasecmp(substr(
    $tmp->url, 0, 4), 'http') && (strpos($tmp->link, 'index.php?') !== false)) {

                    
    $tmp->url = JRoute::_($tmp->url, true, $iSecure);

                } else {

                    
    $tmp->url = str_replace('&', '&amp;', $tmp->url);

                }



                switch (
    $tmp->browserNav)

                {

                    default:

                    case 0:

                        // _top

                        
    $data = '[url="'.$tmp->url.'"]'.$image.$tmp->name.'[/url]';

                        break;

                    case 1:

                        // _blank

                        
    $data = '[url="'.$tmp->url.'"]'.$image.$tmp->name.'[/url]';

                        break;

                    case 2:

                        // window.open

                        
    $attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,'.$this->_params->get('window_open');



                        // hrm...this is a bit dickey

                        
    $link = str_replace('index.php', 'index2.php', $tmp->url);

                        
    $data = '[url="'.$link.'"]'.$image.$tmp->name.'[/url]';

                        break;

                }

            } else {

                
    $data = '<a>'.$image.$tmp->name.'</a>';

            }



            return 
    $data;

        }

    }



    /**

     * Main Menu Tree Node Class.

     *

     * @package        Joomla

     * @subpackage    Menus

     * @since        1.5

     */

    class JMenuNode extends JNode

    {

        /**

         * Node Title

         */

        var 
    $title = null;



        /**

         * Node Link

         */

        var 
    $link = null;



        /**

         * CSS Class for node

         */

        var 
    $class = null;



        function __construct(
    $id$title$access = null, $link = null, $class = null)

        {

            
    $this->id        = $id;

            
    $this->title    = $title;

            
    $this->access    = $access;

            
    $this->link        = $link;

            
    $this->class    = $class;

        }

    }

  5. #5
    il terzo:

    legacy.php

    Codice PHP:

    <?php

    /**

    * @version        $Id: legacy.php 14401 2010-01-26 14:10:00Z louis $

    * @package        Joomla

    * @copyright    Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.

    * @license        GNU/GPL, see LICENSE.php

    * Joomla! is free software. This version may have been modified pursuant

    * to the GNU General Public License, and as distributed it includes or

    * is derivative of works licensed under the GNU General Public License or

    * other free or open source software licenses.

    * See COPYRIGHT.php for copyright notices and details.

    */



    // no direct access

    defined('_JEXEC') or die('Restricted access');



    /**

    * Utility function for writing a menu link

    */

    function mosGetMenuLink($mitem$level 0, & $params$open null)

    {

        global 
    $Itemid;

        
    $txt '';

        
    //needed to break reference to prevent altering the actual menu item

        
    $mitem = clone($mitem);

        
    // Menu Link is a special type that is a link to another item

        
    if ($mitem->type == 'menulink')

        {

            
    $menu = &JSite::getMenu();

            if (
    $tmp $menu->getItem($mitem->query['Itemid'])) {

                
    $name $mitem->name;

                
    $mid $mitem->id;

                
    $parent $mitem->parent;

                
    $mitem = clone($tmp);

                
    $mitem->name $name;

                
    $mitem->mid $mid;

                
    $mitem->parent $parent;

            } else {

                return;

            }

        }



        switch (
    $mitem->type)

        {

            case 
    'separator' :

                
    $mitem->browserNav 3;

                break;



            case 
    'url' :

                if (
    preg_match('#index.php\?#i'$mitem->link)) {

                    if (!
    preg_match('#Itemid=#i'$mitem->link)) {

                        
    $mitem->link .= '&amp;Itemid='.$mitem->id;

                    }

                }

                break;



            default :

                
    $mitem->link 'index.php?Itemid='.$mitem->id;

                break;

        }



        
    // Active Menu highlighting

        
    $current_itemid intval$Itemid );

        if (!
    $current_itemid) {

            
    $id '';

        } else {

            if (
    $current_itemid == $mitem->id) {

                
    $id 'id="active_menu' $params->get('class_sfx') . '"';

            } else {

                if (
    $params->get('activate_parent') && isset ($open) && in_array($mitem->id$open)) {

                    
    $id 'id="active_menu' $params->get('class_sfx') . '"';

                } else {

                    if (
    $mitem->type == 'url' && ItemidContained($mitem->link$current_itemid)) {

                        
    $id 'id="active_menu' $params->get('class_sfx') . '"';

                    } else {

                        
    $id '';

                    }

                }

            }

        }



        if (
    $params->get('full_active_id'))

        {

            
    // support for `active_menu` of 'Link - Url' if link is relative

            
    if ($id == '' && $mitem->type == 'url' && strpos($mitem->link'http') === false) {

                
    $url = array();

                if(
    strpos($mitem->link'&amp;') !== false)

                {

                   
    $mitem->link str_replace('&amp;','&',$mitem->link);

                }



                
    parse_str($mitem->link$url);

                if (isset (
    $url['Itemid'])) {

                    if (
    $url['Itemid'] == $current_itemid) {

                        
    $id 'id="active_menu' $params->get('class_sfx') . '"';

                    }

                }

            }

        }



        
    // replace & with amp; for xhtml compliance

        
    $menu_params = new stdClass();

        
    $menu_params = new JParameter($mitem->params);

        
    $menu_secure $menu_params->def('secure'0);



        if (
    strcasecmp(substr($mitem->link04), 'http')) {

            
    $mitem->url JRoute::_($mitem->linktrue$menu_secure);

        } else {

            
    $mitem->url $mitem->link;

        }



        
    $menuclass 'mainlevel' $params->get('class_sfx');

        if (
    $level 0) {

            
    $menuclass 'sublevel' $params->get('class_sfx');

        }



        
    // replace & with amp; for xhtml compliance

        // remove slashes from excaped characters

        
    $mitem->name stripslashes(htmlspecialchars($mitem->name));



        switch (
    $mitem->browserNav)

        {

            
    // cases are slightly different

            
    case :

                
    // open in a new window

                
    $txt '[url="' $mitem->url '"]' $mitem->name '[/url]';

                break;



            case 
    :

                
    // open in a popup window

                
    $txt "<a href=\"#\" onclick=\"javascript: window.open('" $mitem->url "', '', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=780,height=550'); return false\" class=\"$menuclass\" " $id ">" $mitem->name "</a>\n";

                break;



            case 
    :

                
    // don't link it

                
    $txt '<span class="' $menuclass '" ' $id '>' $mitem->name '</span>';

                break;



            default : 
    // formerly case 2

                // open in parent window

                
    $txt '[url="' $mitem->url '"]' $mitem->name '[/url]';

                break;

        }



        if (
    $params->get('menu_images'))

        {

            
    $menu_params = new stdClass();

            
    $menu_params = new JParameter($mitem->params);



            
    $menu_image $menu_params->def('menu_image', -1);

            if ((
    $menu_image <> '-1') && $menu_image) {

                
    $image '[img]'.JURI::base(true).'/images/stories/' $menu_image '[/img]name . '"/>';

                if (
    $params->get('menu_images_align')) {

                    
    $txt = $txt . ' ' . $image;

                } else {

                    
    $txt = $image . ' ' . $txt;

                }

            }

        }



        return 
    $txt;

    }



    /**

    * Vertically Indented Menu

    */

    function mosShowVIMenu(& 
    $params)

    {

        global 
    $mainframe$Itemid;



        
    $template = $mainframe->getTemplate();

        
    $menu =& JSite::getMenu();

        
    $user =& JFactory::getUser();



        // indent icons

        switch (
    $params->get('indent_image')) {

            case '1' :

                {

                    // Default images

                    
    $imgpath = JURI::base(true).'/images/M_images';

                    for (
    $i = 1; $i < 7; $i++) {

                        
    $img[$i] = '[img]' . $imgpath . '/indent' . $i . '.png[/img]';

                    }

                }

                break;



            case '2' :

                {

                    // Use Params

                    
    $imgpath = JURI::base(true).'/images/M_images';

                    for (
    $i = 1; $i < 7; $i++) {

                        if (
    $params->get('indent_image' . $i) == '-1') {

                            
    $img[$i] = NULL;

                        } else {

                            
    $img[$i] = '[img]' . $imgpath . '/' . $params->get('indent_image' . $i) . '[/img]';

                        }

                    }

                }

                break;



            case '3' :

                {

                    // None

                    for (
    $i = 1; $i < 7; $i++) {

                        
    $img[$i] = NULL;

                    }

                }

                break;



            default :

                {

                    // Template

                    
    $imgpath = JURI::base(true).'/templates/' . $template . '/images';

                    for (
    $i = 1; $i < 7; $i++) {

                        
    $img[$i] = '[img]' . $imgpath . '/indent' . $i . '.png[/img]';

                    }

                }

        }



        
    $indents = array (

                // block prefix / item prefix / item suffix / block suffix

        array (

                '<table width="
    100%" border="0" cellpadding="0" cellspacing="0">',

                '<tr ><td>',

                '</td></tr>',

                '</table>'

            ),

            array (

                '',

                '<div style="
    padding-left4px">' . $img[1],

                '</div>',

                ''

            ),

            array (

                '',

                '<div style="
    padding-left8px">' . $img[2],

                '</div>',

                ''

            ),

            array (

                '',

                '<div style="
    padding-left12px">' . $img[3],

                '</div>',

                ''

            ),

            array (

                '',

                '<div style="
    padding-left16px">' . $img[4],

                '</div>',

                ''

            ),

            array (

                '',

                '<div style="
    padding-left20px">' . $img[5],

                '</div>',

                ''

            ),

            array (

                '',

                '<div style="
    padding-left24px">' . $img[6],

                '</div>',

                ''

            ),



        );



        // establish the hierarchy of the menu

        
    $children = array ();



        //get menu items

        
    $rows = $menu->getItems('menutype', $params->get('menutype'));



        // first pass - collect children

        
    $cacheIndex = array();

        if(is_array(
    $rows) && count($rows)) {

            foreach (
    $rows as $index => $v) {

                if (
    $v->access <= $user->get('aid')) {

                    
    $pt = $v->parent;

                    
    $list = @ $children[$pt] ? $children[$pt] : array ();

                    array_push(
    $list$v);

                    
    $children[$pt] = $list;

                }

                
    $cacheIndex[$v->id] = $index;

            }

        }



        // second pass - collect 'open' menus

        
    $open = array (

            
    $Itemid

        );

        
    $count = 20; // maximum levels - to prevent runaway loop

        
    $id = $Itemid;



        while (-- 
    $count)

        {

            if (isset(
    $cacheIndex[$id])) {

                
    $index = $cacheIndex[$id];

                if (isset (
    $rows[$index]) && $rows[$index]->parent > 0) {

                    
    $id = $rows[$index]->parent;

                    
    $open[] = $id;

                } else {

                    break;

                }

            }

        }



        mosRecurseVIMenu(0, 0, 
    $children$open$indents$params);

    }



    /**

    * Utility function to recursively work through a vertically indented

    * hierarchial menu

    */

    function mosRecurseVIMenu(
    $id$level, & $children, & $open, & $indents, & $params)

    {

        if (@ 
    $children[$id]) {

            
    $n = min($level, count($indents) - 1);



            echo "
    \n" . $indents[$n][0];

            foreach (
    $children[$id] as $row) {



                echo "
    \n" . $indents[$n][1];



                echo mosGetMenuLink(
    $row$level$params$open);



                // show menu with menu expanded - submenus visible

                if (!
    $params->get('expand_menu')) {

                    if (in_array(
    $row->id$open)) {

                        mosRecurseVIMenu(
    $row->id$level +1, $children$open$indents$params);

                    }

                } else {

                    mosRecurseVIMenu(
    $row->id$level +1, $children$open$indents$params);

                }

                echo 
    $indents[$n][2];

            }

            echo "
    \n" . $indents[$n][3];

        }

    }



    /**

    * Draws a horizontal 'flat' style menu (very simple case)

    */

    function mosShowHFMenu(& 
    $params$style = 0)

    {

        
    $menu = & JSite::getMenu();

        
    $user = & JFactory::getUser();



        //get menu items

        
    $rows = $menu->getItems('menutype', $params->get('menutype'));



        
    $links = array ();

        if(is_array(
    $rows) && count($rows)) {

            foreach (
    $rows as $row)

            {

                if (
    $row->access <= $user->get('aid', 0)) {

                    
    $links[] = mosGetMenuLink($row, 0, $params);

                }

            }

        }



        
    $menuclass = 'mainlevel' . $params->get('class_sfx');

        
    $lang =& JFactory::getLanguage();



        if (count(
    $links))

        {

            switch (
    $style)

            {

                case 1 :

                    echo '<ul id="' . $menuclass . '">';

                    foreach (
    $links as $link) {

                        echo '[*]' . 
    $link . '';

                    }

                    echo '[/list]';

                    break;



                default :

                    
    $spacer_start = $params->get('spacer');

                    
    $spacer_end = $params->get('end_spacer');



                    echo '<table width="
    100%" border="0" cellpadding="0" cellspacing="1">';

                    echo '<tr>';

                    echo '<td nowrap="
    nowrap">';



                    if (
    $spacer_end) {

                        echo '<span class="' . $menuclass . '"> ' . 
    $spacer_end . ' </span>';

                    }



                    if (
    $spacer_start) {

                        
    $html = '<span class="' . $menuclass . '"> ' . $spacer_start . ' </span>';

                        echo implode(
    $html$links);

                    } else {

                        echo implode('', 
    $links);

                    }



                    if (
    $spacer_end) {

                        echo '<span class="' . $menuclass . '"> ' . 
    $spacer_end . ' </span>';

                    }



                    echo '</td>';

                    echo '</tr>';

                    echo '</table>';

                    break;

            }

        }

    }



    /**

    * Search for Itemid in link

    */

    function ItemidContained(
    $link$Itemid)

    {

        
    $link = str_replace('&amp;', '&', $link);

        
    $temp = explode("&", $link);

        
    $linkItemid = "";

        foreach (
    $temp as $value) {

            
    $temp2 = explode("=", $value);

            if (
    $temp2[0] == "Itemid") {

                
    $linkItemid = $temp2[1];

                break;

            }

        }

        if (
    $linkItemid != "" && $linkItemid == $Itemid) {

            return true;

        } else {

            return false;

        }

    }

  6. #6
    poi c'è la parte del file css del template che ho modificato per adattarlo alle mie esigenze:

    codice:
    #navigation{
    		width:100%;
    		background-color:#373737;
    		}
    		/*stile generale delle liste*/
    		#navigation ul{
    		margin:0;
    		padding:0;
    		position: relative;
    		height: 30px;
    		width:100%;
    		}
    		/*stile generale delle sub liste*/
    		#navigation ul ul{
    		position: absolute;
    		top:30px;
    		left: 0;
    		visibility: hidden;
    		}
    		/*stile generale dei list item*/
    		#navigation li{
    		list-style: none;
    		float: left;
    		padding:0 5px;
    		background-color:#373737;
    		}
    		#navigation ul, #navigation li{
    		background-color:#373737;
    		}
    		#navigation ul ul, #navigation li li{
    		background-color:#767676;
    		}
    		#navigation ul ul ul, #navigation li li li{
    		background-color:#DDDDDD;
    		}
    		
    		/*style generale dei link*/
    		#navigation a{
    		display:block;
    		float:left;
    		padding:0 30px;
    		text-decoration:none;
    		text-align: center;
    		line-height: 30px;	
    		font-family: Verdana;
    		font-size: 9px;
    		font-weight: bold;
    		}
    		/*style generale dei link sullo stato hover*/
    		#navigation ul :hover > a, #navigation ul a:hover{
    		height:20px;
    		border-top:5px solid #373737;
    		border-bottom:5px solid #373737;
    		line-height:20px;
    		}
    		#navigation ul :hover > a.sub{
    		height:25px;
    		border-bottom:none;
    		line-height:20px;
    		}
    		/*stile link primo livello*/
    		#navigation ul a{
    		color:#FFFFFF;
    		}		
    		#navigation ul :hover > a{
    		background-color:#767676;
    		border-color:#373737;
    		color:#FFCC00;
    		} 	
    		/*stile link secondo livello*/
    		#navigation ul ul a{
    		color:#FFCC00;
    		}	
    		#navigation ul ul :hover > a{
    		background-color:#DDDDDD;
    		border-color: #767676;
    		color:#336699;
    		}	
    		/*stile link terzo livello*/
    		#navigation ul ul ul a{
    		color:#336699;	
    		}
    		#navigation ul ul ul :hover > a{
    		background-color:#FFF;
    		border-color:#DDDDDD;
    		}	
    		/*secondo livello visibile su hover del primo livello*/
    		#navigation ul li:hover ul, #navigation ul a:hover ul{
    		visibility:visible;
    		}
    		/*terzo livello invisibile su hover del primo livello*/
    		#navigation ul li:hover ul ul, #navigation ul a:hover ul ul{
    		visibility:hidden;
    		}
    		/*terzo livello visibile su hover del secondo livello*/
    		#navigation ul ul li:hover ul, #navigation ul ul a:hover ul{
    		visibility:visible;
    		}
    		/*style per Internet Explorer 6*/
    		#navigation table {
    		position:absolute; 
    		border-collapse:collapse; 
    		top:0; 
    		left:0;
    		width:100%;
    		}
    		#navigation a:hover{
    		height:20px;
    		border-top:5px solid #373737;
    		border-bottom:5px solid #373737;
    		line-height:20px;
    		}
    		#navigation ul a.sub:hover{
    		height:25px;
    		border-bottom:none;
    		line-height:20px;
    		}
    		#navigation ul a:hover{
    		background-color:#767676;
    		border-color:#373737;
    		color:#FFCC00;
    		} 
    		#navigation ul ul a:hover{
    		background-color:#DDDDDD;
    		border-color: #767676;
    		color:#336699;
    		}
    		#navigation ul ul ul a:hover{
    		background-color:#FFF;
    		border-color:#DDDDDD;
    		}	
    
    
    
    /*
    #navigation{ overflow: hidden; margin-bottom: 50px }
    
    
    
    *#navigation ul{
    
    *	float: left;
    
    *	list-style: outside none;
    
    *	margin: 0;
    
    *	padding: 0;
    
    *}
    
    *
    
    *#navigation li, #navigation a{ float: left }
    
    *
    
    *#navigation a{
    
    *	padding:5px 10px;
    
    *	margin-right: 5px;
    
    *	background: #7b7b7b;
    
    *	color: #fff;
    
    *	text-decoration: none;
    
    *	font-weight: bold
    
    *}
    
    *
    
    *#navigation a:hover, #navigation a:focus{ background-color: #000 }
    la parte finale commentata era la formattazione originale del menu.

    Scusate se ho creato 4 post x inserire il codice e scusate x la lunghezza ma nn sapevo come mostrarlo diversamente.

    Grazie

  7. #7
    Nessuno può aiutarmi?

  8. #8

  9. #9
    Visto che il sito con joomla prevede la creazione a mano del menù, basta che aggiungi tu alla voce la stringa che vuoi mostrare...
    oppure assegni una classe alla voce e modifichi il foglio di stile del template
    Ciao!

  10. #10
    Visto che il sito con joomla prevede la creazione a mano del menù, basta che aggiungi tu alla voce la stringa che vuoi mostrare...
    oppure assegni una classe alla voce e modifichi il foglio di stile del template
    Ciao!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.