Select the search type
  • Site
  • Web
Search
You are here:  Support/Forums
Support

Bring2mind Forums

Hide missing attribute in templated view
Last Post 03/15/2012 10:32 AM by ABS Jets. 2 Replies.
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
ABS Jets
New Member
New Member
Posts:13


--
02/18/2012 11:52 AM
Is it possible to hide/format a block of code in the templates according to whether the entry has a given attribute set or not?

What I would like to set up:
We use several attributes for most of our documents (such as "Company number" or "Valid from date" etc.) that are mostly strings or dates, not booleans. At the same time, there are some kinds of documents that do not use these attributes. They are even located in a different folder so the mentioned attributes do not apply to these documents.

However, our main DMX page uses a templated view where all those attributes are displayed together with labels or a special formatting (e.g. the Company number attribute is followed by a slash and the entry version number). As this is the main DMX page, links in notification e-mails for all documents point to this page. So when a "nonstandard" document is displayed on this page, it "breaks" the layout of the template as it does not have all the attributes.

I would like to hide the labels for the missing attributes or even load different templates based on the presence of the attribute.
In case of boolean attributes it can be more or less solved by using the conditional formatting of this type of attribute ([entryattribute:Att_Invalid|block; none]) but it is not usable for other types.

Thanks for your advice,
Pavel
Peter Donker
Veteran Member
Veteran Member
Posts:4536


--
02/28/2012 9:44 PM
Hi Pavel,

Try something like this:

[if|Flight.html][flight:flightid][>]4[/if]

Flight.html is the name of the subtemplate to render. The token [flight:flightid] can be any valid token. Then you have the regular comparison operators.

Peter
ABS Jets
New Member
New Member
Posts:13


--
03/15/2012 10:32 AM
Hi Peter,

thank you for you advice, i will try it that way.

Pavel
You are not authorized to post a reply.