[pmwiki-users] using PHP in TMPL
Patrick R. Michaud
pmichaud at pobox.com
Mon Sep 24 12:50:20 CDT 2007
On Fri, Sep 21, 2007 at 02:21:04PM -0400, Mike Shanley wrote:
> Hi all,
>
> The standard <?php ?> doesn't work in the .tmpl file, I assume because
> of how it's processed. I was wondering if there was any way to break
> into PHP in the file that I'm not aware of.
One can always use <!--function:...--> directives to directly
call PHP functions, or <!--file:something.php--> directives to
include/process a .php file at that point. There's not presently a
way to "inline" PHP within the template file itself.
> Barring that, is there any way to use the skin.php file to pass
> variables to the tmpl BEFORE it gets processed?
>
> What I'm looking to do is have a variable set = '<!--wiki:whathaveyou
> -->' if the authentication is correct.
Easier is probably to use a function: define a function that
checks authentication and outputs whatever you want output at
that point. For example:
<!--function:WhatHaveYou-->
and in a configuration file
function WhatHaveYou($pagename, $args) {
if ($user_is_authorized) PrintWiki($pagename, 'Main.WhatHaveYou');
}
> Also, is there any way to get markup processed and deposited into a tmpl
> from skin.php? MarkupToHTML is throwing (regex error on line 1,
> pmwiki.php) errors.
Again, it's easier to do it from a PHP function. Or, one can also
put markup directly into the .tmpl via <!--markup:...--> .
Pm
More information about the pmwiki-users
mailing list