BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Infotags

Solutions > Links > Infotags

Summary: A fast easy tagging system using the info function
Status: Experimental
Maintainer: Caveman.
Downloads: infotags.php.

This script contains a couple extensions to the info function/command to give you a very simple, easy to setup tagging system.

To use it, enable the script as normal. Then, put code like the following on a group footer:

<code>
Tags:    [ Edit ]
</code>

This will draw in any existing tags from the tags data value and display them.

Here is the tags action page you will need (name the page action.tags):

<code>

>>Tags<<


>>Use this form to change the tags on this post:<<

Infotags

[form] [session info "field='solutions.links.infotags' value='{=tags}' target='info.tags'"] [form] </code>

Note: if you want to set tags in the form that initially creates the page, like a blog entry form or something, just add the two from lines above to your form. The first line won't have a default value of course.

You can manually inspect and/or edit your tag values manually by going to info.tags.

This script also comes with a tag cloud feature you can put in a sidebar, used like the following:

[(info tagcloud target=info.tags)]
To keep track of deleted pages/tags in your tagcloud you might add a line like this to action.delete:
[session info "delete field='{p}' target='info.tags'"]

This clears your info.tags out of the pages which exist no more.


To use these links, create a page called action.tag.missing with content like the following:

<code>

Tags


Posts with Tag: Links


</code>

Then when you click on a link in the tag cloud (or any link to tag.whatever it will go to a search page that generates a list of all pages with that tag. Actually, you will want to do this even if you do not use the tag cloud. It will return any page with the string links somewhere in the tags (just using a simple strpos function).

There are probably still a few more features to add to this, like a way to generate a list of links on a page to all tags. But we're on our way. I'm open to suggestions--as I'm developing this for my own blog right at the moment and would like to get it perfected.

member.linly?'s Note:

If you encounter problem in page "action.tag.missing". Try using "info report" instead:

<code></code>

member.martin's Note:

If you care about consistent use of tags, you might get a list of all tags which are used. Put this at the end of infotags.php:

<code>
function BOLTinfoTagList($info, $args) {
     $tags = array();
     foreach ($info as $f => $v) $tags = array_merge($tags, explode(',', $v));
     foreach ($tags as $tag) $tagcount[$tag] = $tagcount[$tag] ;
        ksort($tagcount);
     foreach ($tagcount as $i => $ii) {
          $out .= " ";
          }
     return $out;
     }
</code>

and call this on your page:
[(info taglist target=info.tags)]

Of course you can keep more than one tag list. You could have an additional list for categories too. Just use the scripts above and use them on a page action.categories.missing, action.categories and create a page info.categories. Replace tags with categories inside the forms.

Search for tags


Some examples for searching single tags by using conditionals:

Find all pages WITHOUT tag "this_not":
[(info report target=info.tags if="!inlist 'this_not' '{info.tags::{+p}}'" template="{+p}")]
Find all pages with tag "this" OR "that":
[(info report target=info.tags if="inlist 'this' '{info.tags::{+p}}'||inlist 'that' '{info.tags::{+p}}' " template="{+p}")]
Find all pages with tag "this" AND "that":
[(info report target=info.tags if="inlist 'this' '{info.tags::{+p}}'&&inlist 'that' '{info.tags::{+p}}' " template="{+p}")]
Find all pages with tag "this" AND "that" BUT NOT "this_not":
[(info report target=info.tags if="(inlist 'this' '{info.tags::{+p}}'&&inlist 'that' '{info.tags::{+p}}')&&!inlist 'this_not' '{info.tags::{+p}}' " template="{+p}")]

You could combine this with additional lists like a categories list. Just change the target expression from {info.tags::{+p}} to {info.categories::{+p}} or another page name starting with info

UTF Tagging


After version 2.62 you do not need to read the following. \"utf encode\" is not necessary

If you want to use UTF8 tags, here is an approach you may want to try. First download and enable the latest UTF8 Handlers plugin so you have access to it's new special encoding/decoding mechanisms. Then change then change the tag code you put on each page to this:

<code>
Tags:    [ Edit ]
</code>

And change the action.tag.missing page to this:

<code>

Tags


Posts with Tag:


</code>

Copyright © 2013, all rights reserved.