[pmwiki-users] discussion pages?

Patrick R. Michaud pmichaud at pobox.com
Tue Jun 21 14:15:03 CDT 2005


On Tue, Jun 21, 2005 at 02:11:39PM -0500, Jon Haupt wrote:
>    This markup
> 
>          Markup('{$BaseName}', '>{$fmt}',
>            '/{\\$BaseName}/',
>            str_replace('-', '.', $pagename, 1));
> 
>    works but only after I took out ", 1" from the end of the str_replace bit
>    - I wasn't sure what that was for, and pmwiki gave me a "wrong number of
>    parameters..." or something like that error message. So
> 
>    Markup('{$BaseName}', '>{$fmt}',
>      '/{\\$BaseName}/',
>      str_replace('-', '.', $pagename));

Oh, I misread PHP's count parameter to the str_replace function.  
This latter version won't work if there are hyphens in the page 
name (it'll end up converting them to '.' as well).  So perhaps:

    Markup('{$BaseName}', '>{$fmt}',
      '/{\\$BaseName}/',
      preg_replace('/-/', '.', $pagename, 1));

The "1" indicates that only the first hyphen should be converted
to a dot.

Pm



More information about the pmwiki-users mailing list