Forums / Setup & design / Shorten functionnality and listitem conflict

Shorten functionnality and listitem conflict

Author Message

laurent le cadet

Friday 25 March 2005 1:25:09 am

Łukasz Serwatka

Tuesday 29 March 2005 1:36:49 am

Hi laurent,

Have you tried with wash() operator?

{$node.object.data_map.intro.content.output.output_text|wash(  xhtml )|shorten( 50 )}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

laurent le cadet

Tuesday 29 March 2005 4:26:29 am

Hi Lukasz,

Yes I tryied but I have a result like this

<p> My shorten text...

or

<p> My shorten t<br /...

Laurent

Bård Farstad

Tuesday 29 March 2005 4:39:30 am

Hi Laurent,

You should strip the tags if you want to use the shorten tag with XML content. Some info on how to do so can be found here:
http://www.ez.no/community/forum/developer/operator_to_strip_off_html_tags

Cheers,

--bård

Documentation: http://ez.no/doc

laurent le cadet

Tuesday 29 March 2005 7:12:26 am

Hi Bård,

That's what I did previously.
I override template.ini in the override directory.
template.ini.append.php :

<?php /* #?ini charset="iso-8859-1"?

PHPOperatorList[]
PHPOperatorList[striptags]=strip_tags

*/ ?>

and add in mysite/override/templates/listitem/article.tpl

<div class="attribute-short">     {$node.object.data_map.intro.content.output.output_text|striptags|shorten( 50 )}
</div>

It works fine but without formatting text or image in the shorten string.

Laurent.

laurent le cadet

Tuesday 29 March 2005 8:23:42 am

in fact with this code

{$node.object.data_map.intro.content.output.output_text|striptags|shorten( 50 )}

it cut the string but preserve formatters:

<div class="attribute-short">
<p>
Le projet de réaménagement du club house p...
</div>

What I understand that the |wash operator render the <p> tag as text but didn't remove it.

Bård Farstad

Thursday 31 March 2005 3:13:58 am

Laurent,

if you have XML text it's hard to convert it to a limited number of characters without removing the formatting. So you should just use the strip tags followed by a shorten operator. Formatting and images will be gone, just the plain text is left.

You are correct, the wash() operator does only convert HTML specific characters like <, > and & to &gt; and so on.

--bård

Documentation: http://ez.no/doc

laurent le cadet

Thursday 31 March 2005 4:17:10 am

thanks.

Laurent.

eZ debug

Timing: Jan 19 2025 01:15:18
Script start
Timing: Jan 19 2025 01:15:18
Module start 'content'
Warning: PHP: E_WARNING Jan 19 2025 01:15:19
DOMDocument::loadXML(): Opening and ending tag mismatch: literal line 8 and paragraph in Entity, line: 10 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Warning: PHP: E_WARNING Jan 19 2025 01:15:19
DOMDocument::loadXML(): Opening and ending tag mismatch: paragraph line 8 and section in Entity, line: 16 in /home/ze/public_html/share.se7enx.com/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php on line 174
Timing: Jan 19 2025 01:15:19
Module end 'content'
Timing: Jan 19 2025 01:15:19
Script end

Main resources:

Total runtime1.0147 sec
Peak memory usage4,096.0000 KB
Database Queries211

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 589.0859180.8125
Module start 'content' 0.00760.8267 769.8984659.5078
Module end 'content' 0.83430.1803 1,429.4063341.2656
Script end 1.0146  1,770.6719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.4620210.0002
Check MTime0.00180.1773210.0001
Mysql Total
Database connection0.00120.113910.0012
Mysqli_queries0.906889.36212110.0043
Looping result0.00280.27542090.0000
Template Total0.976696.220.4883
Template load0.00210.211820.0011
Template processing0.974496.027920.4872
Template load and register function0.00010.008810.0001
states
state_id_array0.00250.248710.0025
state_identifier_array0.00360.357020.0018
Override
Cache load0.00190.1917520.0000
Sytem overhead
Fetch class attribute can translate value0.00180.182240.0005
Fetch class attribute name0.00140.1356110.0001
XML
Image XML parsing0.00250.244640.0006
class_abstraction
Instantiating content class attribute0.00000.0041160.0000
General
dbfile0.00260.2603420.0001
String conversion0.00000.000630.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
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/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
7content/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs