I would like a content editor to choose whether some content appears on a page or not. I have used a checkbox but I don't know how to use that to determine whether content is visible not.
Ah, so you want to show pieces of content from only one field like an RTE? That could get tricky, but yes, you could use a macro for that as well. The question is where the user defines the "hidden" content - normally you could use a macro parameter, but RTE isn't a supported parameter type. So you might have to define the hidden content elsewhere and use a Content Picker parameter where you can choose the node. It might be best to use a separate field for the "Hidden content" if possible, then just drop the macro on your template.
Tom, the web page shows the latest 2 tweets and the client wishes to have the option to display the tweets or not. I have created a page that accepts a title (text string) and a URL to the tweet (multi line text) and the checkbox. Is it not possible to check the staus of the check box and display (or not) the contents of the text boxes?
Yep, that should be easy. What version of Umbraco are you using and what type of templates are you using (Masterpages or Views/Mvc)?
Either way you could follow my suggestion in the second post above and use an XSLT macro, then drop that macro in your template in place of where you're rendering out the tweets now.
Hiding content
I would like a content editor to choose whether some content appears on a page or not. I have used a checkbox but I don't know how to use that to determine whether content is visible not.
Bill
Hi Bill,
It depends on what you're using for templates/macros. You could use an XSLT macro for this:
If you're using Mvc Views for templates, you could do this right in the temlplate with something like this:
(note, you need this at the top of your View for GetPropertyValue<bool> to work: @using Umbraco.Web)
Hope this helps,
Tom
Thanks Tom, would I create the XSLT macro and drop it into the content from the content editor?
Ah, so you want to show pieces of content from only one field like an RTE? That could get tricky, but yes, you could use a macro for that as well. The question is where the user defines the "hidden" content - normally you could use a macro parameter, but RTE isn't a supported parameter type. So you might have to define the hidden content elsewhere and use a Content Picker parameter where you can choose the node. It might be best to use a separate field for the "Hidden content" if possible, then just drop the macro on your template.
Tom, the web page shows the latest 2 tweets and the client wishes to have the option to display the tweets or not. I have created a page that accepts a title (text string) and a URL to the tweet (multi line text) and the checkbox. Is it not possible to check the staus of the check box and display (or not) the contents of the text boxes?
Hi Bill,
Yep, that should be easy. What version of Umbraco are you using and what type of templates are you using (Masterpages or Views/Mvc)?
Either way you could follow my suggestion in the second post above and use an XSLT macro, then drop that macro in your template in place of where you're rendering out the tweets now.
Something like...
-Tom
is working on a reply...