CNCat 4.1.1 Frequently Asked Questions
- Design
- Banners
- How to Enable Banners?
- How to Modify Banner Code?
- How to Add New Banner?
- How to Swap Banners According to Current Category?
- API
Design
How to Modify Catalogue Design?
The instructions on how to modify design see in «Design Modification» manual.
How to Insert PHP-Code onto the Page?
You can create files _top.php and _bottom.php in the catalogue root folder. These files will be executed and enabled in the beginning and in the end of all catalogue user pages.
Or you can use the way PHP-code is inserted for banners (file /cncat_config/banners.php) see section «Banners».
Banners
How to Enable Banners?
First, enable the option «Display banners» (Settings – Catalogue – General Setting).
Then, find banners.default.php in /cncat_config/ folder and copy it into the banners.php.
Go to the catalogue and check the enabled banners.
How to Modify Banner Code?
The code for banners is defined in /cncat_config/banners.php file.
Each banner is described in the following way:
|
$CNCAT["banner"]["banner ID"] =<<<CNCAT_40_BANNER banner code CNCAT_40_BANNER; |
Also you can change the code for the banners you need and delete it for useless banners.
By default, there are seven banners which ID's are listed below:
page_top – banner at the top of the page;
page_left – banner in the left-hand part of the page;
page_right – banner in the right-hand part of the page;
page_bottom – banner at the bottom of the page;
items_top – banner before the links section;
items_middle – banner in the middle of the links section;
items_bottom – banner after the links section.
Banner code can contain any HTML-text except for the string «CNCAT_40_BANNER».
Also, you can define the banner code as a simple string, for example:
|
$CNCAT["banner"]["banner_identifier"] = "banner code"; |
In this case, you need to place symbol «\» before the double quotes, for example:
|
$CNCAT["banner"]["page_top"] = "Ltd \"Catalogue-Construct\" – constructing catalogues."; |
How to Add New Banner?
In case none of the default locations of the standard banners suites you, you can either change the location of one of seven banners, or add your own banner.
To add new banner, create the identifier for it, for example, «my_banner». Then describe this banner code in the same way as a standard one.
After that, add the banner into the desired place in the design theme, for example:
|
{$CNCAT[banner][my_banner]} |
How to Swap Banners According to Current Category?
In the banners.php file, you can insert arbitrary PHP-code, which will display banners depending on the current category.
The identifier of each category is displayed in the section «Categories Management» of the administrator interface.
To get the identifier of the current category, use:
|
$cid = $CNCAT["page"]["cid"]; |
Then, display banner depending on the category, for example:
|
if ($cid==10) { $CNCAT["banner"]["banner_identifier"] =<<<CNCAT_40_BANNER banner code for the category 10 CNCAT_40_BANNER; } else { $CNCAT["banner"]["banner_identifier"] =<<<CNCAT_40_BANNER banner code for other categories CNCAT_40_BANNER; } |
See also «How to Get Information on Current Category?».
API
How to Get Information on Current Category?
Information on current category is stored in the array $CNCAT[“page”][“cat”]. The values of the array elements are the following:
|
id |
Category identifier. Also availabe using variable $CNCAT[“page”][“cid”] |
|
id_full |
Parent categories and current category identifiers, separated by the symbol «/», for example: «311/69/206» (311 – root, 206 – current category). |
|
parent_id |
Parent category identifier. It is equal to «-1» for the root category |
|
child_id_list |
The list of child categories identifiers (in one line separated by commas), for example: «15,23,53» |
|
title |
Category name |
|
path |
The part of the path to the current category, for example: «business» (without «/» in the beginning and in the end of line) |
|
path_full |
Full path to the current category, for example: «auto/business» (without «/» in the beginning and in the end of line) |
|
url |
Path of the current category, for example: «/cncat/auto/business/» |
|
item_count |
The number of links within the category |
|
item_count_full |
The number of links within the category, including the links within the child categories |
|
is_link |
Shows whether the category is the link or not |
|
image_mime |
MIME-code for the category image. Empty line if there is no image |
|
meta_keywords |
Keywords for META keywords tag |
|
meta_descr |
Description for META description tag |
