Forums / Setup & design / Custom "Raw" tag

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