Note that there are some explanatory texts on larger screens.

plurals
  1. POMenu Items Not Closing?
    text
    copied!<p>I'm coding a staff panel but I'm stuck I've added a menu (navigation) but I'm stuck on how to go about opening it when clicked and closing it when clicked if open.</p> <p>Here is the code i have so far;</p> <pre><code>&lt;ul id="menu" class="nav"&gt; &lt;?php $url = $_GET['url'] ? $core-&gt;clean($_GET['url']) : 'core.home'; $query3 = $db-&gt;query("SELECT * FROM menu WHERE url = '{$url}'"); $array3 = $db-&gt;assoc($query3); if (!$array3['usergroup']) { $array3['usergroup'] = "invalid"; } $query = $db-&gt;query("SELECT * FROM usergroups ORDER BY weight ASC"); while ($array = $db-&gt;assoc($query)) { if (in_array($array['id'], $user-&gt;data['uGroupArray'])) { ?&gt; &lt;div class="menustyle" onclick="Radi.menuToggle('&lt;?php echo $array['id']; ?&gt;');"&gt; &lt;div class="menutext"&gt;&lt;?php echo $array['name']; ?&gt;&lt;/div&gt; &lt;/div&gt; &lt;ul&gt; &lt;li class="menuitems"&lt;?php if ($array['id'] != $array3['usergroup']) { ?&gt; onclick="Radi.menuToggle('&lt;?php echo $array['id']; ?&gt;');" style="display: none;"&lt;?php } ?&gt; id="mitems_&lt;?php echo $array['id']; ?&gt;"&gt; &lt;?php $query2 = $db-&gt;query("SELECT * FROM menu WHERE usergroup = '{$array['id']}' AND visible = '1' ORDER BY weight ASC"); $i = "a"; while ($array2 = $db-&gt;assoc($query2)) { ?&gt; &lt;li&gt; &lt;a href="&lt;?php echo $array2['url']; ?&gt;" class="&lt;?php echo $i; ?&gt;"&gt;&lt;?php echo $array2['text']; ?&gt;&lt;/a&gt; &lt;/li&gt; &lt;?php $i++; if ($i == "c") { $i = "a"; } } ?&gt; &lt;/ul&gt; &lt;/li&gt; &lt;?php } } ?&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>And this is the defualt code when you download radipanel;</p> <pre><code>&lt;div style="float: left; width: 200px;"&gt; &lt;?php $url = $_GET['url'] ? $core-&gt;clean($_GET['url']) : 'core.home'; $query3 = $db-&gt;query("SELECT * FROM menu WHERE url = '{$url}'"); $array3 = $db-&gt;assoc($query3); if (!$array3['usergroup']) { $array3['usergroup'] = "invalid"; } $query = $db-&gt;query("SELECT * FROM usergroups ORDER BY weight ASC"); while ($array = $db-&gt;assoc($query)) { if (in_array($array['id'], $user-&gt;data['uGroupArray'])) { ?&gt; &lt;div class="box"&gt; &lt;div class="square menu" style="background: #&lt;?php echo $array['colour']; ?&gt;;" onclick="Radi.menuToggle('&lt;?php echo $array['id']; ?&gt;');"&gt; &lt;img id="menutoggle_&lt;?php echo $array['id']; ?&gt;" class="menutoggle" src="_img/&lt;?php echo ( $array['id'] != $array3['usergroup'] ) ? 'plus' : 'minus'; ?&gt;_white.png" alt="Toggle" align="right" /&gt; &lt;strong&gt;&lt;?php echo $array['name']; ?&gt;&lt;/strong&gt; &lt;/div&gt; &lt;div class="menuitems"&lt;?php if ($array['id'] != $array3['usergroup']) { ?&gt; style="display: none;"&lt;?php } ?&gt; id="mitems_&lt;?php echo $array['id']; ?&gt;"&gt; &lt;?php $query2 = $db-&gt;query("SELECT * FROM menu WHERE usergroup = '{$array['id']}' ORDER BY weight ASC"); $i = "a"; while ($array2 = $db-&gt;assoc($query2)) { ?&gt; &lt;a href="&lt;?php echo $array2['url']; ?&gt;" class="&lt;?php echo $i; ?&gt;"&gt; &lt;?php echo $array2['text']; ?&gt; &lt;/a&gt; &lt;?php $i++; if ($i == "c") { $i = "a"; } } ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;?php } } ?&gt; &lt;/div&gt; </code></pre> <p>So any ideas on why my code is not doing it?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload