Re: Howto check if hdf is empty (in perl)
Brandon Long <[email protected]> Wed, 5 Aug 2009 11:31:09 -0700
| Newsgroups | gmane.text.clearsilver.general |
|---|---|
| Organization | Fiction L Networks |
| Message-ID | <20090805183109.GC10913@bl1> |
In C, you'd call hdf_get_obj, and a NULL return would indicate it didn't
exist. You can then call hdf_obj_value to check the value.
I'm not a perl expert, but the ClearSilver.xs defines a ClearSilver::HDF
getObj call, which also appears to return NULL. I don't know how that
translates to perl, though. There's also a objValue.
In CS templates, the ? operator checks for existence, and == "" would
check empty. Its possible you would have to check both due to coercion
(a non-existent HDF node compared to a string is an empty string), so
you'd need to do <?cs if:?Page.Menu && Page.Menu == "" ?> to say exists
and is empty.
Brandon
On 08/05/09 petr.vorel uttered the following other thing:
> Hello,
>
> can you tell me
> 1) howto check if hdf exists, but it's empty (in perl template)
> 2) howto check if hdf does not exist (in perl template)
>
> <?cs if: ?Page.Menu ?> does not help...
>
> Thanks a lot.
>
> Pev
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
--
"The meek shall inherit the earth; now let's check out who gets heaven."
-- J. Neil Shulman
http://www.fiction.net/blong/