[pmwiki-users] PHP in .tmpl file

Patrick R. Michaud pmichaud at pobox.com
Tue Mar 7 12:51:42 CST 2006


On Tue, Mar 07, 2006 at 12:35:21PM -0600, Little, Charles wrote:
> Hi-
> 
> I'm sure I'm missing something, but I wanted to include an link to the
> comments section in the page footer, but only if the pagename does not
> include -comments.  So I included the following code in the .tmpl file
> for the customized skin:
> 
> <!--PageFooterFmt-->
>   <div id='wikifoot'>
>   <div id='utility'>
>     <div class='footnav'>
>       <a href='$PageUrl?action=edit'>$[Edit]</a> -
>       <a href='$PageUrl?action=diff'>$[History]</a> -
> <?php
> if !(strbrk([$FullName],"-Comments")==0)
>       echo "<a href='$ScriptUrl/$[$FullName]-Comments'>$[Comments]</a>
> [...]

The .tmpl file is not a PHP file, nor is it processed for php
directives.  But there are several ways to do it:

  * Use a <!--function:...--> directive

  * Use <!--markup:(:if !name *-Comments:)[[$FullName-Comments | Comments]]-->

  * Create a custom global variable with the HTML you want to have
    (optionally) included at that point in the template

There are probably others, these are the three I came up with off
of the top of my head.

Pm





More information about the pmwiki-users mailing list