How to remove the last character of a loop

Author Message

Brendan Pike

Thursday 05 August 2004 7:14:08 am

Could someone with stronger code skills please help resolve the issue preventing the vertical scroller adaption http://www.ez.no/community/contributions/template_plugins/vertical_latest_news_scroller from working in IE. The parsed loop results in the following format:
['href','text','target'],
['href','text','target'],
However the comma must be stripped from the last loop result for it to work. Ideas anyone?

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Paul Borgermans

Thursday 05 August 2004 7:22:38 am

Hi Brendan

{delimiter} is your friend here:

modify article_listitem.tpl by removing the comma:

[{$node.url_alias|ezurl('single')},
'{$node.object.data_map.intro.content.output.output_text|striptags|trim}','_blank']

in your node_list.tpl change the loop as follows:

{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
        {node_view_gui view=listitem content_node=$Node:item}
        {delimiter},{/delimiter}
    {/section}

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Brendan Pike

Thursday 05 August 2004 7:40:25 am

Magic thanks Paul!

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

Lydie Soler

Tuesday 09 August 2005 8:02:06 am

Hi I have modified the loop in order to exclude some elements:

{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{if not(eq($Node:item.object.section_id,6))}
 
        {node_view_gui view=listitem content_node=$Node:item}
{delimiter},{/delimiter}
{/if}

    {/section}
	

but now the , is never printed....

Any idea???

Lydie Soler

Wednesday 10 August 2005 2:19:46 am

Hi,

well finaly I have found the solution so here it is...

{section name=Node loop=$node_list sequence=array(bglight,bgdark)}
{section-exclude match=$Node:item.object.section_id|eq(6)}
{node_view_gui view=listitem content_node=$Node:item}
{delimiter },{/delimiter}
{/section}

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 18:53:04
Script start
Timing: Jan 19 2025 18:53:04
Module start 'layout'
Timing: Jan 19 2025 18:53:04
Module start 'content'
Timing: Jan 19 2025 18:53:04
Module end 'content'
Timing: Jan 19 2025 18:53:04
Script end

Main resources:

Total runtime0.0208 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0050 590.4219152.6406
Module start 'layout' 0.00500.0036 743.062539.4766
Module start 'content' 0.00860.0085 782.539193.4922
Module end 'content' 0.01710.0037 876.031334.3047
Script end 0.0208  910.3359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.8104140.0002
Check MTime0.00136.3118140.0001
Mysql Total
Database connection0.00052.382310.0005
Mysqli_queries0.003014.545530.0010
Looping result0.00000.129410.0000
Template Total0.003215.510.0032
Template load0.00167.446910.0016
Template processing0.00177.994310.0017
Override
Cache load0.00063.060310.0006
General
dbfile0.003014.524980.0004
String conversion0.00000.048140.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