How to Embed PHP in HTML print

Duncan Booth duncan.booth at invalid.invalid
Sun Jan 24 05:37:51 EST 2010


NickC <reply-to at works.fine.invalid> wrote:

> Some possible ideas:
> Is there a way I can get python to call functions within a PHP app?
> Perhaps write the plugin in a separate script in PHP, and include that 
> page within my output so that apache recognises the page inclusion?  How 
> to get apache to pay attention to the output so it "wakes up" and does 
> some server-side includes?
> 
One option would be to ditch either the Python or the PHP and do everything 
in one language.

Probably your simplest option is to get the web server to generate the PHP 
output separately. Since it's the same web server you can just use some 
javascript in the final web page to call in the PHP generated content with 
ajax. Alternatively, use urllib in Python to retrieve a page from the 
Apache server and insert that into its own output: that way you won't 
requrie javascript in the client, but that might be messy if you have 
authentication or sessions going on.



More information about the Python-list mailing list