Tagging

5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 5, 2008   (RSS)

Hi,
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?

if this is possible, is it custome programming as I am compiling a list of the jobs that I will be asking for help with.
Thanks,
Mickey

Re: [Michael Blake] Tagging

By Jake - August 3, 2008

Hi Mickey,

This is possible to do in CMS Builder, and doesn't require any special modifications to the software itself. Instead, you would need to do a little bit of coding work on your viewer pages. Basically the idea would be to use CMS Builder's search engine to search the "tags" field in your records for the clicked word. You would set this up by coding some special links in your viewer code that passed the tag word to a search query.

If you'd like some more specific instructions on setting this up, let us know. [:)]
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@interactivetools.com

Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.

Re: [Jake] Tagging

Hi Jake,
Thanks for that, I hadn't expected a reply on the weekend! I'd appreciate some instructions on setting this up if possible.

Thanks,
Mickey

Re: [Jake] Tagging

By Jake - August 5, 2008

Hi Mickey,

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 in:

<?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! Let me know how this works out for you. [:)]
-----------------------------------------------------------
Cheers,
Jake Marvin - Product Specialist
support@interactivetools.com

Hire me!
Save time by getting our experts to help with your project. Template changes, advanced features, full integration, whatever you need. Whether you need one hour or fifty, get it done fast with Priority Consulting.