|
CATEGORY RECORDSEach Category in your database will consist of a single record in the Category table. If you use any other application to examine the Category table, don't forget that the literal table name in your database will be prefixed (for example, with the string 'rq_'). Before you can even add your first Item into your database you must create at least one Category with which it will be associated. Categories can be created, then assigned to Editors who then handle Item and Review submissions for the Category. Once you have entered a Category into the Category table, and it has been allocated a Category ID of, say, 9, then you can navigate to the Category detail page via the browsable Item pages, or you can enter the URL to the Category detail page directly into your browser, like so: http://www.mydomain.com/cgi-bin/path/to/... /redqueen/do/redqueen.cgi?module=find_item&category_id=101 Creating a CategoryTo create a Category you can either visit the Database control panel in the administrative area, or visit the Categories control panel--that is, the Category Item Browser. To get there, enter the URL of your admin directory into the address bar of your browser. The URL will be something like: http://www.mydomain.com/cgi-bin/path/to/.../redqueen/do/admin/admin.cgi Your administrative directory should be directory-protected, but once you have logged into the directory look for the Database link in the administrative navigation bar (we'll assume we're going to work directly with the Database control panel, simply because the interface for that is a little more complex than for the Category Browser so we might as well cover it here). After you click on the Database link you'll see a Database menu of table names on the left side of the page. Select 'Category' from the menu of table names. You also need to select an action before pressing the button to load the right Database frame: select 'Add' from the action menu then click on the submit button. When the frame on the right side of the page loads you will see all the fields that can be specified when you create a Category. Unless you have already got around to adding new fields to the Category table you will be presented with a form that looks something like the following (example input values have been added for clarity, and are explained below):
Editable Category FieldsThe following Category fields appear both on the Add Category and Modify Category pages, however the last field displayed above--Is Validated--only appears when the Administrator or an Editor is logged in.
Name
When you name a Category, you name it locally. That is, you provide the name of the
Category relative to some parent Category. In the example, "Baseball/Stuff For Sale"
is the parent Category, and "Baseball Cards" is the name of the new Category.
The full name of the newly-created Category will be "Baseball/Stuff For Sale/Baseball Cards".
Clearly, you cannot include a / in your Category name (as / is the Category delimiter),
otherwise you will get an error message.
The column is Category.name
Subcategory of
Description
Keywords
Template Prefix
Image
Is Validated
Editable Non-Category FieldsIn addition to the Category fields shown above, there may be other non-Category fields which appear on the Add Category and Modify Category pages. The Administrator is able to modify the collection of rating attributes (or types) associated with a Category (which we term a Rating Template), so an extra form element will be present to handle this and will look something like the following (this demo form element is functional so you can play it):
Once you have created a Category, and provided you have assigned rating attributes to its Rating Template, you will see something like the following list, which spells out the component attributes of the Rating Template, and informs you as to whether or not these attributes are inherited from the immediate parent Category (only the case if attributes are not assigned explicitly):
Thus, even if you assign NO rating attributes, the Category will inherit a default Rating Template consisting of just one attribute. Here we see that this default rating attribute allows for rating values from 1 to 5. This is the "Overall" rating attribute, and the rating question that goes with it is "How do you rate [* thing *]?" (note: [* thing *] will get replaced by the name of an Item when it appears on public pages). If you want to assign replacement rating attributes to the Category, transfer the desired set from the pool of available rating attributes (or types). If you need to create new Rating Types, you can create the Category first, then go create the Rating Types, and afterwards modify the Category to include the new Rating Types. Or you can create all conceivable Rating Types first, then create your Categories. The procedure for creating a Rating Type is covered elsewhere in RATING TYPES and should be read with care before you begin populating the Rating Template for a given Category. Briefly, a Rating Type is represented by a record in the RatingType table, and specifies the definition for a ratable attribute. These attributes can then be associated with a Category, a Team, or a Yellow Page. Once you have defined the Rating Template for a Category, adding new rating attributes after you have begun collecting ratings can result in what appears to be only partially-supplied rating information for some records (those collected before the latest attribute was added). So give some thought to the construction of your Rating Templates ahead of time, so as to reduce the likelihood of having to change them later on. In addition to the inheritance of Rating Templates, the Editor for a given Category is also inherited if not explicitly assigned. See EDITORS for the full story on Editor assignments (which is NOT done through the form for Adding or Modifying a Category record, but by directly loading the Add page for the CategoryEditor table). Once you have assigned an Editor for the Category, you will see something like this on the page:
Adding New Category FieldsIf you need to add extra fields to the Category table you can do this. For detailed information on the process of adding columns to existing tables, see ADDING COLUMNS TO A TABLE. If you add columns which are used by some Categories and not others you can test for the column value before displaying it in any template which receives Category information. For example, if you add a Category.warning column that is used in adult-related Categories you can test with something like this: [% category = alias.category_info %] [% IF category.warning %] WARNING: [% category.warning %] [% END %] Note: in practice you will have to search for the relevant category hash to reference. It might, for example, be current_level.category_info which is buried in a category loop somewhere within one of the Template-Toolkit templates used for the browsable Category pages. « Table of Contents | Obtain Red Queen » Copyright © 2004 Random Mouse Software. All Rights Reserved. | |||||||||||||||||||||||||||||||||||||||||||||