you can fetch a property recursively, so if you've defined a property on the "homepage" document type, you can always fetch it in your master template as
Model.Content.GetPropertyValue
(2nd param specifies to fetch property recursively until it found one)
in that case, you'd only need to specify it on one document type, but you could keep it as a composition and add it on all document types, and let editors decide whether they want a different header image on a specific page.
Above code will still work in that case.
Only downside to using the composition is that you'd want to specify the property to be mandatory (on top most level document type), while keeping it optional everywhere else.
why the header image is not displayed on the entire web page
Hi I have made a header document type without template that should show 1 header image on the whole website.
The code I put on my master page and it will not show the image.
But if I make the header doctype as a composition for all my pages then it works, but then I have to choose a header image on each page.
It is only on node front page that you set the header image for the whole home page
Here is my code on the master page. What do i do wrong??
You can set your header image to be recursive so it will look up the tree for one, just pass in the "true" parameter like below.
var typedMediaPickerSingle = Model.Content.GetPropertyValue
Hope this helps!
-Amir
hi,
you can fetch a property recursively, so if you've defined a property on the "homepage" document type, you can always fetch it in your master template as
Model.Content.GetPropertyValue
(2nd param specifies to fetch property recursively until it found one)
in that case, you'd only need to specify it on one document type, but you could keep it as a composition and add it on all document types, and let editors decide whether they want a different header image on a specific page. Above code will still work in that case.
Only downside to using the composition is that you'd want to specify the property to be mandatory (on top most level document type), while keeping it optional everywhere else.
--Dirk
Looks like neither Dirk or I's code pasted completely, here it is again incase you need it, we both shared the same thing.
Shuck, forgot to mark as code... glad someone reviewed... thanks for noticing
Thanks for the help Dirk and Amir it work finde with
, true
is working on a reply...