[Pmwiki-users] Developer Question
Greg Morgan
Cybie
Sun Mar 21 23:34:29 CST 2004
Steven Leite wrote:
> I'm writing an add-on, and I want to pull information from a data
> file. If I just include the following line of text in my .php file:
>
> *$filename = "datafile.txt";*
> *$file_contents = file($filename);*
>
> That solves my problem, but I want to do more. I want the data files
> to be a WikiPage.
>
> Q: How can I extract the contents of a WikiPage and send it to my script?
>
> I guess there are two approaches.
>
> One is to directly pull it from the wiki.d directory, but that's kind
> of messy, especially since there's other information in that file
> besides just Wiki Text.
>
> The second approach would be to call it from PmWiki, and have it
> served to the script. Problem there might be it comes with all the
> formating from any template file that might exist. I want just the
> WikiText, nothing else.
>
> I might want to use a password protected WikiPage as a data-store,
> employing omma delimited, or pipe delimted data file for example.
>
> Thanks!
>
> Steven Leite
Well you could try this. Assuming $file_contents contains the text you
want to wiki format.
PrintText($pagename,$file_contents);
or if you wanted the formatted wiki text to be stored in a variable try
this...
ob_start();
PrintText($pagename,$file_contents);
$mywikitext:=ob_get_contents ();
ob_end_clean();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://contra.vosn.net/pipermail/pmwiki-users_pmichaud.com/attachments/20040321/53da28ac/attachment.htm
More information about the pmwiki-users
mailing list