Location: PHPKode > scripts > Unlimited sub-categories > unlimited-sub-categories/Manual.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>USC Class Manual</title>
<style>
.code_div
{
border-style:dashed;
border-width:1px;
border-color:#333333;
background-color:#FFE1F0;
position:static;
text-align:left;
width:auto;
font-size:11px;
font-family:Geneva, Arial, Helvetica, sans-serif;
padding:5px;
}
.variable
{
color:#0000bb;
}
.normal
{
color:#333333;
font-size:12px;
}
.big_title
{
font-size:24px;
color:#FF0000;
font-weight:bold;
}
.medium_title
{
font-size:16px;
color:#003300;
font-weight:bold;
}
.normal_title
{
font-size:14px;
color:#FF3300;
font-weight:bold;
}
.style1 {font-size: 12px}
.style2 {font-weight:bold; font-size: 16px;}
</style>
</head>

<body style="font-family:Tahoma">

  <p align="center"><strong class="big_title">USC Class Manual</strong><font color="#FF9900" size="1"> By Shadi Ali</font></p>
  <p align="left" class="medium_title">MySQL Table:</p>
  <p align="left" class="normal"><font color="#000000" size="2">This class uses a MySQL table to store the categories data, look below for the default table structure</font>:</p>
 <div class="code_div">   CREATE TABLE `categories` ( <br />
   `id` BIGINT NOT NULL   AUTO_INCREMENT , <br />
   `position` VARCHAR( 255 ) NOT NULL , <br />
   `c_name` VARCHAR(   255 ) NOT NULL , <br />
   `c_desc` TINYTEXT NOT NULL , <br />
   `c_icon` VARCHAR( 255 )   NOT NULL , <br />
   `c_group` VARCHAR( 255 ) NOT NULL default '0' , <br />
   PRIMARY KEY (   `id` ) <br />
 ); </div>

 <hr />
<p class="medium_title">Class Variables:</p>
<p class="normal">Here I'm going to explain the class variables</p>
 <p class="variable">$HtmlTree</p>
 <p class="normal">This varialbe holds the default HTML template for the HTML list, It is used only when you call the html_output() function ... its an array and contains 4 elements as the following </p>
 <p><span class="variable">$HtmlTree['header']</span> <span class="normal">This element holds the head of the HTML list template which will be printed only once before the categories list. </span></p>
 <p><span class="variable">$HtmlTree['BodySelected']</span><span class="normal"> This template will be used for the current(selected) category item, it will be displayed once for the selected category ( defined by $id ). </span></p>
 <p><span class="variable">$HtmlTree['BodyUnselected']</span> <span class="normal">This template will be used for the normal category list items, it will be repeated with every  category in the list.</span></p>
 <p><span class="variable">$HtmlTree['footer']</span><span class="normal"> And this one will be printed once at the end of the list.</span></p>
 <p class="normal_title">default value for the $HtmlTree Variable:</p>

 <div class="code_div"><font color="#007700">var </font><font color="#0000bb">$HtmlTree&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">= array( <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">&quot;header&quot;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#dd0000">'&lt;table width=300px border=0 cellpadding=2   cellspacing=2&gt;'</font><font color="#007700">, <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">&quot;BodyUnselected&quot;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">'&lt;tr&gt; <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/td&gt; <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/tr&gt;'</font><font color="#007700">, <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">&quot;BodySelected&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">'&lt;tr&gt; <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#dd0000">&quot;footer&quot;   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#007700">=&gt; </font><font color="#dd0000">'&lt;/table&gt;'</font><font color="#007700">, <br />
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;); <br />
 </font></div>
 <p><br />
</p>
 <p><span class="variable"><font color="#0000bb">$name_prefix</font></span><font color="#0000bb">&nbsp;<span class="normal"> this variable will be printed before the category name depening on its position, i.e: if category position level is 5, the $name_prefix will be printed 5 times before the category name ... default value is a space</span></font></p>
 <p><font color="#0000bb" class="variable">$table_name</font> <span class="normal">this is the categories MySQL table name, if you are using the default structure it should be 'categories'</span></p>
 <p><font color="#0000bb">$itemsTable</font><span class="normal"> in case you want to associate items table to be used with this class, this variable should hold the items table name.</span></p>
 <p><font color="#0000bb">$CID_FieldName</font> <span class="normal">and this one should hold the field name which refere to the category ID. ( <a href="#asc">check associating example at the end of this manual for more explanasion.</a> ) </span></p>
 <hr />
 <p class="big_title">Main Functions/Methods: </p>
 <p class="medium_title">add_new:</p>
 <p class="normal">this method is used to insert new category to the structure , it takes 4 params as the following: </p>
 <p class="normal"><span class="variable">$parent</span> : every category should have a parent category, if it doesn't then it will be a root category ... this variable holds the parent category ID otherwise assign zero.</p>
 <p class="normal"><span class="variable">$name</span>,<span class="variable">$desc</span> and <span class="variable">$icon</span> ( category name , description and icon image url/path )</p>
 <p class="normal_title">example on method usage:</p>
 <div class="code_div"><font color="#0000bb">add_new</font><font color="#007700">(</font><font color="#0000bb">$parent </font><font color="#007700">, </font><font color="#0000bb">$name </font><font color="#007700">, </font><font color="#0000bb">$desc </font><font color="#007700">, </font><font color="#0000bb">$icon </font><font color="#007700">)</font>;</div>
 <hr />
 <p class="medium_title">update:</p>
 <p class="normal">this method is used to update existing category , it takes 5 params as the following: </p>
 <p class="normal"><span class="variable">$id</span>: the ID of category which you want to update. </p>
 <p class="normal"><span class="variable">$parent</span> : every category should have a parent category, if it doesn't then it will be a root category ... this variable holds the parent category ID otherwise assign zero.</p>
 <p class="normal"><span class="variable">$name</span>,<span class="variable">$desc</span> and<span class="variable"> $icon</span> ( category name , description and icon image url/path )</p>
 <p class="normal_title">example on method usage:</p>
 <div class="code_div"><font color="#0000bb">update</font><font color="#007700">(</font><font color="#0000bb">$id </font><font color="#007700">, </font><font color="#0000bb">$parent</font><font color="#0000bb"> </font><font color="#007700">, </font><font color="#0000bb">$name </font><font color="#0000bb"> </font><font color="#007700">, </font><font color="#0000bb">$desc </font><font color="#0000bb"> </font><font color="#007700">, </font><font color="#0000bb">$icon</font><font color="#007700"> ) ; </font></div>
 <hr />
 <p class="medium_title">delete:</p>
 <p class="normal">this method is used to delete existing category and all sub-categories below it, needs 2 params as the following: </p>
 <p class="normal"><span class="variable">$id</span>: the ID of category which you want to delete. </p>
 <p class="normal"><span class="variable">$items</span>: if you are associating items to the categories, assign 1 to delete all associated items otherwise it will delete the categories only. ( <a href="#asc">look below for more information about associating</a> ). </p>
 <p class="normal_title">example on method usage:</p>
 <div class="code_div"><font color="#0000bb">delete</font><font color="#007700">(</font><font color="#0000bb">$id</font><font color="#007700">,</font><font color="#0000bb">$items</font><font color="#007700">)</font></div>
 <hr />
 <p class="medium_title">build_list:</p>
 <p class="normal">this method is used to return an array with the categories,it takes  2 params as the following: </p>
 <p class="normal"><span class="variable">$id:</span> if you want to display an expanded list below a specific category fill its ID , otherwise the list will be expanded from the roots. </p>
 <p class="normal"><span class="variable">$collapesd</span>: determine if the expanding level to be one-level only or unlimited. </p>
 <p>examples on method usage:</p>
 <p class="normal_title">General Usage </p>
 <div class="code_div"><font color="#0000bb">build_list</font><font color="#007700">(</font><font color="#0000bb">$id </font><font color="#007700">, </font><font color="#0000bb">$collapsed</font><font color="#007700">)</font></div>
 <p><span class="normal">I'm going to explain some ways to use this method based on the following list example </span><strong>Category_Name</strong>(<strong>ID</strong>) </p>
 <p class="normal">-Root1 (1)</p>
 <blockquote>
   <p class="normal">-Sub1-1 (2) </p>
   <blockquote>
     <p class="normal">-Sub1-1-1 (3)</p>
     <p class="normal">-Sub1-1-2 (4)</p>
   </blockquote>
   <p class="normal">-Sub1-2 (5)</p>
   <blockquote>
     <p class="normal">-Sub1-2-1 (6)</p>
   </blockquote>
 </blockquote>
 <p class="normal">-Root2 (7)	</p>
 <blockquote>
   <p class="normal">-Sub2-1 (8)</p>
   <p class="normal_title">&nbsp;</p>
 </blockquote>
 <p class="medium_title">Ok lets start ... 	</p>
 <p class="medium_title">&nbsp;</p>
 <p class="normal_title">To expand a root:</p>
 <p class="normal">-Root1 (1)</p>
 <blockquote>
   <p class="normal">-Sub1-1 (2) </p>
   <blockquote>
     <p class="normal">-Sub1-1-1 (3)</p>
     <p class="normal">-Sub1-1-2 (4)</p>
   </blockquote>
   <p class="normal">-Sub1-2 (5)</p>
   <blockquote>
     <p class="normal">-Sub1-2-1 (6)</p>
   </blockquote>
 </blockquote>
 <p class="normal">+Root2</p>
 <div class="code_div"><font color="#0000bb">build_list</font><font color="#007700">(</font> 1 <font color="#007700">)</font></div>
 <hr />
 <p class="normal_title">To display/open one-level only of expanded root:</p>
 <p class="normal">-Root1 (1)</p>
 <blockquote>
   <p class="normal">+Sub1-1 (2) </p>
   <p class="normal">+Sub1-2 (5)</p>
</blockquote>
 <p class="normal">+Root2</p>
 <div class="code_div"><font color="#0000bb">build_list</font><font color="#007700">(</font> 1 <font color="#0000bb"> </font><font color="#007700">, <font color="#0000bb">&quot;</font></font><font color="#0000bb">collapsed&quot;</font><font color="#007700">)</font></div>
 <hr />
 <p class="normal_title">To display/open one-level only of a child category:</p>
 <p class="normal">-Root1 (1)</p>
 <blockquote>
   <p class="normal">-Sub1-1 (2) </p>
   <blockquote>
     <p class="normal">+Sub1-1-1 (3)</p>
     <p class="normal">+Sub1-1-2 (4)</p>
   </blockquote>
   <p class="normal">+Sub1-2 (5)</p>
 </blockquote>
 <p class="normal">+Root2</p>
 <div class="code_div"><font color="#0000bb">build_list</font><font color="#007700">(</font> 2 <font color="#0000bb"> </font><font color="#007700">, <font color="#0000bb">&quot;</font></font><font color="#0000bb">collapsed&quot;</font><font color="#007700">)</font></div>
 <hr />
 <p class="normal_title">And finally to display the full expanded list:</p>
 <p class="normal">-Root1 (1)</p>
 <blockquote>
   <p class="normal">-Sub1-1 (2) </p>
   <blockquote>
     <p class="normal">-Sub1-1-1 (3)</p>
     <p class="normal">-Sub1-1-2 (4)</p>
   </blockquote>
   <p class="normal">-Sub1-2 (5)</p>
   <blockquote>
     <p class="normal">-Sub1-2-1 (6)</p>
   </blockquote>
 </blockquote>
 <p class="normal">-Root2 (7) </p>
<blockquote>
   <p class="normal">-Sub2-1 (8)</p>
</blockquote>
 <div class="code_div"><font color="#0000bb">build_list</font><font color="#007700">(</font><font color="#0000bb"> 0 </font><font color="#007700">)</font></div>
 <hr />
 <p class="style2">browse_by_id:</p>
 <p class="style1">this function returns an array of sub-categories within a specific category .. and takes the category ID as a param<span class="variable"> $id </span></p>
 <div class="code_div"><font color="#0000bb">browse_by_id</font><font color="#007700">(</font><font color="#0000bb"> 0 </font><font color="#007700">)</font></div>
 <hr />
 <p class="style2">fetch:</p>
 <p class="style1">this function returns the category info .. and takes the category ID as a param<span class="variable"> $id </span></p>
 <div class="code_div"><font color="#0000bb">fetch</font><font color="#007700">(</font><font color="#0000bb"> 0 </font><font color="#007700">)</font></div>
 <hr />
 <p class="style2">html_output:</p>
 <p class="style1">this function returns the HTML list output,  and takes the selected category ID as a param or it will print the roots list.</p>
 <p class="style1">you can modify the style of the list by modifying the $HtmlTree variable as showen above.</p>
 <p class="style1">this function is useful when you want to print a auto-expand list depending on the selected category. </p>
 <div class="code_div"><font color="#0000bb">html_output</font><font color="#007700">(</font><font color="#0000bb">$id</font><font color="#007700">)</font></div>
 <hr />
 <p class="medium_title">count_categories:</p>
 <p class="normal">this function returns how many sub categories in below the given category ID,  and takes category ID as a param.</p>
 <div class="code_div"><font color="#0000bb">count_categories($id);</font></div>
 <hr />
 <p class="big_title"><a name="asc">Associating with another Table:</a></p>
 <p class="normal">Currently the class support basic integration with another MySQL table of an items .. for example if you want to use this class with a book store , this class will build the categories and you should have another table contains the books records ( I call it items table ) ... for sure every book record should contain a field refere to its category ID ( I call it <span class="variable">CID</span> ).</p>
 <p class="normal">This class provide basic functions to be executed on the items like .. get the items count in a Top-Level category and delete all items in a Top-Level category too.</p>
 <p class="normal">to integrate your items table with this class , you will need to set 2 main class variables</p>
 <p><font color="#0000bb">$itemsTable</font> <span class="normal">this hold the items table name.</span></p>
 <p><font color="#0000bb">$CID_FieldName <span class="normal">this hold the name of the field in that table which refere to the item's categoryID.</span></font></p>
 <p>&nbsp;</p>
 <p class="normal_title">the functions usage:</p>
 <p class="medium_title">count_items</p>
 <p class="normal">this function returns how many items (total items) in a category and its sub-category,  and takes category ID as a param.</p>
 <div class="code_div"><font color="#0000bb">count_items($id);</font></div>
 <hr />
 <p><span class="medium_title">delete</span>:</p>
 <p class="normal">this method is used to delete existing category and all sub-categories below it, needs 2 params as the following: </p>
 <p><span class="variable">$id</span>:<span class="style1"> the ID of category which you want to delete. </span></p>
 <p><span class="variable">$items</span>:<span class="style1"> if you are associating items to the categories, assign 1 to delete all associated items otherwise it will delete the categories only.</span></p>
 <p class="normal_title">example on method usage:</p>
 <div class="code_div"><font color="#0000bb">delete</font><font color="#007700">(</font><font color="#0000bb">$id</font><font color="#007700">,</font><font color="#0000bb">$items</font><font color="#007700">)</font></div>
 <p><strong><font color="#007700"><br />
   Manual End.</font></strong></p>
 <p>Shadi Ali<br />
 hide@address.com<br />
 Jan/15/2006 </p>
</body>
</html>
Return current item: Unlimited sub-categories