Forums / Developer / Coding an e-vite extension, accessing an object...
Andrew K
Monday 10 July 2006 10:15:59 am
Please forgive my ignorance. I'm very new to Exponential.
I am coding an e-vite extension that allows for an admin to create a object that holds invitation information. Then the end user goes to that object and has the option to send the invitation to a friend. This is similar to tip-a-friend. But the actual content of the object is the body of the email.
So here's what I've done. I've created a new evite class through the admin. It has a title and body attribute, as well as to and from email data collectors (I probably don't need these, since I could code the input tags directly in to the template)
I've created a new extention with an action file that will email the evite to the specified.
First is this the best method of accoplishing what I'm looking for?
Second, how do I access the attributes (title and body) of the evite object in my PHP action code? Is there an object retieval PHP function I can use? I'd rather not send the attributes via http POST.
I hope this makes sense.
--Andrew
Łukasz Serwatka
Monday 17 July 2006 11:19:41 pm
Hi Andrew,
In form where you triggering new action you need to define ContentObjectID hidden input form. Then in your PHP code you can fetch object and access contentobject attributes.
include_once ('lib/ezutils/classes/ezfunctionhandler.php'); // {def $object=fetch( 'content', 'object', hash( 'object_id', 2 ) )} $object = eZFunctionHandler::execute( 'content','object', array( 'object_id' => $http->postVariable("ContentObjectID")) ); // {$object.data_map} $dataMap =& $object->dataMap(); // {$object.data_map.body.content.output.output_text} $body =& $dataMap['body']->content(); $bodyOutput =& $body->attribute('output'); $bodyOutputText = $bodyOutput->attribute('output_text');
Some more information:http://ez.no/community/forum/developer/defining_methods_or_custom_actions_for_content_classes/re_defining_methods_or_custo
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Tuesday 18 July 2006 7:00:26 am
Yup. That's what I'm looking for!Thanks.