Dec 1, 2009

PHP didalam Plone

Keynya adalah PHPParser. Berikut di cut and paste dari Males nerjemahin.

Integrating PHP applications in Plone

How to use PHPParser to display content from an external PHP application inside Plone.

Here are the steps to follow:

  • Install PHParser
  • From the ZMI, add a PHParser item that references each of your existing PHP page. For instance, if one of your PHP pages is located in /myphp/index.php, your PHParser item will contain:

  • In the ZMI, create a Page template for each PHP file. Each Page template will reference a PHParser item. For instance, if you have called your PHParser item mainPage:
  • You need the keyword structure if your PHP file generates HTML. If your PHP file generates plain text, you can simply use: content="here/mainPage".

Thanks to Wei He, creator of PHParser, for his help.

A more generic way

If you have many php files this is very tedious. There is in fact a more generic way, using one single template for all:

  • Create the template in your portal_skins/custom folder instead, call it php_view and modify it slightly
  • Replace
  • With
  • Then you access all your PHParser pages with myphppage/php_view

Note that you must consider security if you take the generic approach: remember that all your PHP files in that particular folder will be accessible.

No comments:

Post a Comment