Share » Forums » Setup & design » If-then-else and is_empty

If-then-else and is_empty

If-then-else and is_empty

Thursday 28 April 2005 12:16:33 am - 10 replies

Modified on Thursday 28 April 2005 12:30:24 am by Trond Hjelmaas

Author Message

Eivind Marienborg

Thursday 28 April 2005 12:19:19 am

Maybe is_valid could work?

Trond Hjelmaas

Thursday 28 April 2005 12:29:12 am

Thanks for suggestion, I tried:
{section show=$:item.object.data_map.title.is_valid}

and
{section show=$:item.object.data_map.title.content.is_valid}

but it goes to {section-else} 100% of the time.

Any other suggestions :) ?

Eivind Marienborg

Thursday 28 April 2005 12:38:58 am

How about setting up the title as name pattern for the article that has a title? Then you could print

$:item.name

on both classes.

Trond Hjelmaas

Thursday 28 April 2005 12:41:54 am

That sounds like a great idea!, but I don't know how to create a "name pattern". Would you have any more information?

Thanks again :)

Eivind Marienborg

Thursday 28 April 2005 12:47:46 am

Edit your class, you'll probably see it right away, right at the top, along with class name and identifier :)

Trond Hjelmaas

Thursday 28 April 2005 1:55:00 am

Hi, found the name pattern. I also search for help using this attribute, not much luck with examples.

I currently have article class (default) with
Object name pattern: <short_title|title>

Do you have any suggestion how I add "name" in here? My intuition says something like <short_title|title|name=title>...

Would you have a link to documentation regarding "object name pattern" and/or "is_empty/is_valid" attributes?

Thanks

Thanks and thanks

Eivind Marienborg

Thursday 28 April 2005 2:03:53 am

The $:item.name is set by the object name pattern. So if you set your name pattern to <title>, accessing $:item.name will output the same as $:item.object.data_map.title.

Regarding is_valid/is_empty, I'd recommend a search through the docs/forum here on ez.no, and a grep through the standard templates for examples.

Tore Skobba

Thursday 28 April 2005 4:00:14 am

Hi

Try to use the "has_content" instead (http://www.ez.no/ez_publish/download/changelogs/ez_publish_3_4/datatype_changes )

Norman Leutner

Wednesday 08 June 2005 7:14:31 am

That doesn't seem to be the best way..
If you edit the object any remove attribute,
.has_content still keeps true.

--> has_content boolean true

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Marko Žmak

Wednesday 08 June 2005 10:35:01 am

You could also try:

is_set($:item.object.data_map.title)

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu