[Pmwiki-users] Links in template pages
Ilya Zverev
zverik
Tue Sep 7 08:50:14 CDT 2004
PRM> function DiscussLink($pagename,$args) {
PRM> # if the current page already ends in "-Discussion", don't make a link
PRM> if (preg_match("/-Discussion$/",$pagename)) return '';
PRM> # otherwise, generate a link using FmtWikiLink
PRM> return FmtWikiLink('',"{{$pagename-Discussion}}","Discuss");
PRM> }
PRM> Then include <!--function:DiscussLink--> in the template.
Hmm... Is anywhere in the documentation written about the function
arguments? I thought that the function must be no-args.. I'll probably
patch online documentation (PmWiki.LayoutAdvanced) now.
That code works, but the return value is not processed, and the final
line didn't compile (php 4.3.1), so I've altered it:
function DiscussLink($pagename,$args) {
# if the current page already ends in "-Discussion", don't make a link
if (preg_match("/-Discussion$/",$pagename)) return '';
# otherwise, generate a link using FmtWikiLink
print FmtWikiLink('',"{{".$pagename."-Discussion}}","Discuss");
}
And why the link isn't marked as to non-existent page?
Is it a feature?
Zverik
More information about the pmwiki-users
mailing list