Search content based on tags
Documentation
Implementation
Base INCLUDE
%STARTINCLUDE%%ADDTOZONE{"script"
requires="JQUERYPLUGIN::FOSWIKI::PREFERENCES"
text="<script type='text/javascript'>
function submitSearch(selectTag) {
$.blockUI();
document.forms['tagSearch'].tag.value = selectTag;
document.forms['tagSearch'].submit();
return false;
}
</script> "}%
%INCLUDE{"%WEB%.%TOPIC%" section="tagcloud"}%
%STOPINCLUDE%
Replaced with basic RenderTableSearchResults.
%INCLUDE{"%WEB%.%TOPIC%" section="%IF{"defined 'tag'" then="searchresults" else="tagsearch"}%"}%
Tag Search
%STARTSECTION{"tagsearch"}%
%INCLUDE{"%WEB%.%TOPIC%" section="%IF{"defined 'tag'" then="searchresults" else="tagcloud"}%"}%
%ENDSECTION{"tagsearch"}%
Tag Cloud
Parameter:
- HEADING - displayed heading
- ANCHOR - target page anchor. Defaults to
#TagSearch
.
%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%#%ANCHOR{default="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$percntIF{\"'%URLPARAM{tag}%'='$term'\" then=\";color:#E6A249\"}$percnt\" 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"}%
%INCLUDE{"%WEB%.%TOPIC%" section="tagcloud" HEADING="Search Different Tag"}%
#TagSearch
<div style='border:2px green solid;padding:10px;'>
---++!! Topics Tagged with %URLPARAM{"tag" multiple="\"$item\"" separator=", " default="(no tag selected)"}%
%SEARCH{ "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"
}%
</div>
%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.