Create a variable multilevel landscape menu bar

Source: Internet
Author: User
Tags learn php
  • Echo '
      ';
    • foreach ($first _menus as $first _name) {
    • $second _menu = $second _menus[$first _name];
    • echo $li _s;
    • Echo '. $first _name. ';
    • if (null! = $second _menu) {
    • Echo '. $first _name;
    • echo $table _s;
    • echo $ul _s;
    • foreach ($second _menu as $second _name) {
    • echo $li _s;
    • if (array_key_exists ($second _name, $java _menus)) {
    • Echo '. $second _name. '';
    • echo $ul _s;
    • foreach ($java _menus[$second _name] as $java _name) {
    • echo $li _s;
    • Echo '. $java _name. '';
    • echo $li _e;
    • }
    • echo $ul _e;
    • } else {
    • Echo '. $second _name. '';
    • }
    • echo $li _e;
    • }
    • echo $ul _e;
    • echo $table _e;
    • } else {
    • Echo '. $first _name;
    • }
    • Echo ';
    • echo $li _e;
    • }
    • Echo ';
    • Echo ';
    • Echo '
    ';
  • ";
  • Echo ';
  • Copy the Code
  • Modify the $first_menus, $second _menus, $java _menus in the _create_html () method.

    Always do Android, now want to do a blog, learn php, code quality and performance also please treatise.
    1. /**
    2. * Created by Phpstorm.
    3. * User:chshqiang
    4. * date:13-11-28
    5. * Time: 5:05
    6. * $first_menus, $second _menus, $java _menus can be modified in the _create_html () method.
    7. */
    8. _create_css (0, 5);
    9. Echo '';
    10. _create_html ();
    11. function _create_css ($orientation = 0, $count = 3)//Create variable Multilevel menu
    12. {
    13. Echo '';
    14. }
    15. function _create_html ()
    16. {
    17. $first _menus = Array ("Home", "Log", "Image", "IT", "CO", "about");
    18. $second _menus = Array ("Home" = null
    19. , "Log" = = Array ("Zero dollars", "Wrapping text", "styled form", "active Focus")
    20. , "Image" = = Array ("Spies menu", "vertical Menu", "enlarging list", "link Images")
    21. , "IT" = = Array ("Java", "C", "PHP", "node. js", "Android", "ios")
    22. , "CO" = = Array ("View Cloud", "Huan Liu", "Wanpo", "Baidu", "Nine cities")
    23. , "about" = null);
    24. $java _menus = Array ("java" = = Array ("EE", "j2se", "J2ME", "Android", "Tomcat"));
    25. $ul _s = "
        ;
      • $ul _e = '
      ';
    26. $li _s = '
    27. ';
    28. $li _e = '
    29. ';
    30. $table _s = "
      ";
    31. $table _e = "
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.