TAGGING CATEGORIES TO FIND SIMILAR CONTENT - Aug 3rd, 2010


In response to a post from Mickey that asks: Is it possible to add tags or categories to an article and then after the
article content have CMSB list those 'tags' in a format that allows a user to click on a tag and then retrieve similarly
tagged articles output to say 10 headline (summary contents) items per page?

Jake at Interactive Tools came up with this idea:

To set this up, you'll want to create a textfield for the tags to be entered into - I called mine "Tags". You may also
want to specify some instructions for this field that each tag should be separated by a comma.
Now create a normal detail viewer page, or open up your existing one. The only thing we're going to do here is add this
code:



<?PHP $tagList = split(',', $record['tags']); ?>
<?PHP foreach ($tagList as $tagLink): ?>
<a href="/path/to/your/listViewer.php?tags_keyword=<?PHP echo urlencode(trim($tagLink)); ?>">
<?PHP echo $tagLink ?></a>
<?PHP endforeach ?>



That code will split up your tags each time it encounters a comma, and will also remove any spaces entered before or
after the comma, if present. It will also URL encode the text should some weird characters make it in there. Finally it
will generate a search link for each one of the entered tags.

The only thing you'll need to change in that code is this chunk of text:



/path/to/your/listViewer.php



This should point to the list viewer page for this section.

If you'd like to limit the results to ten on this page, just enter "10" into the 'limit' option at the start of your
list viewer page:



'limit' => '10',



That should be it!

Great idea, Jake...



The materials on this web site have been created for use with CMS Builder content management software. CMS Builder software is published and licensed for use by InteractiveTools.com. Please contact Interactive Tools for information on the downloading of the software or the purchasing of licenses.


Terms of Service