Displaying content if there is content

Author Message

arthur foelsche

Friday 02 May 2003 10:03:45 am

Sorry for yet another newbie question. I have a custom class which sometimes has data in it. I want to display it, along with other html when there is data in it. I tried the following:

{section show=$content_version.datamap.article_fan_notes}
<b>text</b>: {attribute_view_gui attribute=$content_version.data_map.article_fan_notes}<hr noshade size=0>{/section}

i tried using the eq operator as well, but this didn't seem to work either. What is the syntax the show command to display if there is data?

thanks!

arthur

Paul Borgermans

Friday 02 May 2003 11:56:28 am

(not tried but) Does the follwing work?

{section show=gt(count($content_version.datamap.article_fan_notes),0)}
<b>text</b>: {attribute_view_gui attribute=$content_version.data_map.article_fan_notes}<hr noshade size=0>{/section}

The count operator on strings gives the string size, hence ...

hth

Paul

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

arthur foelsche

Friday 02 May 2003 12:45:31 pm

Well I thought this was going to be a good solution to this, but unfortunately, it seems that
{count($content_version.data_map.article_fan_notes)}
consistently returns the value of 18 regardless which is the number of charaters + 1 for article_fan_notes (not sure if that is why its returning 18, but that's my guess) How do i get count to count the actual data?

thanks for your help.

I guess this post really is in the wrong place. Sorry!

arthur foelsche

Sunday 04 May 2003 7:16:10 pm

here's how i ended up solvign this:

{section show=ne($content_version.datamap.article_fan_notes.content,"")}
{attribute_view_gui attribute=$content_version.data_map.article_fan_notes}
{/section}

Paul Borgermans

Monday 05 May 2003 2:15:18 am

Thanks for digging and bringing a solution to the surface.

There are strange things happening. I was also looking at something like

$content_version.datamap.article_fan_notes.data_text as this shows up with the right content when you do

{$content_version.datamap.article_fan_notes|attribute(show)}

But accessing $content_version.datamap.article_fan_notes.data_gives nothing (empty) even when there is content.

So the attribute operator can be quite misleading!

Paul

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

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 18 2025 16:03:41
Script start
Timing: Jan 18 2025 16:03:41
Module start 'layout'
Timing: Jan 18 2025 16:03:41
Module start 'content'
Timing: Jan 18 2025 16:03:42
Module end 'content'
Timing: Jan 18 2025 16:03:42
Script end

Main resources:

Total runtime0.8371 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.0055 589.1563152.6406
Module start 'layout' 0.00550.0026 741.796939.4922
Module start 'content' 0.00810.8273 781.2891560.1719
Module end 'content' 0.83550.0016 1,341.460912.1406
Script end 0.8371  1,353.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.4022160.0002
Check MTime0.00130.1517160.0001
Mysql Total
Database connection0.00110.131310.0011
Mysqli_queries0.783293.5561630.0124
Looping result0.00050.0595610.0000
Template Total0.806496.320.4032
Template load0.00210.251220.0011
Template processing0.804396.081320.4022
Template load and register function0.00010.016510.0001
states
state_id_array0.00200.236910.0020
state_identifier_array0.00130.153020.0006
Override
Cache load0.00180.2140370.0000
Sytem overhead
Fetch class attribute can translate value0.00070.079420.0003
Fetch class attribute name0.00090.101860.0001
XML
Image XML parsing0.00050.059420.0002
class_abstraction
Instantiating content class attribute0.00000.002070.0000
General
dbfile0.00070.0876170.0000
String conversion0.00000.000640.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
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/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: 21
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs