[pmwiki-users] $PageUrl not being parsed

Patrick R. Michaud pmichaud at pobox.com
Sat Jan 28 11:09:31 CST 2006


On Sat, Jan 28, 2006 at 02:24:40PM +0000, Hans wrote:
> In forumstyled.php the variable $DefaultPageTextFmt gets redefined for
> the forum group(s). for this to work each forum group needs to be
> added to the $Forum
> ...
> this is the code in forumstyled.php:
> # default forum group:
> $ForumList[] = 'Forum';
> 
> # defines text to be displayed when new topic page gets created
> $fgrp = FmtPageName('$Group',$pagename);
> foreach ($ForumList as $fl) {
>     if($fgrp==$fl) {
>     $DefaultPageTextFmt = 'Compose message, add author name, and click post';
>     }
> };
> 
> Anyone seeing a flaw here please advice!

- Note that the default value of $DefaultPageTextFmt has changed
  to be "(:include {$SiteGroup}.PageNotFound:)".  This isn't
  a flaw, but something to be aware of.

- You can simplify your foreach loop above by using in_array():

  $pagename = ResolvePageName($pagename);
  $fgrp = PageVar($pagename, '$Group');
  if (in_array($fgrp, $ForumList)) 
    $DefaultPageTextFmt = 'Compose message, add author name, and click post';

  PHP's in_array() function is slow, but it should still be faster
  than the foreach loop.  In general, I find that using keys for testing
  membership is *much* faster (execution time) than either in_array or
  foreach:

    $ForumList['Forum'] = 1;
    ...
    if ($ForumList[$fgrp]) 
      $DefaultPageTextFmt = 'Compose message, add author name, and click post';

  However, most people would tend to understand $ForumList[] = 'Forum';
  more than $ForumList['Forum'] = 1;

> The topic title is the page name. You can also use {$Title} in the
> page i suppose.
> 
> > 3. HOW TO REMOVE 'HOME PAGE' FROM TOPIC LISTING?
> 
> you can add this to config.php:
> 
> # exclude current page
> $SearchPatterns['normal'][] = FmtPageName('!^$Group\\.$Name$!', $pagename);

This is already the default setting starting with 2.1.beta15.

Pm




More information about the pmwiki-users mailing list