Forums / Setup & design / help to get an Object in PHP script
SathishKumar Subramanian
Thursday 08 April 2004 10:20:21 pm
Hi Everyone,
I want to get the current object and its attributes (also their values) using PHP script. Could any one guide me to get those details? Please help.
Thanks & regards,Sathish
Björn X
Tuesday 13 April 2004 5:32:33 am
You mean somthing like this?
$co = & eZContentObject:fetch($objectid); $datamap = & $co->atrribute('data_map'); $sometext = $datamap['body']->content();
Wednesday 14 April 2004 4:31:31 am
Hi Björn,
Thanks for your reply . Yes, I need to get the attributes of the current object using the PHP script.
I have included the piece of PHP script which you have mentioned. The code is:
include_once("kernel/classes/ezcontentobject.php"); $co = & eZContentObject:fetch($objectid); /* line 22 */ $datamap = & $co->atrribute('data_map'); /* line 23 */$sometext = $datamap['resource_folder']->content(); /* Attribute is resource_folder */
But I am getting error like:
Fatal error: Call to a member function on a non-object in /home/hopetalk/Exponential-3.2-4/extension/urlredirect/modules/urlredirect/redirect.php on line 23 Fatal error: Exponential did not finish it's requestThe execution of Exponential was abruptly ended, the debug output is present below. ...
I didnt know about the object ID. Is it because of the object ID?If so then how can I get the Object ID ?
Or am I implementing the code wrong?
Please help me to get the solution.