[pmwiki-users] replacing spaces with plusses

Jon Haupt jhaupt at gmail.com
Sun Feb 4 15:12:31 CST 2007


I'm trying to create custom page variables that show the wiki title
and the page title with plusses instead of spaces.  In other words,
instead of {$Titlespaced}, I want {$Titleplussed}, with the result
showing PmWiki/DocumentationIndex as Documentation+Index.

The wiki title part I found to be pretty easy, and I accomplished it
with this code:

# PlusIt converts all spaces in a string into plusses.
function PlusIt($text) {
  $text = preg_replace('/\s+/', '+', $text);
  return $text;
  }
# page variable
$FmtPV['$WikiTitlePlussed'] = 'PlusIt($GLOBALS["WikiTitle"])';

However, {$TitlePlussed} is more difficult, or at least I haven't been
able to figure it out.  Can I do something similar in order to put the
contents of {$Titlespaced} through my PlusIt function?  Also, could I
have accomplished the above in an easier way?

Thanks,

Jon



More information about the pmwiki-users mailing list