[Pmwiki-users] getting the template path?

Thomas -Balu- Walter list+pmwiki-users
Tue Feb 24 15:13:30 CST 2004


On Tue, Feb 24, 2004 at 11:27:27AM -0700, Patrick R. Michaud wrote:
> Well, firstly, you can put $-substitutions in the <!--file:...->
> directive, so you can define whatever path variables you like.

Can all global variables be substituted in the template files? 

> At present there's no predefined variable for the location of the
> "pub/" or "pub/skins" directory, because things just start to get
> messy when one does that.  But I'm open for suggestions.

I am not sure wether we need variables for those two, but having a
variable that points to the actual skin directory helped here. I've
done the following now:

in local/config.php:
$PageTemplateFmt  = 'pub/skins/balu/page.tmpl';
$PageTemplatePath = dirname($PageTemplateFmt);

in pub/skins/balu/page.tmpl:
<!--file:$PageTemplatePath/functions.inc.php-->
[...]
(Last modified: $LastModified <!--function:authorOrHost -->)

functions.inc.php defines the function authorOrHost() that is used in
page.tmpl

> > I wrote my own function to display "by AUTHOR" (if $LastModifiedBy is
> > not empty) or "from HOST" instead (if $LastModifiedHost is not empty).
> > ...
> > Another thing I'd like to have is to link $LastModifiedBy to the
> > apropriate profiles entry and was not able to find a way yet.
> 
> Set your display function (or variable) to output the full link if
> LastModifiedBy is not empty:
> 
>    <a class='authorlink' href='$ScriptUrl/$AuthorGroup/$LastModifiedBy'>
>      $LastModifiedBy</a>

$AuthorGroup was what I was missing. This won't work though if
$LastModifiedBy contains spaces and similar...

I have done the following now:

$author=FreeLink('{{'.$LastModifiedBy.'}}');
printf('by <a href="%s/%s/%s">%s</a>',
    $ScriptUrl,
    $AuthorGroup,
    $author['name'],
    $LastModifiedBy
);

Or do I have to watch for other specials?

      Balu



More information about the pmwiki-users mailing list