Loading...
 
Features / Usability

Features / Usability


Having Problems including a php file in w iki page

posts: 79 United States

My question is about he code() plugin. I currently use a news provider that creates a .dat file for me to display the news. I am trying to use the following line to display the information in that file.

Copy to clipboard
<?php include('html.dat'); ?>



This outputs nothing

Does anyone have an idea as to how this can work.


Thank you

Travisr

posts: 4656 Japan

> My question is about he code() plugin. I currently use a news provider that creates a .dat file for me to display the news. I am trying to use the following line to display the information in that file.

...

>
> Does anyone have an idea as to how this can work.

PHP statements can't be used directly in wiki pages, as far as I know. The most common workaround for this is to put an iframe in a wiki page to display a php file that contains your code.

By the way, the CODE plugin is for displaying sourcecode, not for executing the code. There are {php} {/php} brackets that you can use for php statements, but these are used in a template file (.tpl) not in wiki pages.

-- Gary


posts: 25 United States
The best way to include PHP code is to write a plugin. Take one of the simpler plugins (like CENTER) and hack it up to have your CODE and then just call it like a plugin. Just be verrrrry careful what you name your functions... tw will break if you choose a function name that exists in other plugins or modules.