菜单项目未关闭?

时间:2013-12-28 09:25:26

标签: php jquery html mysql css

我正在编写一个工作人员面板,但是我已经卡住了我已经添加了一个菜单(导航)但我仍然坚持如何在点击时打开它并在点击时关闭它(如果打开)。

这是我到目前为止的代码;

<ul id="menu" class="nav">
    <?php
    $url = $_GET['url'] ? $core->clean($_GET['url']) : 'core.home';

    $query3 = $db->query("SELECT * FROM menu WHERE url = '{$url}'");
    $array3 = $db->assoc($query3);

    if (!$array3['usergroup']) {

        $array3['usergroup'] = "invalid";
    }

    $query = $db->query("SELECT * FROM usergroups ORDER BY weight ASC");

    while ($array = $db->assoc($query)) {

        if (in_array($array['id'], $user->data['uGroupArray'])) {
            ?>



            <div class="menustyle" onclick="Radi.menuToggle('<?php echo $array['id']; ?>');">



                <div class="menutext"><?php echo $array['name']; ?></div>

            </div>

            <ul>
                <li class="menuitems"<?php if ($array['id'] != $array3['usergroup']) { ?> onclick="Radi.menuToggle('<?php echo $array['id']; ?>');" style="display: none;"<?php } ?> id="mitems_<?php echo $array['id']; ?>">

        <?php
        $query2 = $db->query("SELECT * FROM menu WHERE usergroup = '{$array['id']}' AND visible = '1' ORDER BY weight ASC");
        $i = "a";
        while ($array2 = $db->assoc($query2)) {
            ?>
                    <li>
                        <a href="<?php echo $array2['url']; ?>" class="<?php echo $i; ?>"><?php echo $array2['text']; ?></a>
                    </li>

            <?php
            $i++;

            if ($i == "c") {

                $i = "a";
            }
        }
        ?>
            </ul>
        </li>      
                <?php
            }
        }
        ?>




</li>
</ul>
</div>

这是下载radipanel时的defualt代码;

<div style="float: left; width: 200px;">

    <?php
    $url = $_GET['url'] ? $core->clean($_GET['url']) : 'core.home';

    $query3 = $db->query("SELECT * FROM menu WHERE url = '{$url}'");
    $array3 = $db->assoc($query3);

    if (!$array3['usergroup']) {

        $array3['usergroup'] = "invalid";
    }

    $query = $db->query("SELECT * FROM usergroups ORDER BY weight ASC");

    while ($array = $db->assoc($query)) {

        if (in_array($array['id'], $user->data['uGroupArray'])) {
            ?>

            <div class="box">

                <div class="square menu" style="background: #<?php echo $array['colour']; ?>;" onclick="Radi.menuToggle('<?php echo $array['id']; ?>');">

                    <img id="menutoggle_<?php echo $array['id']; ?>" class="menutoggle" src="_img/<?php echo ( $array['id'] != $array3['usergroup'] ) ? 'plus' : 'minus'; ?>_white.png" alt="Toggle" align="right" />

                    <strong><?php echo $array['name']; ?></strong>

                </div>

                <div class="menuitems"<?php if ($array['id'] != $array3['usergroup']) { ?> style="display: none;"<?php } ?> id="mitems_<?php echo $array['id']; ?>">

        <?php
        $query2 = $db->query("SELECT * FROM menu WHERE usergroup = '{$array['id']}' ORDER BY weight ASC");

        $i = "a";

        while ($array2 = $db->assoc($query2)) {
            ?>

                        <a href="<?php echo $array2['url']; ?>" class="<?php echo $i; ?>">
                        <?php echo $array2['text']; ?>
                        </a>

            <?php
            $i++;

            if ($i == "c") {

                $i = "a";
            }
        }
        ?>

                </div>

            </div>

                    <?php
                }
            }
            ?>

</div>

那么为什么我的代码没有这样做的任何想法?

0 个答案:

没有答案