<?xml version="1.0" encoding="UTF-8"?>    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
      <channel>
        <title>Category - How to display the top level items</title>
        <link>https://interactivetools.com/forum/forum-posts.php?Category---How-to-display-the-top-level-items-78401</link>
        <description></description>
        <pubDate>Fri, 15 May 2026 04:33:45 -0700</pubDate>
        <language>en-us</language>
        <atom:link href="https://interactivetools.com/forum/forum-posts.php?rss=1&amp;Category---How-to-display-the-top-level-items-78401" rel="self" type="application/rss+xml" />

                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229046#post2229046</link>
          <description><![CDATA[<p>Hi Gerg</p>
<p>It's all good now!</p>
<p>Nice job, Thanks!</p>
<p>Jac</p>]]></description>
          <pubDate>Thu, 10 Jan 2013 09:45:27 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229046#post2229046</guid>
        </item>
                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229043#post2229043</link>
          <description><![CDATA[<p>Hi Jac,</p>
<p>Sorry, I thought you wanted to create a completetly seperate page. If you want to display all of the parent categorys if no sub category is selected on the same page, I would do something like this:</p>
<p>/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */<br /><br />// load viewer library<br />$libraryPath = 'cmsAdmin/lib/viewer_functions.php';<br />$dirsToCheck = array('/home/quanmax/public_html/','','../','../../','../../../');<br />foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}<br />if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }</p>
<p>// Get the last number from the URL, if there isn't one there set the number as zero. </p>
<p>$<span style="color:#ff0000;">mainCat</span> =  intval(getLastNumberInUrl());</p>
<p>// load detail record from 'category' </p>
<p>list($categoryRecords, $categoryMetaData) = getRecords(array( <br />'tableName' =&gt; 'category',<br />'where' =&gt; whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown <br />'loadUploads' =&gt; true, <br />'allowSearch' =&gt; false, <br />'limit' =&gt; '1', <br />)); <br />$detailRecord = @$categoryRecords[0]; // get first record <br />if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found <br /><br />// load list records from 'category' <br />list($leftMenu, $categoryMetaData) = getCategories(array( <br />'tableName' =&gt; 'category', <br />'loadUploads' =&gt; true, <br />'categoryFormat' =&gt; 'twolevel' <br />)); </p>
<p>//Show either level one or two category pages depending on if a there is a number in the URL<br />list($rightMenu, $categoryMetaData) = getCategories(array( <br />'tableName' =&gt; 'category', <br />'loadUploads' =&gt; true, <br />'rootCategoryNum' =&gt;  $<span style="color:#ff0000;">mainCat</span>, <br />'categoryFormat' =&gt; 'onelevel' <br />));</p>
<p><br />So if there isn't a number in the URL, the rootCategoryNum will default to 0, and the page will only display top level items. You should be able to keep the same body code as you used last time.</p>
<p>Thanks!</p>
<p>Greg</p>]]></description>
          <pubDate>Thu, 10 Jan 2013 09:35:03 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229043#post2229043</guid>
        </item>
                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229035#post2229035</link>
          <description><![CDATA[<p>Hi Gerg</p>
<p>One problem.</p>
<p>The top level items is fine on the first level page.</p>
<p>but when go to secand and thried level.</p>
<p>Top level items also display on other level.</p>

<p>Jac</p>

]]></description>
          <pubDate>Thu, 10 Jan 2013 02:09:28 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229035#post2229035</guid>
        </item>
                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229034#post2229034</link>
          <description><![CDATA[<p>Hi Gerg</p>
<p>Nice now! Thanks!!</p>
<p>Jac</p>]]></description>
          <pubDate>Thu, 10 Jan 2013 01:46:54 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229034#post2229034</guid>
        </item>
                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229026#post2229026</link>
          <description><![CDATA[<p>Hi Jac,</p>
<p>You could change your $rightMenu getRecords function so that it only gets the top level items like this:</p>
<p>list($rightMenu, $categoryMetaData) = getCategories(array( <br /> 'tableName' =&gt; 'category', <br /> 'loadUploads' =&gt; true, <br /> 'rootCategoryNum' =&gt; 0, <br /> 'categoryFormat' =&gt; 'onelevel' <br /> ));</p>
<p>I've set the rootCategoryNum to zero, so the function will start looking for items at the very top level.</p>
<p>The categoryFormat is set to onelevel, so it will only return the level you have selected.</p>
<p>You might be able to remove the $categoryRecords getRecords function, but I'm not sure if it is used anywhere else on your page. </p>
<p>Thanks!</p>
<p>Greg</p>]]></description>
          <pubDate>Wed, 09 Jan 2013 10:23:36 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229026#post2229026</guid>
        </item>
                <item>
          <title>Category - How to display the top level items</title>
          <link>https://interactivetools.com/forum/forum-posts.php?postNum=2229023#post2229023</link>
          <description><![CDATA[<p>Hi, </p>
<p>There are 3 levels on my category.</p>
<p>On the first category page.</p>
<p>It should display  top level items. </p>
<p>Now the page is display the secand level list.</p>
<p>How can I display the top level?</p>
<p>Here is the page:</p>
<blockquote>
<p><a href="http://174.132.79.189/~quanmax/en/category-list.php" rel="nofollow">http://174.132.79.189/~quanmax/en/category-list.php</a></p>
</blockquote>

<p>Header code:</p>
<blockquote>
<p>&lt;?php<br />/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */<br /><br />// load viewer library<br />$libraryPath = 'cmsAdmin/lib/viewer_functions.php';<br />$dirsToCheck = array('/home/quanmax/public_html/','','../','../../','../../../');<br />foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}<br />if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }</p>
<p>// load detail record from 'category' </p>
<p>list($categoryRecords, $categoryMetaData) = getRecords(array( <br />'tableName' =&gt; 'category',<br />'where' =&gt; whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown <br />'loadUploads' =&gt; true, <br />'allowSearch' =&gt; false, <br />'limit' =&gt; '1', <br />)); <br />$detailRecord = @$categoryRecords[0]; // get first record <br />if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found <br /><br />// load list records from 'category' <br />list($leftMenu, $categoryMetaData) = getCategories(array( <br />'tableName' =&gt; 'category', <br />'loadUploads' =&gt; true, <br />'categoryFormat' =&gt; 'twolevel' <br />)); <br /><br />list($rightMenu, $categoryMetaData) = getCategories(array( <br />'tableName' =&gt; 'category', <br />'loadUploads' =&gt; true, <br />'rootCategoryNum' =&gt; $detailRecord['num'], <br />'categoryFormat' =&gt; 'onelevel' <br />));</p>
<p><br />?&gt;</p>
</blockquote>

<p>Body:</p>

<blockquote>
<p>&lt;?php foreach ($rightMenu as $listRecord): ?&gt;<br /><br />&lt;table border="0" cellspacing="0" cellpadding="0" width="700"&gt;<br />&lt;span <br />id="news_list_lab"&gt;<br />&lt;tbody&gt;<br />&lt;tr&gt;<br />&lt;td width="185" valign="top" class="content_s_000"&gt;&lt;?php foreach ($listRecord['images'] as $index =&gt; $upload): ?&gt;<br />&lt;img src="&lt;?php echo $upload['thumbUrlPath'] ?&gt;" <br />alt="&lt;?php echo htmlencode($productsRecord['title']) ?&gt;" width="&lt;?php echo $upload['thumbWidth'] ?&gt;" height="&lt;?php echo $upload['thumbHeight'] ?&gt;" hspace="20" /&gt;&lt;br/&gt;<br />&lt;?php endforeach ?&gt;&lt;/td&gt;<br />&lt;td align="left" valign="top" class="content"&gt;&lt;b&gt;&lt;a &lt;?php echo ($listRecord['depth']+1)*10; ?&gt;px;" href="&lt;?php if($listRecord['depth'] == '0'){ <br />echo 'category-list.php?num='.$listRecord['num']; <br />}elseif($listRecord['depth'] == '1'){ <br />echo 'category-list.php?num='.$listRecord['num']; <br />}elseif($listRecord['depth'] == '2'){ <br />echo 'products-detail.php?num='.$listRecord['num']; <br />} <br />?&gt;" &gt; &lt;?php echo htmlencode($listRecord['name']) ?&gt;&lt;/a&gt;&lt;/b&gt; &lt;?php echo $listRecord['intro']; ?&gt;&lt;/td&gt;<br />&lt;/tr&gt;<br />&lt;tr&gt;<br />&lt;td colspan="2" align="right" class="line_h_dot_black"&gt;&lt;a style="margin-left:&lt;?php echo ($listRecord['depth']+1)*10; ?&gt;px;" href="&lt;?php if($listRecord['depth'] == '0'){ <br />echo 'category-list.php?num='.$listRecord['num']; <br />}elseif($listRecord['depth'] == '1'){ <br />echo 'category-list.php?num='.$listRecord['num']; <br />}elseif($listRecord['depth'] == '2'){ <br />echo 'products-detail.php?num='.$listRecord['num']; <br />} <br />?&gt;" &gt;&lt;img <br />class="banner_line_no" hspace="0" alt="See More!" vspace="5" <br />src="images/share/button_more.gif" width="41" <br />height="11" /&gt;&lt;/a&gt;&lt;/td&gt;<br />&lt;/tr&gt;<br />&lt;/tbody&gt;<br />&lt;/span&gt;<br />&lt;/table&gt;<br /><br />&lt;?php endforeach ?&gt;</p>
</blockquote>

<p>Thanks!</p>
<p>Jac</p>]]></description>
          <pubDate>Wed, 09 Jan 2013 09:47:27 -0800</pubDate>
          <guid isPermaLink="true">forum-posts.php?postNum=2229023#post2229023</guid>
        </item>
              </channel>
    </rss>
  