Search content based on tags
Documentation
Implementation
Base INCLUDE
%STARTINCLUDE%%ADDTOZONE{"script" text="<script type='text/javascript'>
function submitSearch(selectTag) {
document.forms['tagSearch'].tag.value = selectTag;
document.forms['tagSearch'].submit();
return false;
}</script> "}%
%INCLUDE{"%WEB%.%TOPIC%" section="%IF{"defined 'tag'" then="searchresults" else="tagsearch"}%"}%
%STOPINCLUDE%
Tag Search
%STARTSECTION{"tagsearch"}%
#TagSearch
%INCLUDE{"%WEB%.%TOPIC%" section="%IF{"defined 'tag'" then="searchresults" else="tagcloud"}%"}%
%ENDSECTION{"tagsearch"}%
Tag Cloud
Parameter:
- HEADING - displayed heading
%STARTSECTION{"tagcloud"}%
<div style='border:1px solid black;padding:5px;width:100%;'>
<center> *%IF{"defined HEADING" then="%HEADING%" else="%SPACEOUT{%BASEWEB%}% Tag Cloud"}%* </center>
<form id='tagSearch' action='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%#TagSearch' method='get'>
<input type='hidden' id='tag' name='tag' value='' />
%TAGCLOUD{"%DBCALL{"%WEB%.RenderTag" section="subjectSearch"}%"
header="<div style=\"text-align:center; padding:15px;line-height:180%\">"
format="<span style=\"font-size:$weightpx;line-height:90%\"><a href=\"#\" onclick=\"return submitSearch('$term');\" style=\"text-decoration:none\" title=\"$count\">$term</a></span>"
footer="</div>"
split=", "
sort="alpha"
buckets="40"
offset="12"
lowercase="on"
plural="on"
map="bucket=pail"
sep=" ~ "
filter="off"
}%</form>
<span style="font-size:.8em;font-style:italic;">Hover over term to see number of related topics. Click to see associated list of topics. <a href='http://en.wikipedia.org/wiki/Tag_cloud' target='_blank' title='opens new window'>Wikipedia article on "tag clouds"</a>.</span>
</div>
%ENDSECTION{"tagcloud"}%
Search Results
%STARTSECTION{"searchresults"}%
<div class='foswikiRight'>
%INCLUDE{"%WEB%.%TOPIC%" section="tagcloud" HEADING="Search Different Tag"}%
</div>
---++!! Topics Tagged with %URLPARAM{"tag" multiple="\"$item\"" separator=", " default="(no tag selected)"}%
%SEARCH{ "form.name ~ '*Form' AND (lc(Tags) =~ lc('.*%URLPARAM{tag}%.*') OR lc(SubjectArea) =~ lc('.*%URLPARAM{tag}%.*')"
web="%BASEWEB%"
type="query"
nosearch="on"
zeroresults="*No topics found.*"
nototal="on"
footer=" $n*Topics found: $ntopics*"
format=" * [[$web.$topic][$percntSPACEOUT{$topic}$percnt]] - $formfield(Summary)"
separator="$n"
}%
%CLEAR%
%ENDSECTION{"searchresults"}%
hold code:
%URLPARAM{"tag" multiple="Tags ~ '*$item*'" separator=" OR "}%
Test
Copyright
(C) 2006
LynnwoodBrown@Skyloom.com
This file is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read the
LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.