Coding an e-vite extension, accessing an object...

Author Message

Andrew K

Monday 10 July 2006 10:15:59 am

Please forgive my ignorance. I'm very new to ezPublish.

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

Andrew K

Tuesday 18 July 2006 7:00:26 am

Yup. That's what I'm looking for!
Thanks.

--Andrew

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 21 2025 04:23:03
Script start
Timing: Jan 21 2025 04:23:03
Module start 'layout'
Timing: Jan 21 2025 04:23:03
Module start 'content'
Timing: Jan 21 2025 04:23:05
Module end 'content'
Timing: Jan 21 2025 04:23:05
Script end

Main resources:

Total runtime1.6547 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.0469151.2266
Module start 'layout' 0.00580.0026 739.273436.6797
Module start 'content' 0.00831.6455 775.9531561.5313
Module end 'content' 1.65380.0008 1,337.484411.8125
Script end 1.6546  1,349.2969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.1949160.0002
Check MTime0.00130.0791160.0001
Mysql Total
Database connection0.00100.060210.0010
Mysqli_queries1.608097.1807570.0282
Looping result0.00070.0399550.0000
Template Total1.617397.720.8086
Template load0.00220.134020.0011
Template processing1.615197.606420.8075
Template load and register function0.00030.016410.0003
states
state_id_array0.00210.125310.0021
state_identifier_array0.00280.170920.0014
Override
Cache load0.00190.1121220.0001
Sytem overhead
Fetch class attribute can translate value0.00100.063220.0005
Fetch class attribute name0.00140.085040.0004
XML
Image XML parsing0.00070.044320.0004
class_abstraction
Instantiating content class attribute0.00000.000540.0000
General
dbfile0.00080.0475180.0000
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs