Best way to handle Properties that are needed in multiple document types
I'm fairly new to Umbraco. We have installed Umbraco 7, and I'm trying to get to grips with how best to organise my document types. For example at the moment I have a property field called 'HotelId'.
The value in this property field wil probably be used throughout all views, not just the one we initally created it for.
But if I want to access this from other document types I can use something like this below;
With the @Umbraco.Field("HotelId", recursive: true), it will look for the property on the currentpage, if it not there or has no value, then it will look for the value in the ancestors in the content tree untill it the field has a value.
Best way to handle Properties that are needed in multiple document types
I'm fairly new to Umbraco. We have installed Umbraco 7, and I'm trying to get to grips with how best to organise my document types. For example at the moment I have a property field called 'HotelId'.
The value in this property field wil probably be used throughout all views, not just the one we initally created it for.
But if I want to access this from other document types I can use something like this below;
@Umbraco.Field("HotelId", recursive: true)
Is this the correct way ?
Hi Tommo1977,
With the @Umbraco.Field("HotelId", recursive: true), it will look for the property on the currentpage, if it not there or has no value, then it will look for the value in the ancestors in the content tree untill it the field has a value.
You can see a video here from Umbraco TV that explains the recrusive value http://umbraco.tv/videos/umbraco-v7/implementor/fundamentals/templating/insert-umbraco-page-field-dialog/
Hope this helps, if you have further questions to this don't hesitate ask again. Since you are new to Umbraco I think that you should have a look at Umbraco TV, if you donĀ“t already know this: http://umbraco.tv/videos/umbraco-v7/implementor/ and https://our.umbraco.org/documentation/Using-Umbraco/Creating-Basic-Site/
And Blake Smith writes an article on the last year advent calendar about how to setting up an umbraco website http://24days.in/umbraco/2014/how-to-set-up-an-umbraco-site/
/Dennis
is working on a reply...