Categories

A pre built function to create categories tree for any plugin. You can style it as you wish within template
  • Home
  • About Project
  • What's Integrated
    • Bootstrap
      • CSS
        • Grid System
        • Typography
        • Code
        • Tables
        • Forms
        • Buttons
        • Images
        • Helper Classes
        • Responsive Utilities
      • Components
      • Javascript
      • Plugins
        • Bootstrap Dual Listbox
        • Bootstrap Datetime Picker
        • Bootstrap File Input
        • Bootstrap Select
        • Awesome Bootstrap Checkbox
        • Bootstrap Notify
        • Bootstrap Tags
    • jQuery
      • jQuery
      • jQuery UI
      • jQuery UI Touch Punch
      • X-editable
      • jQuery confirm
      • Select2
      • TinyMCE
      • Smart Menus
      • Highlight
      • jQuery Validation
      • Moment.js
      • jQuery AnimateCSS
      • jQuery Backstretch
      • jQuery Countdown
      • JS Equal Height Responsive Rows
      • Favico.js
      • jQuery Lightbox Evolution
      • jQuery Sliphover
      • Strenght Meter
      • Viewport Checker
    • PHP
      • HTML2PDF
      • PclZip
      • PHPMailer
      • phpThumb()
      • Smarty
    • CSS
      • Animate CSS
      • Thumblr Style Cog Spinners
      • Font Awesome
    • Other
  • Core Components
  • Administration
    • Tools & Settings
    • Pages
    • Widgets
    • Navigation
    • Users
    • Groups
    • Fields
    • Modules
    • Geo Location
    • Slider
  • Custom Modules
    • Jobs
    • Resume Builder
    • Surveys
    • Contact
    • Downloads
    • Weblinks
  • Examples
    • Page Widgets
    • Registered user
    • Silver member
    • Gold member
    • Platinum member
    • Categories
    • Slider
    • Template
  • How To
  • Home
  • Services
  • Portfolio
  • What We Use
  • Contact
  • About
  • Services
  • Portfolio
  • Contact
  • Search
    • All Members
    • New members
    • Members Online
  • Information
    • Help & FAQ
    • Terms of Service
    • Privacy
  • Home
  • Home
Call PHP function to retrieve array of categories from database and assign variable for Smarty. You need to define table name, name of id column and name or parent id column and conditions:
$categories = get_categories_tree(menuitems, 'id', 'pid', ' WHERE menu_id = 1');
$smarty->assign("Categories", $categories, true);
Define function in Smarty template file:
{function CategoriesTree level=0}
  {if $level == 0}
    {assign "collapse" ""}
  {else}
    {assign "collapse" "collapse"}
  {/if}
  <ul class="{$collapse}" id="cat-{$level}" style="list-style: none">
  {foreach $data as $category}
    {if $category.pid == $level}
      {if isset($category.children)}
    <li class="panel"><a data-toggle="collapse" data-parent="#cat-{$level}" href="#cat-{$category.id}">{$category.title}</a>
  {CategoriesTree data=$category.children level=$category.id}
    </li>
      {else}
    <li class="panel">{$category.title}</li>
      {/if}
    {/if}
  {/foreach}
  </ul>
{/function}
Call function within same template file:
{CategoriesTree data=$Categories}