Skip navigation

PHP JUGNOON vCategory Documentation

Overview


A complete script with all basic and advance features for managing and generating almost any type of directory & category listings, navigations, menus, dropdowns, navbars and more.

View details »


Change Log

Current version of vcategory script is 1.0.0. There is no change log, bug fixes or update reports available yet.


What's Included

Core files related to vcategory script includes.


root/
├── adm/sc/categories/ (manage categories)
├── include/bll/categoriesmgt.php (business layer for category data processing)
├── include/entity/category.php (entity model for category table and behaviour)
├── include/scripts/categories.php (core script for generating almost any type of category, directory, menus, dropdowns, navbars, thumbs etc listings)
├── include/db.php (core data access layer)
├── include/config.php (core website configurations)

Contents

Default folder where to store category thumbs, mid thumbs and original photo. You can change folder and adjust new path via include/utility/urls.php

contents/
├── category/ (for storing category thumbs)
│    ├── main/ (for storing category main photo.)
│    ├── midthumb/ (for storing category midthumb photo.)

CSS

Jugnoon vCategory Script uses latest bootstrap 3.0 css and js files by default with some custom css. You can adjust custom css based with your own design requirements.

css/
├── base/ (main theme)
│    ├── images/ (Base theme images)
│    ├── bootstrap-glyphicons.css
│    ├── bootstrap.min.css
│    ├── layout.css (website own style sheet)
├── fonts/ (glyphicons fonts)

Installation


Dependencies

Feature Dependency
Memcache Memcache Installation. Jugnoon vCategory Script support cache category listing content. Be default its disabled. You can enable it from include/settings/general.php : Feature_Cache = 1. In order to enable it you must first install memcache or replace it with your own cache module. Memcache logic implemented under file include/memcache.php

Steps

Installation steps

  • Copy files from bundle/project/ on root of your website project.
  • Copy files from bundle/plugins/ on root of your website project.
  • Go to include/db.php page and adjust database connection string settings.
  • Go to include/settings/general.php page and enable, disable all features you needed.

Installation Video


Database


Tables

There is only one table required to manage category listings. Category script is located under database folder. Optional sample data script is also available which will add all data you can use either for testing or adjust it according to your application needs.

tables/
├── categories 

Plugins


List of third party plugins we used in membership kit. Most of plugins located in folder plugins. All plugins we used are available for free but still you must use & obey their own license terms & conditions before using it.

Name Detail
Twitter Bootstrap http://getbootstrap.com/
Plupload For uploading photos. http://www.plupload.com/
Chosen Dropdown Plugin https://github.com/harvesthq/chosen/blob/master/LICENSE.md

Configurations


Core Configurations

Core configuration of membership script located at include/config.php file.

Name Default Value Detail
ROOTPATH Website Root Path Represent root path of membership script.
UPLOAD_DIRECTORY_PATH ROOTPATH . "contents/member/" Represent member content directory path
SITE_DOMAIN http://localhost/vcategory/ Represent website url
Page_Caption vCategory Append it with each page title e.g Create Account - vCategory
SITENAME vCategory Can be used as logo
LOGOURL Logo URL Logo image url
THEMEPATH SITE_DOMAIN . "css/base/" Path of core css theme used in project

Thumb Settings

vCategory Script allow you to upload photo thumbs with each category record. Two types of thumbs captured from source photo, i: mid thumb (fit for blog or preview level), ii: normal thumb (fit for normal category listings).

Name Default Value Detail
ThumbWidth 150 Set thumb width. (for thumb generation)
ThumbHeight 150 Set thumb height. (for thumb generation)
MidWidth 500 Set medium thumb width.
MidHeight 500 Set medium thumb height.

Category Types & Mode Configurations

vCategory script allow you to group categories via types e.g (separate categories for photos, videos, products, classified listings etc) and further group similar type content further via modes e.g cars categories into (automobiles, vehicle styles, vehicle types) or photo categories into (animals, entertainment, abstract etc). You can set category types and modes via include/config.xml file.

Note: keep in mind, use unique ids for each category or mode types. Don't delete category types etc otherwise you will lost all categories within it.


Data Access Layer


Files

All data processing and busines logic processing handle by files located at include/bll/ folder.

include/bll/
├── categoriesmgt.php (for handling categories data access & business layer managment)

Data Access Examples

vCategory script uses advance PDO script for handling and processing data between database and website. We have extended PDO classes for making code as much easy as we can. Here is list of sample example code.

Add Operation

$db = new DB();
$lastinsertid = true;
$queryAnalysis = false;
$id = $db->Insert("[tablename]", $fields, $lastinsertid, $queryAnalysis); 
return $id;

[tablename] represent table name, while $fields represent array of fields with values e.g

$fields = array('field01' => 'value01', 'field02' => 'value02');

Update Operation

$db = new DB();
return $db->Update("[tablename]", $fields, $filters, $queryanalysis);

$filters represent sql where filter clause.

$filter = array('id' => '23', 'isenabled' => '1'); // goes to WHERE id = 23 AND isenabled = 1;

Delete Operation

$db = new DB();
$db->Delete("[tablename]", $filters);

Count Operation

$db = new DB();
return $db->Count("[tablename]", $filters);

Fetch Operation

$db = new DB();
return fetch_values($fields, $isadmin, $filters, $ismultiple = false, $queryonly=false);

$fields list of table fields to fetch e.g "username, firstname, lastname, email"
$isadmin true or false
$filters where clause array of values to filter records
$ismultiple true or false for fetching single or multiple records
$queryonly true or false for returning sql query for analysis purpose.


Security


CSRF Authentication

In vCategory script and almost every other project, all server side add, update or delete processing handle by ajax request. Due to security risk of CSRF attacks to access sensitive handler files directly, we implemented advance CSRF protection script.

A unique token is generated after every page or ajax request and later it's appended with ajax request and then validated at server processing time. CSFR token is first time generated by script located at include/security/generatetoken.php. This file is called in footer.php page. Please don't remove this include file otherwise no ajax operations will take place.


Categories

vCategory script provide both category management and listings.


Category Listing

There is only single core file categories.php class: vskCategory responsible for generating almost any type of categories and directory listings. File located at include/script/ directory. For all pratical examples and usage guide of categories.php click here..

vskCategory Class Properties

Name Default Value Detail
outputType 0 Set return output type.
--> 0: return complete panel
--> 1: return div output with ul
--> 2: return ul li listing
--> 3: return array
--> 4: return dropdown list
--> 5: bootstrap 3.0 list
--> 6: thumb display listing
headingTitle "" Setup heading title if complete panel outputType : 0 selected.
isParents false if true it will load only parent categories, otherwise all n-level categories fetch unless restricted through maxLevel property.
isAll true If true will load all categories of specific category type. If false will load only categories set via property totalLinks
totalLinks 5 It works if isAll : true, it will set maximum no of records to be fetched.
moreLinkUrl "" This will set url of more link if you want to add, at the end of listing. Works if isAll : true.
moreLinkText "" Set more link caption. Works if isAll : true.
moreLinkTooltip "" Set tooltip for more link.
showCounter false Display total records counter with each link. Records / stats stored in records field of category table.
totalColumns 1 Set total number of columns to display records.
css "" Set css for outter div for category listings.
parentCss "" Set css for parent ul element.
childCss "" Set css for child ul element.
parentliCss "" Set css for parent li element.
liCss "" Set css for child li element.
liActiveCss "" Set css for active li element.
linkCss "" Set css for link element.
linkActiveCss "" Set css for active link element.
panelCss "" Set css for core panel if outputType : 0 selected
panelHeadingCss "" Set css for panel heading div if outputType : 0 selected.
parentid -1 Set parent id to fetch records.
mode 0 Filter category records via mode option
order level asc Order category listing records
type 0 Filter category records via category types. Category types set through include/config.xml
url # Set url patter for each category item. e.g "[CID]/[CT].html"; where script will automatically change [CID] -> categoryid, [CT] -> category term or category name.
linkAttr "" Adjust category link caption with addition info. e.g instead of displaying <a><[CN]</a> sometimes needed to display <a><span class='icon icon-trash'> [CN]</a>
parentlinkAttr "" Set same linkAttr to parent links only.
url # Set url patter for each category item. e.g "[CID]/[CT].html"; where script will automatically change [CID] -> categoryid, [CT] -> category term or category name.
linkAttr "" Add additional attibutes with each category link
parentlinkAttr "" Add additional attibutes with each parent category link
totalParents 0 Set total parents to fetch.
totalChilds 0 Set total childs within each parent to fetch.
customValue "" Custom Value e.g <span>[CN]</span > [CT],[CID] where [CN] -> category name, [CT] -> term and [CID] -> category id */.
parentCustomValue "" Set customValue for parent categories only.
repeatDirection 0 Set repeat direction of categories if totalColumns is set more than 1. 0: vertical direction, 1: horizontal direction.
columnWidth "" Automatically calculated if not set and if totalColumns is greater than 1.
loadParentCategories false Load selected parent categories only
maxlevels 0 Restrict parent / child categories to certain limit. 0 unlimited
isCache false Cache category listing data for specified interval. Memcache must be installed and enabled for this option to work.
search Filter category records via search terms
quernAnalysis false If enabled only sql query will be returned. It help you to check which query actuall running while fetching records.
Dropdown Options
controlID "" Set dropdown control id and name attribute.
defaultText "" Set text for default optional option element of dropdown.
defaultValue "" Set value for default optional option element of dropdown.
isCategoryID "" Load dropdown values with categoryid or term
selectedValue "" Pass selected values to dropdown via this option.
multipleChoices "" Set multiple choice selection option for dropdown.
optionsOnly "" This option return only list of option elements except select
dropdownCss "form-control input-sm" Set css for dropdown element
Other Options
activeValue "" Pass active value categoryid or term, if multiple then separated by comma ,
Thumbnail Options
imagewidth 0 Set thumb width if outputType: 6
imageheight 0 Set thumb height
thumbpreviewoption 2 Set preview output type, 2: thumb, 1: mid thumb, 0: original
showRecords false Display records stats below thumbnail.
recordCaption "" Set record caption if showRecords is true.
captionCss light Set css for record caption if showRecords is true
thumbcss img-rounded set thumbnail css. i: img-rounded, ii: img-circle, iii: img-thumbnail

Category Management


vCategory Script provide professional, easy to use user interface for managing category records in efficient and simple way. Check simple output via screen shot



For live demo Click Here.

Category Managment Core Files


JUGNOON vCategory script support advance, easy to use, next generation user interface within single page. This topic will provide overview of all modules involve in completing various operations.

By default manage category file located in folder /adm/sc/categories/

All modules involve in category processing include in /modules/ folder within categories directory.


Modules

List of all modules responsible for performing various operations in manage category section includes

  • attachimagehandler.php (responsible for processing uploaded category thumbs)
  • attachimagejs.php (jquery javascript codes responsible for real time category thumbs uploading. this files uses plupload photo uploader plugin to upload photos)
  • form.php (loading through modal popup / jquery ajax. responsible for add or edit category information and uploading thumbs)
  • handler.php (responsible for processing almost all operations including add, edit or delete). This file access is protected through CSRF token, referer checker, ajax type checker security measures to prevent it from unauthorized access
  • js.php (all jquery javascript code included here. responsible for handling all jquery javascript operations within form)
  • list.php (responsible for loading categories either directly or through jquery)
  • menu.php (responsible for generating toolbar menu)

All these files togather create a professional category management experience.

You can extend same listing and management code for other data processing within your php projects.

Note: in order to export all these files please make sure to include include/security/generatetoken.php file within your page. This file initialize csrf token generation and add few placeholder for storing csrf token and access id. If its not included then you may receive invalid token or may be jquery operation fail to perform properly.


CSRFGuard_1019959505

Newsletter

Enter your e-mail and subscribe to our newsletter in order to get email notifications of our product upgrades and new product release.

Follow Us