Simple Tags
Extensions
Modules
This extension-/module-combination is intended for tagging weblog entries.
Simple as in basic.
There really are no bells & whistles or shiny interfaces. Any custom field can be designated as a field containing comma-separated tags. When posting, updating or deleting an entry the tagging database table is updated accordingly.
If you happen to already have such a field, e.g. used for <meta name="keywords"> or the like, you can also re-index all your existing entries without the need to update them bit by bit.
Tags as in informally assigning relevant keywords or phrases to entries and being able to use this information to access them.
This version only supports tagging by the authors, not by your visitors. Currently there are no plans to change this.
Installation
- Unzip the file.
- Upload the file ext.simple_tags.php to the extensions-folder inside your EE system directory.
- Upload the folder simpletag and the contained files to the modules-folder inside your EE system directory.
- Upload the files lang.simple_tags.php & lang.simpletag.php to the language/english-folder inside your EE system directory.
- In your Control Panel navigate to CP Home › Admin › Utilities › Extensions Manager, find the Simple Tags extension and click Enable?
- Now you have access to the Settings of the extension.
There you’ll find a list of all Custom Weblog Fields that currently exist. You are supposed to select the field(s) that will contain your tags.

If you have no field for this purpose yet, first create one, then come back here to activate it. Field Types can be Text Input or Textarea and Default Text Formatting must be ‘None’. Of course that field(s) must belong to the Field Group(s) assigned to the weblog(s) where you want to use tagging. - In your Control Panel navigate to CP Home › Modules, find the Simple Tag module and click Install.
- Now you have access to the CP Interface of the module. There isn’t much to do there except batch-(re-)indexing all your existing weblog entries.
If you installed the extension and already had a field containing comma-separated tags or if you at some point import entries that have such a field, the tagging-database table needs to be rebuild before the tags are available.
This is as complicated as clicking the only button available until it’s gone
Usage
As has been mentioned before, in order to use tagging in a weblog the weblog’s Field Group must contain a Custom Weblog Field with Formatting set to None and this field must designated as a tagging field in the extension’s settings.
When posting an entry you may enter your tags into that field. Separate the tags by commas.
Taglist
First thing you probably want to do is creating a template on which all related entries are shown once someone clicks on a Tag-link. I will call it site/taglist in this example.
Inside this template you can use a pretty standard exp:weblog:entries-tag to display whatever you like of the related entries, but you’ll have to wrap it inside {exp:simpletag:taglist}{/exp:simpletag:taglist}.
This tag has two parameters.
tagname="{segment_3}"
This parameter is mandatory. The Tag’s name will be passed in the URL. You have to specify the segment which contains it. Normally this will be the third segment.
weblog="blog|news"
This parameter is optional. If you want to limit the display to entries of (a) particular weblog(s) you can specifiy this here using the usual syntax.
Important: You have to add the parameter entry_id="{tagged_entries}” to the enclosed exp:weblog:entries-tag.
Example:
{exp:simpletag:taglist weblog="{my_weblog}" tagname="{segment_3}"}
{exp:weblog:entries entry_id="{tagged_entries}" limit="10" orderby="date" sort="desc" dynamic="off"}
<h1>{title}</h1>
{summary} <a href="{title_permalink=site/article}">read more</a>
{/exp:weblog:entries}
{/exp:simpletag:taglist}
To account for special characters tags use url_titles much like weblog entries or categories. If you want to print the plain text of the tagname there’s {exp:simpletag:tagheader}{/exp:simpletag:tagheader}.
It has one mandatory parameter and a single variable: {tag}.
tagname="{segment_3}"
Example:
{exp:simpletag:tagheader tagname="{segment_3}"}
Taglist for {tag}
{/exp:simpletag:tagheader}
This will translate segment 3 into the plain text tagname.
Listing Tag-links for each entry
To display tags under your entries that are linked to the taglist we created above you can wrap {exp:simpletag:taggify}{/exp:simpletag:taggify} around the variable of the custom field you designated to contain tags. This may be done everywhere you display weblog entries with the exp:weblog:entries-tag no matter whether it’s on a single- or multi-entry template.
There are two parameters.
path=""
This parameter is mandatory. This will contain the URL to the taglist we created. You can use a {path}-variable here.
delimiter=""
Optional. This can be any text-string you want to display between the single tags. If nothing is specified it defaults to one space character.
Notice: Since a parameter cannot start or end with a space character, you have to use an underscore (_) instead if your delimiter shall begin or end with blanks.
Example:
{exp:weblog:entries weblog="blog" limit="10"}
<h1>{title}</h1>
{body}
<br />
Tags:
{exp:simpletag:taggify path="{path=site/taglist}" delimiter="_-_"}
{keywords}
{/exp:simpletag:taggify}
{/exp:weblog:entries}
This will display the tags from your field named keywords separated by “ - “ and linked to the taglist-template.
Displaying a tag-cloud
Finally there is an EE-tag to display a tagcloud: {exp:simpletag:tagcloud}. It’s a single EE tag with no closing element.
There are five parameters.
path=""
This parameter is mandatory. This will contain the URL to the taglist we created. You can use a {path}-variable here.
weblog="blog|news"
This parameter is optional. If you want to limit the display to entries of (a) particular weblog(s) you can specifiy this here using the usual syntax.
limit="X"
Optional. This limits the cloud to the X most popular tags.
font_max=""
Optional. The font-size of the tags will be determined in %. This is the maximum size a popular tag can reach. Defaults to 250.
font_min=""
Optional. The font-size of the tags will be determined in %. This is the minimum size an unpopular tag can reach. Defaults to 100.
Example:
{exp:simpletag:tagcloud font_max="200" limit="20" path="{path=site/taglist}"}
This will produce a tagcloud with the top 20 tags linked to the template site/taglist and the most popular tag will have a font-size of 200%.
That’s it.
Hopefully it wasn’t too confusing to give it a try


Download: simple_tags.zip


