tags:

views:

649

answers:

3

I need to have the output of a PHP snippet in a Plone site. It was delivered to be a small library that has a display() function, in PHP, that outputs a line of text. But I need to put it in a Plone site. Do you have any recommendations?

I was thinking a long the lines of having a display.php that just runs display() and from the Plone template to download that URL and output the content. Do you think it might work? What methods of hitting a URL, retrieve the content and outputting can I use from inside a Plone template?

One important and critical constraint is that the output should be directly on the HTML and not an an iframe. This is a constraint coming from the outside, nothing technical.

A: 

Probably the easiest way: install windowz inside your site. That way you get a page with an iframe in your plone layout. Make sure the php script outputs a regular html page and configure your windowz page with that url. Done.

Works great for existing in-company phonebook applications and so.

Reinout van Rees
Thank you for the answer. My apologies that I've forgot to mention that I can't use iframe due to external constraints. Thanks.
J. Pablo Fernández
+1  A: 

Well, use AJAX to call the PHP script (yes, you will need apache) and display the output. Adding a custom JS to plone is trivial and this abstract the technology issue.

Just be sure this is not a critical feature. Some users still deactivate JS and the web page should therefor degrade itself nicely.

e-satis
+1  A: 

Another option is to run the PHP script on the server using os.popen, then just printing the output. Quick and dirty example:

import os
print os.popen('php YourScript.php').read()
sli