[pmwiki-users] (:if pageexists ...:)

Hans design at flutesong.fsnet.co.uk
Sat Aug 6 12:38:24 CDT 2005


Saturday, August 6, 2005, 1:37:07 PM, chr wrote:
> How can I define a condition that checks for the existance of a page?
> I'd like to add something lie this to my sidebar:
>         (:if page-exist PageList:)* [[PageList]](:ifend:)

Try one of the following conditional markup definitions:

# ads (:if exists SomeGroup.SomeName:)
$Conditions['exists'] = "PageExists(\$condparm)";

# ads (:if pageexists SomeGroup.SomeName:)
$Conditions['pageexists'] = "CheckPageExists(\$condparm)";
function CheckPageExists($pagename) {
  $page = FmtPageName('$Group.$Name', $pagename);
  return PageExists($page);
  };

The first seems to work fine, but maybe there are circumstances one
needs to use FmtPageName to get the full pagename?
Note you need to enter Group.Name as conditional parameter, not just
Name.


Best, 
~Hans                           





More information about the pmwiki-users mailing list