Forums / Developer / is_set Function

is_set Function

Author Message

Mahesh Arvind

Thursday 22 January 2004 4:29:22 am

Hi,

I have a problem with is_set function.

{section show = is_set($dispname.data_map.language_name.data_text)}
{$dispname.data_map.language_name.data_text}
{section-else}
{$dispname.data_map.default_name.data_text}
{/section}

Language_name and default_name are attributes of folder class. I want to display the default name if the language name is not present. The problem with this code is that it displays nothing if the language_name is not present. It is'nt going to {section-else}. Is there any problem with is_set syntax? Can anyone give any suggestions.

Thanks & Regards
Mahesh

Eirik Alfstad Johansen

Monday 02 February 2004 7:32:58 am

Hi,

The code is probably never going to the section-else block because the is_set function always return true. Is language_name an XML field?

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Mahesh Arvind

Saturday 07 February 2004 3:30:17 am

Hi Eirik,

Thank you for the reply. I am using a text line here. Any idea what could be the problem

Thanks & Regards
Mahesh

Eirik Alfstad Johansen

Monday 09 February 2004 12:43:03 am

Hmmm.

You might want to try the following instead:

{switch match = $dispname.data_map.language_name.data_text}
{case match=''}
{$dispname.data_map.default_name.data_text}
{/case}
{case}
{$dispname.data_map.language_name.data_text}
{/case}
{/switch}

Sincerely,

Eirik Johansen

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Mahesh Arvind

Monday 09 February 2004 3:24:42 am

Eirik,

Thanks for your reply :) I had it working by finding the length of language_name. If it' zero then I displayed default_name.

Thanks & Regards

Mahesh

Thanks & Regards
Mahesh