[pmwiki-users] discussion backlink
DaveG
pmwiki at solidgone.com
Fri Mar 24 17:44:31 CST 2006
I posted a while back under the subject "Adding a Reply Count to
SimpleForum Cookbook". I should put it on the wiki, but I never know
where to post these things -- anyone suggest something?
Not sure how to link back to an old post, so here's the content. Point 3
provides a function that provides a backlink.
==================
Just thought I'd share how I've implemented the Cookbook/SimpleForum.
Each page has a tabbed link to a discussion page, which also includes a
count of the number of posts on the page. For a sample refer to
http://mr2wiki.com/Main/TopicRequests.
Each page has a tabbed Discuss link. This points to a page in the group
Forum named "Group-Pagename". The Discuss tab is replaced with a Return
tab when viewing the Forum to allow the user to return to the base page.
Here's what I did:
------------------
1] Setup SimpleForum. I've defined Forum.GroupFooter to contain:
[[<<]]
(:commentboxchrono:)
------------------
2] Change your skin template to include a link to the Discussion forum.
I changed my skin to include a tabbed link to a 'discussion' forum page.
My skin .tmpl has:
<!--function:DisplayDiscuss-->
------------------
3] Add functions to create the link to the discussion page, and count
the posts in the discussion page. The count is based on the number of
times the markup ">>messagehead<<" occurs on the page.
I created a two functions in my skin .php file:
function FindInPage($pagename,$find) {
$p = ReadPage($pagename, READPAGE_CURRENT);
return substr_count($p['text'], $find);
}
function DisplayDiscuss($x) {
global $ScriptUrl;
$Group = FmtPageName('$Group',$x);
$Page = FmtPageName('$Name',$x);
if ($Group=='Forum') {
$BasePage = explode('-',$Page,2);
$html = "<a \n id='return'
href='$ScriptUrl/".$BasePage[0]."/".$BasePage[1]."'>return</a>\n";
} else {
$html = "<a \n id='discuss'
href='$ScriptUrl/Forum/$Group-$Page'>discuss
(".FindInPage("Forum/$Group-$Page",'>>messagehead<<').")</a>\n";
}
echo $html;
return;
};
That's it!
==================
noskule wrote:
> hi list
>
> I try to make a backlink from a discussionpage. If discusstionpages are
> stored in a "discussion" group the macklink look like this.
>
> Discussion.Group-Name -> Group.Name
>
> $FmtPV['$BaseName'] = 'str_replace("-", ".", $name)';
>
> the above example is form
> http://www.pmwiki.org/wiki/Cookbook/CommentPageLink
>
> but how it works if I want to replace
>
> Group.Name-Discussion -> Group.Name
>
>
> grz nos
>
> _______________________________________________
> pmwiki-users mailing list
> pmwiki-users at pmichaud.com
> http://host.pmichaud.com/mailman/listinfo/pmwiki-users
>
More information about the pmwiki-users
mailing list