[pmwiki-users] Conditional If statement being displayed on web page?

Petko Yotov 5ko at 5ko.fr
Mon Oct 7 15:02:05 CDT 2013


Here is a piece of code that I use for a similar need. In config.php:

  function GroupTitle($group, $slash=0){
    global $AsSpacedFunction;
    $title = PHSC(PageTextVar("$group.GroupConfig", 'GroupTitle'));
    if (! $title>'') $title = $AsSpacedFunction($group);
    return $slash ? "$title /" : $title;
  }
  $FmtPV['$GroupTitle'] = 'GroupTitle($group)';
  $FmtPV['$GroupTitleTMPL'] = 'GroupTitle($group, 1)';

In a wiki page [[EasyCatalog.GroupConfig]] or [[OtherGroup.GroupConfig]] I  
have this code:

  GroupTitle:EasyCatalog (or any other group title I don't want "spaced")

In the skin template, I use $GroupTitle or $GroupTitleTMPL where I want the  
group title displayed (and $Group where I link to the group unspaced) :

  <title>$WikiTitle | {$GroupTitle} / {$Title} $ActionTitle</title>
  <a href='{$ScriptUrl}/{$Group}'>{$GroupTitleTMPL}</a>

In a [[SideBar]] or any other wiki page, I can use {*$GroupTitle}.

This way, if there is a page EasyCatalog.GroupConfig with the page text  
variable GroupTitle, it will be used as a group title in the skin template.  
If there isn't such a page or such a variable, the skin will show the "group  
spaced" text as title.

Petko

P.S. $GroupTitleTMPL only has a slash appended - not sure why I needed that.

Matt Clinton writes:
> The problem lies not with the page title but with the Group name. I want to  
> use $Groupspaced so that "ODBCDataProvider" is spaced out on this  
> page: <URL:http://impressedpaving.co.uk/matt/index.php? 
> n=ODBCDataProvider.ODBCDataProviderNotLoadingOnMacintosh>http://impressedpavi 
> ng.co.uk/matt/index.php? 
> n=ODBCDataProvider.ODBCDataProviderNotLoadingOnMacintosh
>
>
> But if I was to do this, the group EasyCatalog then ends up as Easy Catalog.
>
>
> Which is why I would love to be able to use an IF statement in my tmpl file.
>



More information about the pmwiki-users mailing list