0
Welcome Guest! Login
0 items Join Now

Title display of split-menu's sub menu - PHP help needed

    • johkar's Avatar
    • johkar
    • Newbie
    • Posts: 15
    • Thanks: 0

    Title display of split-menu's sub menu - PHP help needed

    Posted 16 years 4 days ago
    • I am using the split menu that came with Equinox Essentials Lab Release with Joomla 1.5.

      Link to site: node01.tmdhosting410.com/~ankfumc/

      Above the sub menus that display on the left side (click on About Us) it displays the tite of the item being displayed. I would like to change it so that it displays the title of the parent off the main menu. So all the About Us sub menus would display "About Us Menu" just like it does when you click on the About Us link. Hope that makes sense. Here is the PHP...I don't know the language.

      function modChrome_submenu($module, &$params, &$attribs)
      {
      global $Itemid;

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

      $tabmenu = &JSite::getMenu();
      $item = $tabmenu->getItem($Itemid);



      if (isset($item)) {
      $tparent = $tabmenu->getItem($item->parent);

      while ($tparent != null && $tparent->parent != 0) {
      if ($item->sublevel == $start-1) break;
      $item = $tabmenu->getItem($item->parent);
      $tparent = $tabmenu->getItem($item->parent);
      }
      if (!empty ($module->content) && strlen($module->content) > 40) { ?>
      <div class="module<?php echo $params->get('moduleclass_sfx'); ?>"><div><div><div>
      <h3><?php echo $item->name; ?> Menu </h3>
      <?php echo $module->content; ?>
      </div></div></div></div>
      <?php
      }
      }
      }
  • Re: Title display of split-menu's sub menu - PHP help needed

    Posted 15 years 10 months ago
    • Hi, johkar

      I don't know if this is very "orthodox" code (I don't know much about php), but anyway... it has worked for me :)
      function modChrome_submenu($module, &$params, &$attribs)
      {
          global $Itemid;
          
          $start  = $params->get('startLevel');
          
          $tabmenu = &JSite::getMenu();
          $item = $tabmenu->getItem($Itemid);
          
          
       
          if (isset($item)) {
              $tparent = $tabmenu->getItem($item->parent);
       
                  while ($tparent != null && $tparent->parent != 0) {
                      if ($item->sublevel == $start-1) break;
                      $item = $tabmenu->getItem($item->parent);
                      $tparent = $tabmenu->getItem($item->parent);
                  }
                  if (!empty ($module->content) && strlen($module->content) > 40 && $item->sublevel == $start-1) { ?>
                      <div class="module-hilite2a"><div><div><div>
                          <h3><?php echo $item->name; ?></h3>
                          <?php echo $module->content; ?>
                      </div></div></div></div>
                  <?php
                  } elseif (!empty ($module->content) && strlen($module->content) > 40 && $item->sublevel != $start-1) { ?>
                      <div class="module-hilite2a"><div><div><div>
                          <h3><?php echo $tparent->name; ?></h3>
                          <?php echo $module->content; ?>
                      </div></div></div></div
              <?php 
                  }    }
      }
      ?>

Time to create page: 0.062 seconds