The dynamic field "slidernivo" can be changed by the backend on an specific documenttype. The administrator can publish html images on it and a js component take them to create an slider. But sometimes some this space is nof filled for the admin, and the slider stays blank. So I would like to have a logic to show a default image.
in the insert umbraco item dialog, you can have fallbacks if the content is empty...
<umbraco:Item field="pageHeading"
useIfEmpty="umbracoFile"
textIfEmpty="You need to fill in one of the properties above"
runat="server"></umbraco:Item>
so in the example above, it the item is empty, we are displaying a diffrent item and if the second item is ALSO empty, we are displaying some text. You could make that a default image, etc.
But I still have problems. The useIfempty I can not use it, because I need a default value that can not be changed by the cms admin. The textIfempty looked promising
but it did not like html tags, it just support text. Any other idea?
check if umbraco:Item is empty
Is there a way in the master template to verify if a umbraco:Item is empty and show an alternative content?
I have this code in my master page:
<div id="contenedor_slider">
<asp:placeholder runat="server">
<umbraco:Item runat="server" field="slidernivo" />
</asp:placeholder>
</div>
The dynamic field "slidernivo" can be changed by the backend on an specific documenttype. The administrator can publish html images on it and a js component take them to create an slider. But sometimes some this space is nof filled for the admin, and the slider stays blank. So I would like to have a logic to show a default image.
Please someone tell me what is the best approach.
in the insert umbraco item dialog, you can have fallbacks if the content is empty...
so in the example above, it the item is empty, we are displaying a diffrent item and if the second item is ALSO empty, we are displaying some text. You could make that a default image, etc.
hope that helps
hey thanks a lot for the answer.
But I still have problems. The useIfempty I can not use it, because I need a default value that can not be changed by the cms admin. The textIfempty looked promising
but it did not like html tags, it just support text. Any other idea?
you can use html by escaping the characters ie...
you also might want to look into a couple of default value projects in the project section.
http://our.umbraco.org/projects/developer-tools/standard-values-in-umbraco
for example??? let me know if that helps.
Awesome, that made the trick.
Thanks so much for sharing your knowledge
This is really nice:
Standard Values in Umbraco
But I am using umbraco 4.5 so I have to be picky about projects until they are fully compatible.
regards
is working on a reply...