[pmwiki-users] Re: pb with PmWiki

Knut Alboldt pmwiki at alboldt.de
Sun Feb 6 13:22:14 CST 2005


p.morizot at free.fr schrieb:
> Thanks Knut for the answer but defining  markups solutions it is like learning a
> new programming language

I can understand that, sometimes that regex-stuff really drives me crazy 
! :-) (sorry, PM !)

, my pmwiki site will have an open source tutoring page
> so for that group I would not mind to be able that users write html and php
> code by the way that was one the reason pm wrote this program.

I think, there is no problem if the wiki-owner wants to accept executing 
php and html. I think everyone is free to use pmwiki in his / her way :-).

Ok, so author may enter php and html in wiki-pages.
well, then there would be the following possibilities:

1. if the html and / or phpcode should not be integrated in the wikipage 
the html / php code could be uploaded as an attachment and then executed 
when clicking on the attachment-link with the mouse.

2. if the html-code and / or php-code must reside within the wiki-page 
(so expanding the wiki-functions) it should be possible to create a 
markup you have to integrate in your config.php which will make it 
possible to execute html and php-code within a wikipage. For html there 
is already a Cookbook-Entry for allowing HTML-code, see 
http://www.pmwiki.org/wiki/Cookbook/EnableHTML. It's only that you have 
to define every html-tag, you want to allow the user to add in the var 
$AllowedTags.

It would be something like:

(:html:) [=
html-code goes here
=]

or

(:php:) [=
php-code goes here
=]

or even

<?php
php code goes here
?>

(it might be done in the way beautifier and or codeblock gets blocks of 
wiki-text and then eval it all)

Maybe PM or some other php/pmwiki-guru would have a quick solution for 
that. I'll send a copy to the list

> 
> but to solve my problem in the present would it be any problem if I put my htm
> and php code in the pmwiki\pub\skins\pmwiki.tmpl ?

HTML-code would be ok I think. PHP can be executed (quote from 
http://www.pmwiki.org/wiki/PmWiki/LayoutAdvanced):

Call a PHP function <!--function:SomeFunction ''arguments''-->
     You could use this to call a function you defined in your 
local/config.php which may print out different text based on, say, the 
current page or group. The function receives full page name (ex. 
PmWiki.LayoutAdvanced) and the text following function name (which is 
optional and can be omitted).

this way you only have to define the php-code within your config.php

> 
> regards and happy new years from china.
> 
> 
> 
> 
> 
> Selon Knut Alboldt <pmwiki at alboldt.de>:
> 
> 
>>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