2011-04-21 40 views

回答

1

不要修改核心代碼!有一個簡單的解決方案,沒有黑客的核心。對內核進行黑客攻擊會導致升級過程中出現問題,更不要說您將無法在其他地方使用主菜單模塊,因爲菜單將被硬編碼。

Joomla旨在使用CSS來完成你所需要的。

首先,在菜單模塊中添加一個模塊類後綴,以便CSS僅適用於此模塊。像-mainmenu一樣會起作用。這會將模塊類從「moduletable」更改爲「moduletable-mainmenu」。

接下來,您將添加一些CSS以使背景圖像以您想要的方式工作。事情是這樣的 -

.moduletable-mainmenu LI{background:url(path-to-square-background.jpg)} 
.moduletable-mainmenu LI:hover{background:url(path-to-square-background-mouseover.jpg)} 
.moduletable-mainmenu UL:first-child{background:url(path-to-left-rounded-background.jpg)} 
.moduletable-mainmenu UL:first-child:hover{background:url(path-to-left-rounded-background-mouseover.jpg)} 
.moduletable-mainmenu UL:last-child{background:url(path-to-right-rounded-background.jpg)} 
.moduletable-mainmenu UL:last-child:hover{background:url(path-to-right-rounded-background-maouseover.jpg)} 

的Joomla還將增加ID =「當前」當前菜單,所以你可以,如果你想突出當前菜單添加到CSS。此外,您還可以在菜單模塊的其他參數中打開活動父項,以便Joomla在父項菜單項中添加class =「parent」,如果還想突出顯示父菜單項。

現在你可以有圓角而不必破解任何核心代碼。

-1

這很容易做到。

這裏我解釋瞭如何做到這一點。

1.複製你的HTML代碼菜單。 2.轉到你的蒼蠅 - >模塊 - > mod_mainmenu - > legacy.php 3.GO 380線 ''; echo''; echo'';

  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>';` 

4.在這裏複製和粘貼你的html代碼。 例如:

echo " 
      <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> 
      <tr> 
      <td><div id=\"menu\"> 
      <ul> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=frontpage&Itemid=63\" class=\"current\"> Home</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&Itemid=27\">Profile</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=friends&Itemid=2\" onmouseover=\"bizdropdownmenu(this, event, 'menu1')\">Friends</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=inbox&Itemid=41\" onmouseover=\"bizdropdownmenu(this, event, 'menu2')\">Message</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=photos&Itemid=49\" onmouseover=\"bizdropdownmenu(this, event, 'menu3')\">Photos</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=videos&Itemid=74\" onmouseover=\"bizdropdownmenu(this, event, 'menu4')\">Videos</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=events&Itemid=142\" onmouseover=\"bizdropdownmenu(this, event, 'menu5')\">Events</a></li> 
            <li> 
            <a href=\"http://project.websolusionz.com/speed/index.php?option=com_kunena&view=listcat&catid=0&func=listcat&Itemid=165\">Forum</a></li> 
            <li><a href=\"chat.html\">Chat</a></li> 
            <li><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&Itemid=158\" onmouseover=\"bizdropdownmenu(this, event, 'menu6')\">My&nbsp;Account</a></li> 
      </ul> 
     <div class=\"menu\" id=\"menu1\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=search&Itemid=74&Itemid=129\">Search</a><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=search&task=advancesearch&Itemid=74&Itemid=130\">Advanced Search</a><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=friends&task=invite&Itemid=2&Itemid=131\">Invite Friends</a><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=friends&task=sent&Itemid=2&Itemid=132\">Request Send</a><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=friends&task=sent&Itemid=2&Itemid=133\">Pending My Approval</a></div> 
     <div class=\"menu\" id=\"menu2\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=inbox&task=sent&Itemid=77&Itemid=135\">Send</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=inbox&task=write&Itemid=41&Itemid=50\">Compose Message</a></div> 
     <div class=\"menu\" id=\"menu3\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=photos&task=myphotos&userid=84&Itemid=74&Itemid=139\">My Photos</a></div> 
     <div class=\"menu\" id=\"menu4\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=videos&task=myvideos&userid=84&Itemid=74&Itemid=140\">My Videos</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=videos&task=search&Itemid=74&Itemid=141\">Search Videos</a></div> 
     <div class=\"menu\" id=\"menu5\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=events&task=myevents&userid=84&Itemid=82&Itemid=143\">My Events</a></div> 
     <div class=\"menu\" id=\"menu6\"><a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=linkVideo&Itemid=164\">Change Profile Videos</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=uploadAvatar&Itemid=164\">Change Profile Picture</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=edit&Itemid=164\">Edit Profile</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=editDetails&Itemid=164\">Edit Detail</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=privacy&Itemid=164\">Privacy</a> 
     <a href=\"http://project.websolusionz.com/speed/index.php?option=com_community&view=profile&task=preferences&Itemid=164\">Preferences</a> 
     </div> 
     </div></td> 
      </tr> 
     </table>"; 


     /* 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; 
    } 
} 

}

5.now你在主菜單中添加菜單。 6.確實你會在前面板上看到你的菜單。