Ruben Montejano wrote:
Hi everybody,
The task I am trying to accomplish is to be able to call an object(it could be a dtml method, python script, php document, etc), given its path as a string parameter. Let's say my directory structure looks like this: /-+-Plone-+-homepage +-reports-+-Site1 +-Site2-+-myObject +-... +-...
I need to call myObject, which path is '/Plone/reports/Site2/', from any other directory within the directory structure, but at this time I'm using homepage.
Browsing the mailing list I found that I could use restrictedTraverse, so I created an External Method getObject under the homepage directory with the following code:
def getObject( self ): return self.restrictedTraverse('/Plone/reports/Site2/myObject')
myObject in this case is a php document that contains: <?php include "http://2ksvr/ploneSupp/lines.php?wk=2002-06-01"; ?>
Now using the External Method from the homepage's index_html: <dtml-var getObject>
This is what I get, instead of the chart that this object displays: <?php include "http://2ksvr/ploneSupp/lines.php?wk=2002-06-01"; ?>
I don't think you really need restrictedTraverse here, but can let acquisition do the job:: <dtml-var "Plone.reports.Site2.myObject"> should work fine. Even better:: <span tal:replace="structure context/Plone/reports/Site2/myObject" /> But that's just because I push ZPT. The basic problem you have above seems to be that the basic "call" behaviour of the PHP document object is to hand over its source, and not to render itself, which is strange. (Can you just visit that URL and see it rendered?) You may be able to get it to do that by tacking an 'index_html' at the end. Otherwise you'll have to investigate the API/source of that object to see what method makes it render itself. I don't know anything about it, so I can't tell you off-hand. (You may be able to find this out based on the URL of the "view" tab in the ZMI.) --jcc -- "My point and period will be throughly wrought, Or well or ill, as this day's battle's fought."