fusionkit.tags
Component tags (Tagging Component)
* - private method
Component tags (Tagging Component)
properties: | datasource, itemIdColumn, itemTable, maxTagLength, tagTable |
methods: | addTag, cleanTag, deleteTag, getItems, getRelatedItems, getTags, makeTagCloud, tag |
Property | Hint | Type | Req. | Implemented In | Default Value |
---|---|---|---|---|---|
datasource | The name of your datasource | Yes | tags | - | |
itemIdColumn | The name of the primary key column in your itemTable | tags | id | ||
itemTable | The name of the table that contains the items you want to tag (eg blog entries table) | tags | items | ||
maxTagLength | The max length a tag can be. | numeric | tags | 50 | |
tagTable | The name of your tag table. | string | tags | tags |
addTag |
---|
void
addTag
(
string
item_id,
string
tag
)
Adds a single tag to an item. Does not check to see if tag already exists. Output: supressed Parameters: item_id: string, optional, item_id - the item id tag: string, optional, tag - the tag to add |
cleanTag |
string
cleanTag
(
required
string
tag
)
Converts to lowercase, and removes all characters from the tag besides [a-z0-9._-] and ensures that the result is not longer than the maxTagLength. If you want to allow different characters simply extend this cfc with your, and re-implement this method to your liking. Output: supressed Parameters: tag: string, required, tag |
deleteTag |
void
deleteTag
(
string
item_id="",
string
tag=""
)
Deletes tag(s) from the tag table. Output: supressed Parameters: item_id: string, optional, item_id - Pass an empty string here to delete all occurrences of this tag. tag: string, optional, tag - Pass in an empty string to delete all tags for an item. |
getItems |
query
getItems
(
string
tag,
item_columns="*"
)
Returns a query containing items tagged with the given tag. Output: enabled Parameters: tag: string, optional, tag item_columns: any, optional, item_columns - A comma seperated list of columns from the itemTable to return in the query. If empty string, no join will take place. |
getRelatedItems |
query
getRelatedItems
(
required
item_id,
numeric
min_common_tags="2",
item_columns=""
)
Returns a query of related items. We define related as items that are tagged with similar tags, specify the number of common tags required with the min_common_tags argument. Returns a query of item_id, num_common_tags, and any other columns you specify in the item_columns argument list. Output: enabled Parameters: item_id: any, required, item_id min_common_tags: numeric, optional, min_common_tags - The number of common tags an item must have to be 'related'. item_columns: any, optional, item_columns - A comma seperated list of columns from the itemTable to return in the query. If empty string, no join will take place. |
getTags |
query
getTags
(
required
item_id
)
Returns tags for a given item Output: enabled Parameters: item_id: any, required, item_id |
makeTagCloud |
makeTagCloud
(
tagUrl="tag.cfm?tag=",
numeric
min_usage="1",
boolean
include_css="true"
)
Makes a tag cloud links with css classes smallestTag, largestTag, largeTag, mediumTag, and smallTag Output: enabled Parameters: tagUrl: any, optional, tagUrl - url prefix for tag cloud link. min_usage: numeric, optional, min_usage - the minimum number of times a tag has been used. include_css: boolean, optional, include_css - returns a css style tag along with the tag cloud. |
tag |
void
tag
(
required
string
item_id,
required
string
tagList,
string
delimiters=","
)
Tags an item with the specified tags Output: enabled Parameters: item_id: string, required, item_id - The item id you wish to tag. tagList: string, required, tagList - A list of tags delimiters: string, optional, delimiters - The delimiters for the tagList. |