Pablo Fernandez
Pablo Fernandez

Reputation: 287800

How to include output of PHP script in Python driven Plone site?

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.

Upvotes: 2

Views: 1679

Answers (3)

user13876
user13876

Reputation:

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()

Upvotes: 1

Bite code
Bite code

Reputation: 597351

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.

Upvotes: 1

Reinout van Rees
Reinout van Rees

Reputation: 13634

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.

Upvotes: 0

Related Questions