Custom "Raw" tag

Author Message

Marvin Gardens

Monday 04 May 2009 6:46:03 am

I'm trying to make a tag that just spits out the content of the tag untouched. Similar to <literal> but without the <pre> tags wrapping it.

Here is what I have so far:

First content.ini appends in both my custom siteaccess as well as the admin site access:

<b>settings/siteaccess/custom_site/content.ini.append.php</b>
[CustomTagSettings]
AvailableCustomTags[]
AvailableCustomTags[]=raw
IsInline[raw]=true

<b>settings/siteaccess/admin/content.ini.append.php</b>
[CustomTagSettings]
AvailableCustomTags[]
AvailableCustomTags[]=raw
IsInline[raw]=true

Next the design, which is simply content spit out:

<b>design/custom_site/templates/content/datatype/view/ezxmltags/raw.tpl</b>
{$content}

And finally trying to use it in ezpublish:
<custom name='raw'>
<form> <more straight html tags and text> </form>
</custom>

I've cleared cache and try to save the above article and get:
<b>
The draft could not be stored.
Required data is either missing or is invalid:
* Body: Unknown tag: <form>.
</b>

Marvin Gardens

Monday 04 May 2009 6:47:14 am

Sorry, hit submit too soon. Can anyone see anything wrong with what I've done, or have a suggestion or pointer as to how I can do this?

Thanks in advance
Marvin

André R.

Monday 04 May 2009 7:47:38 am

Use literal, its the only tag that supports this.
Then use a specific class to ouput the html directly, the html class disabled by default does this. It's disabled since it is a security issue to let everyone input raw html (hint: javascript).

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Marvin Gardens

Monday 04 May 2009 10:00:48 am

So now I have

[literal]
AvailableClasses[]=html

in my content.ini.append.php in both my custom siteaccess and admin. Looking at the literal.tpl, that should just spit out the straight html, but I can't save the draft with:

<literal class='html'>
blah blah blah
</literal>

I get the error:
<b>Body: Class 'html' is not allowed for element <literal> (check content.ini).</b>

I clear the cache after each ini edit (well after every edit until I can figure this out).

Am I missing a step to enable the html.

m.

P.S. we have one dependable editor so we are good turning on html.
P.P.S too bad custom won't accept tags... that would be a nice feature.

André R.

Monday 04 May 2009 11:18:17 am

Take a look at this setting in setup -> ini -> content.ini + your admin siteaccess to see if it is overwritten somewhere.

> P.S.

Ok, should be safe then.

> P.P.S.

custom tags and literal tags are for different purposes, custom tags can be nested and contain other tags so child tags are ezxml, and not threated like raw text.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

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 19 2025 00:08:05
Script start
Timing: Jan 19 2025 00:08:05
Module start 'layout'
Timing: Jan 19 2025 00:08:05
Module start 'content'
Timing: Jan 19 2025 00:08:06
Module end 'content'
Timing: Jan 19 2025 00:08:06
Script end

Main resources:

Total runtime1.1597 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 587.7891152.6094
Module start 'layout' 0.00770.0033 740.398439.4297
Module start 'content' 0.01101.1470 779.8281572.8047
Module end 'content' 1.15800.0017 1,352.632816.1875
Script end 1.1597  1,368.8203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2906160.0002
Check MTime0.00130.1147160.0001
Mysql Total
Database connection0.00170.144310.0017
Mysqli_queries1.083293.4012630.0172
Looping result0.00070.0597610.0000
Template Total1.095094.420.5475
Template load0.00240.208320.0012
Template processing1.092694.207020.5463
Template load and register function0.00020.020510.0002
states
state_id_array0.00260.221410.0026
state_identifier_array0.00190.167420.0010
Override
Cache load0.00190.1657590.0000
Sytem overhead
Fetch class attribute can translate value0.00070.058720.0003
Fetch class attribute name0.00260.228260.0004
XML
Image XML parsing0.00080.068620.0004
class_abstraction
Instantiating content class attribute0.00010.004770.0000
General
dbfile0.00540.4630170.0003
String conversion0.00000.000840.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
11content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 35
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs