php导航数组包括 - 添加新项目

时间:2012-06-06 16:48:41

标签: php arrays navigation

我需要协助将新项目添加到之前创建的现有菜单中。我在菜单中添加了以下代码行,但没有显示任何内容。

    ,'support'   => array('str'=>'Support','href'=>'/search/movies/support.php')

我在include文件中更改的代码如下:

EOF;

$ary_menu = array(
     'learn'     => array('str'=>'Learn','href'=>'/tech/index.php'
        ,'sub'   => array(
             'principles' => array('str'=>'Laser Principles','href'=>'/tech/index.php')
            ,'standards'  => array('str'=>'Safety and International Standards','href'=>'/tech/install.php')
            ,'glossary'   => array('str'=>'Laser Terms Glossary','href'=>'/tech/yougo/a.php'
                ,'src'    => $src_glossary
            )
            ,'techniques' => array('str'=>'Laser Processing Techniques','href'=>'/tech/kakou.php')
            ,'faq'        => array('str'=>'Laser Marker FAQ','href'=>'/tech/faq.php'
                ,'sub' => $sub_faq
            )
        )
     )
    ,'explore'   => array('str'=>'Explore','href'=>'/search/movies/index.php'
        ,'sub'   => array(
             'mov'         => array('str'=>'Videos','href'=>'/search/movies/index.php')
            ,'appl'        => array('str'=>'Industries and <br/>Applications','href'=>'/search/appli/index.php')
            ,'character'   => array('str'=>'Laser Characteristics <br/>by Material','href'=>'/search/features/index.php'
                ,'sub'     => $sub_lcm
            )
        )
    )
    ,'products'  => array('str'=>'Products','href'=>'/products/index.php'
        ,'sub'   => array(
             'pd_overview' => array('str'=>'Overview','href'=>'/products/index.php')
            ,'mdt1000'     => array('str'=>'Green Laser Marker<br><font size="1">MD-T 1000 Series</font>','href'=>'/products/green-laser-marker.php')
            ,'mdf3000'     => array('str'=>'Fiber Laser Marker<br><font size="1">MD-F 3000 Series</font>','href'=>'/products/fiber-laser-marker.php')
            ,'mdv9900'     => array('str'=>'YVO4 Laser Marker<br><font size="1">MD-V 9900A Series</font>','href'=>'/products/yvo4-laser-marker.php')
            ,'mlz9500'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-Z 9500 Series</font>','href'=>'/products/co2-laser-marker.php')
            ,'mlg9300'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-G 9300 Series</font>','href'=>'/products/high-speed-co2-laser-marker.php')
            ,'mdh9800'     => array('str'=>'YAG Laser Marker<br><font size="1">MD-H 9800 Series</font>','href'=>'/products/yag-laser-marker.php')
        )
    )
    ,'downloads' => array('str'=>'Downloads','href'=>'/downloads/index.php'
        ,'sub'   => array(
             'dl_top'      => array('str'=>'Download Catalog','href'=>'/downloads/index.php')
            ,'lib_top'     => array('str'=>'Laser Marking Library','href'=>'/downloads/index.php#lib'
                ,'sub'     => array(
                     'lib_qa'      => array('str'=>'Marking Q&A','href'=>'/topics/library_question.php')
                    ,'lib_app'     => array('str'=>'Introduction Examples','href'=>'/topics/library_application.php')
                    ,'lib_cost'    => array('str'=>'Expert Knowledge','href'=>'/topics/library_costdown.php')
                    ,'lib_other'    => array('str'=>'Industry','href'=>'/topics/library_other.php')
        )
    )
    ,'support'   => array('str'=>'Support','href'=>'/search/movies/support.php')
            )
        )
    ,'virtual'   => array('str'=>'Virtual','href'=>'/virtual/index.php')
);

1 个答案:

答案 0 :(得分:1)

从当前结构中,支持菜单将显示在“下载”子菜单下。那是你要的吗?如果您希望它作为主菜单,结构应为:

<?php
$ary_menu = array(
     'learn'     => array('str'=>'Learn','href'=>'/tech/index.php'
        ,'sub'   => array(
             'principles' => array('str'=>'Laser Principles','href'=>'/tech/index.php')
            ,'standards'  => array('str'=>'Safety and International Standards','href'=>'/tech/install.php')
            ,'glossary'   => array('str'=>'Laser Terms Glossary','href'=>'/tech/yougo/a.php'
                ,'src'    => $src_glossary
            )
            ,'techniques' => array('str'=>'Laser Processing Techniques','href'=>'/tech/kakou.php')
            ,'faq'        => array('str'=>'Laser Marker FAQ','href'=>'/tech/faq.php'
                ,'sub' => $sub_faq
            )
        )
     )
    ,'explore'   => array('str'=>'Explore','href'=>'/search/movies/index.php'
        ,'sub'   => array(
             'mov'         => array('str'=>'Videos','href'=>'/search/movies/index.php')
            ,'appl'        => array('str'=>'Industries and <br/>Applications','href'=>'/search/appli/index.php')
            ,'character'   => array('str'=>'Laser Characteristics <br/>by Material','href'=>'/search/features/index.php'
                ,'sub'     => $sub_lcm
            )
        )
    )
    ,'products'  => array('str'=>'Products','href'=>'/products/index.php'
        ,'sub'   => array(
             'pd_overview' => array('str'=>'Overview','href'=>'/products/index.php')
            ,'mdt1000'     => array('str'=>'Green Laser Marker<br><font size="1">MD-T 1000 Series</font>','href'=>'/products/green-laser-marker.php')
            ,'mdf3000'     => array('str'=>'Fiber Laser Marker<br><font size="1">MD-F 3000 Series</font>','href'=>'/products/fiber-laser-marker.php')
            ,'mdv9900'     => array('str'=>'YVO4 Laser Marker<br><font size="1">MD-V 9900A Series</font>','href'=>'/products/yvo4-laser-marker.php')
            ,'mlz9500'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-Z 9500 Series</font>','href'=>'/products/co2-laser-marker.php')
            ,'mlg9300'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-G 9300 Series</font>','href'=>'/products/high-speed-co2-laser-marker.php')
            ,'mdh9800'     => array('str'=>'YAG Laser Marker<br><font size="1">MD-H 9800 Series</font>','href'=>'/products/yag-laser-marker.php')
        )
    )
    ,'downloads' => array('str'=>'Downloads','href'=>'/downloads/index.php'
        ,'sub'   => array(
             'dl_top'      => array('str'=>'Download Catalog','href'=>'/downloads/index.php')
            ,'lib_top'     => array('str'=>'Laser Marking Library','href'=>'/downloads/index.php#lib'
                ,'sub'     => array(
                     'lib_qa'      => array('str'=>'Marking Q&A','href'=>'/topics/library_question.php')
                    ,'lib_app'     => array('str'=>'Introduction Examples','href'=>'/topics/library_application.php')
                    ,'lib_cost'    => array('str'=>'Expert Knowledge','href'=>'/topics/library_costdown.php')
                    ,'lib_other'    => array('str'=>'Industry','href'=>'/topics/library_other.php')
        )
    )

            )
        ),'support'   => array('str'=>'Support','href'=>'/search/movies/support.php')
    ,'virtual'   => array('str'=>'Virtual','href'=>'/virtual/index.php')
);

?>

修改:如果你的意思是在“学习”链接之后(不是作为子),那么它就是:

<?php
$ary_menu = array(
     'learn'     => array('str'=>'Learn','href'=>'/tech/index.php'
        ,'sub'   => array(
             'principles' => array('str'=>'Laser Principles','href'=>'/tech/index.php')
            ,'standards'  => array('str'=>'Safety and International Standards','href'=>'/tech/install.php')
            ,'glossary'   => array('str'=>'Laser Terms Glossary','href'=>'/tech/yougo/a.php'
                ,'src'    => $src_glossary
            )
            ,'techniques' => array('str'=>'Laser Processing Techniques','href'=>'/tech/kakou.php')
            ,'faq'        => array('str'=>'Laser Marker FAQ','href'=>'/tech/faq.php'
                ,'sub' => $sub_faq
            )
        )
     ),'support'   => array('str'=>'Support','href'=>'/search/movies/support.php')
    ,'explore'   => array('str'=>'Explore','href'=>'/search/movies/index.php'
        ,'sub'   => array(
             'mov'         => array('str'=>'Videos','href'=>'/search/movies/index.php')
            ,'appl'        => array('str'=>'Industries and <br/>Applications','href'=>'/search/appli/index.php')
            ,'character'   => array('str'=>'Laser Characteristics <br/>by Material','href'=>'/search/features/index.php'
                ,'sub'     => $sub_lcm
            )
        )
    )
    ,'products'  => array('str'=>'Products','href'=>'/products/index.php'
        ,'sub'   => array(
             'pd_overview' => array('str'=>'Overview','href'=>'/products/index.php')
            ,'mdt1000'     => array('str'=>'Green Laser Marker<br><font size="1">MD-T 1000 Series</font>','href'=>'/products/green-laser-marker.php')
            ,'mdf3000'     => array('str'=>'Fiber Laser Marker<br><font size="1">MD-F 3000 Series</font>','href'=>'/products/fiber-laser-marker.php')
            ,'mdv9900'     => array('str'=>'YVO4 Laser Marker<br><font size="1">MD-V 9900A Series</font>','href'=>'/products/yvo4-laser-marker.php')
            ,'mlz9500'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-Z 9500 Series</font>','href'=>'/products/co2-laser-marker.php')
            ,'mlg9300'     => array('str'=>'CO2 Laser Marker<br><font size="1">ML-G 9300 Series</font>','href'=>'/products/high-speed-co2-laser-marker.php')
            ,'mdh9800'     => array('str'=>'YAG Laser Marker<br><font size="1">MD-H 9800 Series</font>','href'=>'/products/yag-laser-marker.php')
        )
    )
    ,'downloads' => array('str'=>'Downloads','href'=>'/downloads/index.php'
        ,'sub'   => array(
             'dl_top'      => array('str'=>'Download Catalog','href'=>'/downloads/index.php')
            ,'lib_top'     => array('str'=>'Laser Marking Library','href'=>'/downloads/index.php#lib'
                ,'sub'     => array(
                     'lib_qa'      => array('str'=>'Marking Q&A','href'=>'/topics/library_question.php')
                    ,'lib_app'     => array('str'=>'Introduction Examples','href'=>'/topics/library_application.php')
                    ,'lib_cost'    => array('str'=>'Expert Knowledge','href'=>'/topics/library_costdown.php')
                    ,'lib_other'    => array('str'=>'Industry','href'=>'/topics/library_other.php')
        )
    )

            )
        )
    ,'virtual'   => array('str'=>'Virtual','href'=>'/virtual/index.php')
);

?>