Generate HTML email from XML block content attribute

Author Message

Michal Slocinski

Thursday 09 December 2010 9:42:08 am

Hi!

I have an extension which sends HTML emails to users and administrators of the portal.

I would like to make these emails customizable and be able to define content of these emails using Online Editor. I know how to fetch content of an attribute, put it into the email and send it out however I don't know how to transform content of an attribute edited with Online Editor into HTML.

Could someone point me to the right class that will do the job?

Ivo Lukac

Friday 10 December 2010 2:25:49 am

Try this:

{$node.data_map.YOUR_EDITOR_ATTRIBUTE.content.output.output_text}

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Daisy Radix

Friday 10 December 2010 8:32:50 am

In php you can use the methode which convert xml to html :

$converter = new eZXHTMLXMLOutput( your_xml_content, false, your_attribute);

$converter ->outputText();

You maybe can use it in custom operator template...

eZ Publish certified developper :http://auth.ez.no/certification/verify/378142

Quoc Huy Nguyen Dinh

Friday 10 December 2010 6:04:36 pm

Or you can also create a template override to view the node containing the XML attribute. Then create a module view that would open the URL (fopen or curl) get the HTML and send it out. This will also allow you to have a URL for the link for "if you have trouble viewing this email, click here".

Michal Slocinski

Saturday 11 December 2010 12:37:52 am

"

In php you can use the methode which convert xml to html :

$converter = new eZXHTMLXMLOutput( your_xml_content, false, your_attribute);

$converter ->outputText();

You maybe can use it in custom operator template...

"

excellent, this did the job!

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 18 2025 02:49:47
Script start
Timing: Jan 18 2025 02:49:47
Module start 'layout'
Timing: Jan 18 2025 02:49:47
Module start 'content'
Timing: Jan 18 2025 02:49:47
Module end 'content'
Timing: Jan 18 2025 02:49:47
Script end

Main resources:

Total runtime0.0150 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.2891152.6563
Module start 'layout' 0.00640.0026 741.945339.5156
Module start 'content' 0.00900.0041 781.460993.3984
Module end 'content' 0.01310.0019 874.859434.2891
Script end 0.0150  909.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002214.5031140.0002
Check MTime0.00096.1561140.0001
Mysql Total
Database connection0.00085.647310.0008
Mysqli_queries0.002919.633730.0010
Looping result0.00000.066810.0000
Template Total0.001610.610.0016
Template load0.00074.461310.0007
Template processing0.00096.122710.0009
Override
Cache load0.00053.012910.0005
General
dbfile0.00042.648880.0000
String conversion0.00000.054140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs