Latest Register Log In

+ Advanced Search

Category Types

Category Types
09/24/03 (Edited 03/11/14)

Sometimes you have several types of categories that should be separated to different spots. For example, you might want a group of regional subcategories separated from topic subcategories.

By default, you have one type of category: regular. Suppose you wish to create another group called 'special'.

First, make sure you've switched category types on at Admin Panel -> Settings -> Switches. Then go to Admin Panel -> Categories -> Category Settings. 'Category Types' is near the top. Add a comma after the 'regular' you see there, and type your new group (do not leave a space). In this case, we'll now have 'regular,special'. Also choose the friendly english display language for it which will be used on the edit/submit category pages. Save your settings.

Next, edit your 'main index' (main.tpl) and 'display articles in category' (displaylinks.tpl) templates at Admin Panel -> Themes -> Manage Templates. In order to create a unique style for this category type, copy the style which has been used for regular categories and change it to fit what you wish for your new group. For example:
<blink><b>Extra special type of category: <a href="{CATURL}">{CATNAME}</a></b></blink> <br >
<!-- END SPECIAL -->

You must add the new type code for each category type you add, or categories of that type will be invisible.

By placing that HTML where you want it, you can make the special categories appear in a special place such as at the very top.

Category types apply to both top level categories and subcategories, but not within the <!-- BEGIN SUBSUB --> nested subcategory list inside each category display box. You could leave that list unseparated, remove the <!-- BEGIN SUBSUB --> area or you could use conditionals along the lines of <IF {CATTYPE} is special>{CATNAME}</IF> in there. If you do the later, you'll need to add type to the subhtmlfields tweak so that the type field gets included in the cached data.

Description Creating special categories.
Views 4041 views. Averaging 1 view per day.