Tags:
create new tag
view all tags

Question

Is it possible to have a php script in a twiki page, such that the script will generate for example a twiki table from data queried from a database?

Environment

TWiki version: TWikiRelease04x00x05
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Javascript

-- DanBarDov - 12 Dec 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I've set "php_admin_flag engine on" in twiki_httpd.conf, and I enabled includeurl in configure. I do not get any errors in apache's error log when loading the page, but I also don't get anything from the included php script.

I used

% INCLUDE{https://twiki.org/p/pub/Support/PhpScript/test.php.txt raw="on"}%
in order to run my test script. If I could do this inline, I'd prefer it.

-- DanBarDov - 12 Dec 2006

Even if it would be possible to configure the system to execute PHP code in TWiki topic text I would not recommend it. This is a big security hole because arbitrary code can be executed on the server by anyone editing a TWiki topic.

You can however safely INCLUDE a PHP generated webpage into a TWiki topic.

-- PeterThoeny - 13 Dec 2006

Can you explain how. I'd like the page to be re-generated each time the topic is loaded. Security is not an issue - this is for an intranet.

-- DanBarDov - 13 Dec 2006

Simply %INCLUDE{http://otherserver.example.com/some/php/script.php}%. This will load the page each time you look at the TWiki topic. If inclined, put that into an IFRAME, see IFrameExample.

-- PeterThoeny - 14 Dec 2006

Change status to:
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-12-14 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.