Forums / Setup & design / {literal} in articles?

{literal} in articles?

Author Message

Jeroen Sangers

Friday 09 June 2006 8:47:50 am

Sometimes I want to enter some literal HTML or JavaScript text on a page, for example when I want to add a little tracking code to measure the result of an advertising campaign. At this moment the only way of doing so is by generating a template override for that specific page and enter the page there. That is a lot of work! Besides that, it is still impossible to add HTML in the middle of a text.
Is there really no way to have the equivalent of {literal} work inside articles?

Marcin Drozd

Friday 09 June 2006 3:07:38 pm

Hi Jeroen
It works with:

<literal class='html'>
some code
</literal>

http://ez-publish.pl

Jeroen Sangers

Wednesday 14 June 2006 2:15:43 am

Thanks! I must have read over it when I checked the documentation.

Ciprian Popovici

Wednesday 14 June 2006 2:23:11 am

The only thing <literal> does is create a <pre> block and apply wash() to everything in it. Doing class='blabla' only produces a <pre class='blabla'>, with everything inside it still washed.

Jeroen, I'm thinking you could accomplish this by creating your own custom tag, as well as an "unwash" eqivalent, some kind of reverse wash.

<b>Step 1:</b> Go in <b>both</b> the admin siteaccess and in the siteaccess you want to use this, and add this to custom.ini.append.php (create them if they don't exist):

[CustomTagSettings]
AvailableCustomTags[]=html
IsInline[html]=true

<b>Step 2:</b> Go to settings/override/template.ini.append.php and create an unwash function:

[PHP]
PHPOperatorList[unwash]=html_entity_decode

<b>Step 3:</b> Create the override, by going to design/yoursite/templates/content/datatype/view/ezxmltags/ and creating html.tpl with this in it:

{$content|unwash()}

<b>Step 4:</b> Clear your ini cache (possibly your template cache too).

<b>Step 5:</b> In the admin interface, every time you edit an XML block you can now add something like this:

<custom name='html'>&raquo;</custom>

...or whatever other HTML you want.

Jeroen Sangers

Wednesday 14 June 2006 2:49:22 am

That is not true!
The solution provided by Marcin Drozd works perfectly. It does not create a PRE block, but enters the provided code directly into the final page. There is no need to set up custom tags.

Marcin Drozd

Wednesday 14 June 2006 7:04:28 am

Hi guys
Yes,
<literal> creates <pre> tag, but
<literal class='html'> does not create <pre> tag.

http://ez-publish.pl

Ciprian Popovici

Thursday 15 June 2006 4:58:21 am

What ez Publish version are you using? On my 3.7.2 install, if I put HTML tags or HTML entities inside <literal class='html'></literal>, they end up escaped. Perhaps it's something else I'm missing? Did you guys override your literal template to do that?

If I put this in an XML block:

<literal class="html"><u>&raquo;</u></literal>

It will be rendered as:

<pre class="html">&lt;u&gt;&amp;raquo;&lt;/u&gt;</pre>

and NOT like this:

<u>&raquo;</u>

...thus negating the original request: ability to enter HTML or JavaScript code.

Jeroen Sangers

Thursday 15 June 2006 7:12:43 am

I am using eZ Publish 3.8.

Ciprian Popovici

Thursday 15 June 2006 7:24:07 am

Ah, there you go. They must've added this in 3.8. Anyway, for 3.7 users you have to resort to tricks like above. You could override the template for <literal> (haven't tried it), test for $class being "html" and apply unwash() on $content if it matches.

eZ debug

Timing: Jan 18 2025 16:34:49
Script start
Timing: Jan 18 2025 16:34:49
Module start 'content'
Timing: Jan 18 2025 16:34:49
Module end 'content'
Timing: Jan 18 2025 16:34:49
Script end

Main resources:

Total runtime0.6755 sec
Peak memory usage4,096.0000 KB
Database Queries214

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0074 587.6875180.8438
Module start 'content' 0.00740.5654 768.5313646.7109
Module end 'content' 0.57280.1027 1,415.2422340.4609
Script end 0.6754  1,755.7031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5881210.0002
Check MTime0.00150.2247210.0001
Mysql Total
Database connection0.00090.136910.0009
Mysqli_queries0.596788.33902140.0028
Looping result0.00180.27122120.0000
Template Total0.648296.020.3241
Template load0.00230.340620.0012
Template processing0.645995.616420.3229
Template load and register function0.00010.019810.0001
states
state_id_array0.00070.103310.0007
state_identifier_array0.00080.122920.0004
Override
Cache load0.00190.2873490.0000
Sytem overhead
Fetch class attribute can translate value0.00160.231940.0004
Fetch class attribute name0.00100.1446100.0001
XML
Image XML parsing0.00140.201140.0003
class_abstraction
Instantiating content class attribute0.00000.0028130.0000
General
dbfile0.00210.3149270.0001
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
9content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 43
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs