<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>How to show sub menus separately with categories</title>
        <link>https://interactivetools.com/forum/forum-posts.php?How-to-show-sub-menus-separately-with-categories-69832</link>
        <description></description>
        <pubDate>Fri, 10 Apr 2026 10:55:24 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;How-to-show-sub-menus-separately-with-categories-69832" rel="self" type="application/rss+xml" />

                <item>
          <title>Re: [chassa2556] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196262#post2196262</link>
          <description><![CDATA[Hi Charles,<br /><br />Yes you can, the first step would be to create a mockup of how you want those two sections to look.<br /><br />Let me know when you get that far and we can work on the next step.<br />]]></description>
          <pubDate>Thu, 12 Mar 2009 15:25:44 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196262#post2196262</guid>
        </item>
                <item>
          <title>Re: [Dave] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196252#post2196252</link>
          <description><![CDATA[Dave - you're a gem thanks so much for your time and effort on this its working fine now. <br /><br />One last thing on this which would make it really powerful tool - could I change the design layout for say Products so the layout would be different in nature than News?<br />]]></description>
          <pubDate>Thu, 12 Mar 2009 05:00:51 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196252#post2196252</guid>
        </item>
                <item>
          <title>Re: [chassa2556] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196228#post2196228</link>
          <description><![CDATA[Hi Charles,<br /><br />We'll have tackle one problem at a time, so lets start with splitting up the menus.  <br /><br />We've been adding some features to the next version to make this easier.  I've updated your /cmsAdmin/lib/viewer_functions.php as follows:<br /><br />- Search for _isSelected<br />- Replace that line (around line 558) with this: <span style="color:red">(this will be in v1.28)</span><br /><code>list($selectedRootNum) = preg_split('/:/', @$selectedCategory['lineage'],-1,PREG_SPLIT_NO_EMPTY); // root num of selected records branch<br />$category['_isSelected']           = (int) ($category['num'] == $options['selectedCategoryNum']);<br />$category['_isAncestorSelected']   = $selectedCategory &amp;&amp; preg_match(&quot;/:{$selectedCategory['num']}/&quot;, $category['lineage'])  &amp;&amp; !$category['_isSelected'];<br />$category['_isDescendantSelected'] = $selectedCategory &amp;&amp; preg_match(&quot;/:{$category['num']}:/&quot;, $selectedCategory['lineage']) &amp;&amp; !$category['_isSelected'];<br />$category['_isSelectedBranch']     = $selectedCategory &amp;&amp; preg_match(&quot;/:{$selectedRootNum}:/&quot;, $category['lineage']);</code><br /><br />Next, I've updated your /cms/categoryList.php file as follows:<br /><code>  &lt;?php foreach ($categoryRecords as $categoryRecord): ?&gt;<br />    <span style="color:red">&lt;?php if ($categoryRecord['depth'] != 0) { continue; } ?&gt;</span><br /><br />    &lt;?php if ($categoryRecord['<span style="color:red">_isSelectedBranch</span>']): ?&gt;<br />      &lt;li&gt;&lt;b&gt;&lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;<br />    &lt;?php else: ?&gt;<br />      &lt;li&gt;&lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />    &lt;?php endif; ?&gt;<br /><br />  &lt;?php endforeach; ?&gt;</code><br /><br />Which basically means don't show any items that aren't at depth 0 which means root items.  And I've added this block to show sublevel items:<br /><code>&lt;div id =&quot;subCat&quot;&gt;<br />  &lt;?php foreach ($categoryRecords as $categoryRecord): ?&gt;<br /><span style="color:red">    &lt;?php if ($categoryRecord['depth'] == 0) { continue; } ?&gt;<br />    &lt;?php if (!$categoryRecord['_isSelectedBranch']) { continue; } ?&gt;</span><br /><br />    &lt;?php if ($categoryRecord['<span style="color:red">_isSelected</span>']): ?&gt;<br />      &lt;li&gt;&lt;b&gt;&lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;&lt;/b&gt;&lt;/li&gt;<br />    &lt;?php else: ?&gt;<br />      &lt;li&gt;&lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;&lt;/li&gt;<br />    &lt;?php endif; ?&gt;<br /><br />  &lt;?php endforeach; ?&gt;<br />&lt;/div&gt;</code><br /><br />Which means, skip root items, and only show menu items in selected branch (meaning root parent is selected).<br /><br />Here's a working link: http://www.mercerdesign.biz/cms/categoryList.php?Products-2<br /><br />You'll notice the sub menu needs to be styled but I'll leave that to you.<br /><br />Hope that helps!<br />]]></description>
          <pubDate>Wed, 11 Mar 2009 13:09:28 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196228#post2196228</guid>
        </item>
                <item>
          <title>Re: [chassa2556] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196216#post2196216</link>
          <description><![CDATA[It would just be two levels deep .&amp;#10;&amp;#10;Another question could I change the design so the News category would have a slightly different design layout to say products?<br />]]></description>
          <pubDate>Tue, 10 Mar 2009 15:50:33 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196216#post2196216</guid>
        </item>
                <item>
          <title>Re: [Dave] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196215#post2196215</link>
          <description><![CDATA[<a target="_blank" href="http://www.mercerdesign.biz/cms/categoryList.php?News-1">http://www.mercerdesign.biz/cms/categoryList.php?News-1</a>&amp;#10;&amp;#10;But the sub categories would go underneath the categories eg News | Products | Contact would be on the top row and in a row underneath (when news is selected) would be News 1 | News 2 | News 3.<br />]]></description>
          <pubDate>Tue, 10 Mar 2009 15:47:57 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196215#post2196215</guid>
        </item>
                <item>
          <title>Re: [chassa2556] Multi-level Category Functions</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196211#post2196211</link>
          <description><![CDATA[Hi Charles,<br /><br />Can you post some mockup html that shows what you want it to generate?  How many levels deep with the menu be?<br /><br />Thanks!<br />]]></description>
          <pubDate>Tue, 10 Mar 2009 12:18:22 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196211#post2196211</guid>
        </item>
                <item>
          <title>How to show sub menus separately with categories</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2196207#post2196207</link>
          <description><![CDATA[Hi Dave<br /><br />I've followed this and am getting to the first level of navigation using your code. Here is my header:<br /><blockquote><br />  list($categoryRecords, $selectedCategory) = getCategories(array(<br />    'tableName'           =&gt; 'category',<br />    'selectedCategoryNum' =&gt; '',         // defaults to getNumberFromEndOfUrl()<br />    'categoryFormat'      =&gt; 'showall',  // showall, onelevel, twolevel<br />  ));<br /></blockquote><br /><br />And here is my viewer code:<br /><br /><blockquote><br />&lt;ul&gt;<br />  &lt;?php foreach ($categoryRecords as $categoryRecord): ?&gt;<br />    &lt;?php echo $categoryRecord['_listItemStart'] ?&gt;<br /><br />    &lt;?php if ($categoryRecord['_isSelected']): ?&gt;<br />      &lt;b&gt;&lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;&lt;/b&gt;<br />    &lt;?php else: ?&gt;<br />      &lt;a href=&quot;&lt;?php echo $categoryRecord['_link'] ?&gt;&quot;&gt;&lt;?php echo $categoryRecord['name'] ?&gt;&lt;/a&gt;<br />    &lt;?php endif; ?&gt;<br /><br />    &lt;?php echo $categoryRecord['_listItemEnd'] ?&gt;<br />  &lt;?php endforeach; ?&gt;<br />&lt;![endif]--&gt;<br />  &lt;/ul&gt;<br />&lt;/li&gt;<br />&lt;/ul&gt;<br />&lt;/div&gt;<br />&lt;div id =&quot;subCat&quot;&gt;sub categories go here&lt;/div&gt;<br /></blockquote><br /><br />My question is how can I make the subcategories go into the div (called subCat see code above) below the parent. So when I click on News on the uppermost div News 1 |  News 2 | News 3 appears on the div below??<br />]]></description>
          <pubDate>Tue, 10 Mar 2009 11:15:03 -0700</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2196207#post2196207</guid>
        </item>
              </channel>
    </rss>
  