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.