<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 8/13/2009 9:27 AM, Michael Fake wrote:
<blockquote
 cite="mid:c9a0ce430908130627l5dcfab5blcbf8bff84363845e@mail.gmail.com"
 type="cite">Hello everyone,<br>
  <br>
I'd like to be able to set up a simple tagging system, whereby on each
page you can add a tag which acts as a direct link to another page.
E.g. You could tag the page 'Main/Daschund' with the 'Dogs' tag, and
clicking on that link would take you to Main/Dogs. I'd then like to
have the option to list, in Main/Dog, all those pages that have the
'Dogs' tag. This seems to be how tags in the ever-useful <a
 moz-do-not-send="true" href="http://www.tiddlywiki.com/"
 target="_blank">TiddlyWiki</a> work, and I'd like a similar navigation
option in pmwiki.<br>
</blockquote>
In your config.php:<br>
$CategoryGroup = 'Main';<br>
<br>
In Main.GroupFooter:<br>
(:pagelist link=Main/Dogs:)<br>
<br>
The stuff that follows this point might surprise you with how much
closer PmWiki can get to Tiddlywiki.<br>
<br>
-----<br>
<br>
I suggest you download and install the EditAttributes recipe like this:<br>
<br>
First, copy editattr.php into your cookbook.<br>
<br>
In you config.php:<br>
$EditAttrFields = array(<br>
&nbsp;&nbsp;&nbsp; 'title' =&gt; array(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'attribute' =&gt; 1,<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'markup' =&gt; '(:title $1:)',<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'filter' =&gt; 'EditAttrAutofillTitle'<br>
&nbsp;&nbsp;&nbsp; ),<br>
&nbsp;'tags' =&gt; array(<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'attribute' =&gt; 1, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'markup' =&gt; '(:tags:$1:)',<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'filter' =&gt; 'EditAttrFormatTags'<br>
&nbsp;&nbsp;&nbsp; )<br>
);<br>
<br>
# Format Tags<br>
function EditAttrFormatTags( $pagename, $fn, &amp;$new ) {<br>
&nbsp;&nbsp;&nbsp; global $CategoryGroup;<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $EaCleanArray = array('[',']','!',<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'Category:',"$CategoryGroup:",<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'Category/',"$CategoryGroup/",<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 'Category.',"$CategoryGroup."<br>
&nbsp;&nbsp;&nbsp; );<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $EaMatches = $new['tags'];<br>
&nbsp;&nbsp;&nbsp; $EaMatchesArray =
explode(',',str_ireplace($EaCleanArray,'',$EaMatches));<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; Foreach($EaMatchesArray as $EaM) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $EaM = trim($EaM);<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if($EaM == '')<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $EaFixed .= '';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elseif(strstr($EaM,'/') === FALSE &amp;&amp; strstr($EaM,'.')
=== FALSE)<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $EaFixed .= '[[!'.$EaM.']], ';<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $EaFixed .= '[['.$EaM.']], ';<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; $new['tags'] = substr($EaFixed,0,-2);<br>
}<br>
<br>
include_once($FarmD.'/cookbook/editattr.php');<br>
<br>
Finally, edit Site.EditForm. Just copy and replace:<br>
!!Editing {*$FullName}<br>
(:messages:)<br>
&lt;div id='wikiedit'&gt;<br>
(:input e_form:)<br>
[[#top]]<br>
&lt;table style="width:100%;"&gt;<br>
&lt;tr&gt;&lt;td
style="text-align:right;"&gt;Title:&lt;/td&gt;&lt;td&gt;(:input
e_title:)&lt;/td&gt;&lt;td
style="text-align:right;"&gt;Tags:&lt;/td&gt;&lt;td&gt;(:input
e_tags:)&lt;/td&gt;&lt;/tr&gt;<br>
&lt;tr&gt;&lt;td colspan="4"&gt;(:input
e_textarea:)&lt;/td&gt;&lt;/tr&gt;<br>
&lt;tr&gt;&lt;td colspan="4"&gt;(:input e_savebutton:)(:input
e_savedraftbutton:)(:input e_saveeditbutton:)(:input
e_previewbutton:)(:input e_cancelbutton:)&lt;/td&gt;&lt;/tr&gt;<br>
&lt;/table&gt;<br>
(:input end:)<br>
&lt;/div&gt;<br>
(:if e_preview:)<br>
!!Preview {*$FullName}<br>
'''$[Page is unsaved]'''<br>
(:e_preview:)<br>
&lt;hr /&gt;<br>
[[#top|Top]]<br>
(:ifend:)<br>
<br>
----<br>
<br>
Now, all you have to do is fill the Tags box with a comma separated
list of tags:<br>
Dogs, Friendly Dogs, Dogs with all their Teeth<br>
And you can even link outside your CategoryGroup like this:<br>
Pictures/Dogs, Stories.Dogs, Wolves.That look like Dogs<br>
<br>
You might also install the AutoSave and GetRidOfMain recipes for some
added functionality.<br>
<br>
Michael Continues<br>
</body>
</html>