[pmwiki-users] Re: pb with PmWiki

Knut Alboldt pmwiki at alboldt.de
Thu Feb 3 15:38:15 CST 2005


p.morizot at free.fr schrieb:

>hi,
>
>
>Need to embedde htlm et php code on (to shown time in london, berlin, paris
>,tokyo, bejin  etc) I have the html and php code but where do I put them
> in both side bare and body page. how can i do that ? I try to edit the main
>wiki script but could not find the htlm code for both the side bare and body...
> could you help ?
> regards
> pat
>
>  
>
As far as I know you can't enter HTML nor PHP code directly in a page. 
Would be very dangerous too (just think of an editor who puts php-code 
in your wiki) !
So you can put this in a markup and call that from both: sidebar and 
wiki-page.

e.g.:

in config.php put your php-code in a function (e.g.  sample.php).. Then 
define a markup to call this function and finally put that markup within 
your sidebar and wikipage:
The HTML-code can be put in the markup-definition directly

--- config.php: ---
...

# 3 samples to define markups:

# markup, that needs no other function to output pure html-text
Markup('showtime1', 'directive', '/\(:showtime1:\)/e','Keep(\'<b>HTML 
text goes here</b>\')');

# markup, that needs no other function to output html-text withan 
embedded php-call (used date(9 just as an example)
Markup('showtime2', 'directive', 
'/\(:showtime2:\)/e','Keep(\'<b>'.date().'</b>\')');

# markup that will call a function also defined in config.php to do the 
html-job
Markup('showtime3', 'directive', '/\(:showtime3:\)/e','anyphpfunc()');

# KEEP() will escape the html-characters (I think)

function anyphpfunc()
{
    $htmltext = "<b>" . date() . "</b>";
    return KEEP($htmltext);
}

--- end of config.php ---

in Main.SideBar and your Wiki.Page:

text (:showtime1:) more text

calling the anyphpfunc() you could also pass arguments specified in the 
markups.
If you need some samples how to define markups, see scripts/stdmarkup.php.

Hope that helps.

Knut



More information about the pmwiki-users mailing list