Forums / Setup & design / [show() 'error'] Check if $module_result.path[3][node_id] exists

[show() 'error'] Check if $module_result.path[3][node_id] exists

Author Message

Mark Overduin

Friday 22 August 2003 6:22:57 am

I just want to check if $module_result.path[3][node_id] exists. If it does, show stuff1, if it doesn't, show stuff2.

I think I have to use some function 'show=$...|function(...)', but I really don't know what I should use...

- - - code - - -
{section name=NewSection show=$module_result.path[3][node_id]}
bla bla 1
{section-else}
{section name=ElseSection}
bla bla 2
{/section}
{/section}
- - - - - - - - -

Thanx in advance!

Mark Overduin

Monday 25 August 2003 12:31:27 am

Anyone?

Jan Borsodi

Tuesday 26 August 2003 6:50:07 am

Use the is_set operator to check for existance.
{section show=is_set($module_result.path[3][node_id])}
bla bla 1
{section-else]
bla bla 2
{/section}

or if you want to choose among many expression until you find one that exists you can use first_set, it will return the first parameter that exist.
{first_set($module_result.path[3][node_id],false())}
will return false (the second parameter) if no value exists.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq