I'm not seeing an item that I fetch in my master template; I hope you can help.
I've got <umbraco:Item runat="server" field="headerText" /> in my master template. headerText is a field defined in a document type which allows the master template. My instance of the document type Header also is assigned to the master template.
However I don't get any value displayed from the field. Somehow the field isn't getting associated correctly. Do you have any ideas? Sorry this is a bit difficult to describe...
I don't mind doing sanity checks at all, thanks for asking me to :) Yes, the page is published (I also republished the entire site just to be sure); I double-checked the alias name of the field and it is correct (also tried changing the name in both document type and template, but no effect). Also tried inserting the field using the Insert Umbraco Page Field button in the template editor just to make sure I wasn't typing something wrong.
I am viewing the Home page which inherits from the master page template. The master page template is where my <umbraco: item> is being inserted. The home page inherits from the master page, so it should get the field inserted. I don't get it-- must be doing something wrong, but not sure what.
Just a quick check: append ?umbdebugshowtrace=true to the url to ouput some tracing info. Can you see if the headerText is fetched from the document?
Also, it's not clear whether your home page document includes the "headerText" property. Or did you add this property to the master document type from which the home document type inherits?
I tried the debug parameter as you suggest, and I saw that the headerText property is not being loaded. This property is part of a "Header" doc type that does not inherit from a master doc type. I had assumed that I could access the fields from the Header doc type, from within the master document which the home page uses. I assumed this because the Header doc type allows the use of the master page template. Apparently that's not how things work :) So the structure looks like this:
Templates:
--HID Master
----Home (uses HID Master as its master template)
Document Types:
--Header (doesn't inherit any doc types)
--Home (doesn't inherit any doc types)
What I am trying to do is simply include the same header text on every page. Perhaps what I need to do is:
* Create a new document type "Page Master" which has two sub-document types (child node types) of Header and Home. Then assign the Page Master document type to the Home page template via Allowed templates.
-OR-
* Write an XSLT macro that grabs the headerText property from the Header document, and sticks that into the master page template.
You may be on the right track here, creating a master doc type which Header and Home inherit from, and add the property headerText to the master doc type, that way it will be available for all documents of type Header and Home, and then just add the item to the master template.
Well, what I suggested doesn't seem to work either-- every page that inherits from the master doc type, also gets its own headerText property.
What I want is for the headerText property to only show up once within the master doc type. Does anyone have ideas on this, or perhaps there is a better way to share an editable header on every page of the site?
OK, the issue here is that your 'headerText' property is in your "Header" content page/node, so when you try to view the "Home" page that property doesn't exist ... hence it doesn't display.
Alas, there is a solution. With the Item tag there is a little-known property called "NodeId" that lets you specify which content node you want to use. Try this...
... also just remembered Hendy's blog post about using content nodes as re-usable chunks of content (i.e. sidebar widgets). Have a read, it might help your understanding?
I re-installed the Runway template and looked at it a lot closer. I see how to do what I want now-- I needed to have a base Home content document that stores the header and footer once for the site, and then create the other pages as child nodes of the Home content document. I was mistakenly thinking I should inherit document types rather than the content documents themselves as child nodes.
Item missing in master page template
Greetings all,
I'm not seeing an item that I fetch in my master template; I hope you can help.
I've got <umbraco:Item runat="server" field="headerText" /> in my master template. headerText is a field defined in a document type which allows the master template. My instance of the document type Header also is assigned to the master template.
However I don't get any value displayed from the field. Somehow the field isn't getting associated correctly. Do you have any ideas? Sorry this is a bit difficult to describe...
Thanks for your help,
-NorthK
Hi NorthK,
Few of sanity checks, (apologies if you've already done these):
Let us know how it goes. Hopefully it's a straight-forward fix.
Cheers, Lee.
Hi Lee,
I don't mind doing sanity checks at all, thanks for asking me to :) Yes, the page is published (I also republished the entire site just to be sure); I double-checked the alias name of the field and it is correct (also tried changing the name in both document type and template, but no effect). Also tried inserting the field using the Insert Umbraco Page Field button in the template editor just to make sure I wasn't typing something wrong.
I am viewing the Home page which inherits from the master page template. The master page template is where my <umbraco: item> is being inserted. The home page inherits from the master page, so it should get the field inserted. I don't get it-- must be doing something wrong, but not sure what.
My code in the master page looks like:
<h2><umbraco:Item runat="server" field="headerText" /></h2>
But what gets rendered is:
<h2></h2>
Thanks for any other pointers :)
-NorthK
Just a quick check: append ?umbdebugshowtrace=true to the url to ouput some tracing info. Can you see if the headerText is fetched from the document?
Also, it's not clear whether your home page document includes the "headerText" property. Or did you add this property to the master document type from which the home document type inherits?
Cheers,
/Dirk
Hi Dirk and others,
I tried the debug parameter as you suggest, and I saw that the headerText property is not being loaded. This property is part of a "Header" doc type that does not inherit from a master doc type. I had assumed that I could access the fields from the Header doc type, from within the master document which the home page uses. I assumed this because the Header doc type allows the use of the master page template. Apparently that's not how things work :) So the structure looks like this:
Templates:
--HID Master
----Home (uses HID Master as its master template)
Document Types:
--Header (doesn't inherit any doc types)
--Home (doesn't inherit any doc types)
What I am trying to do is simply include the same header text on every page. Perhaps what I need to do is:
* Create a new document type "Page Master" which has two sub-document types (child node types) of Header and Home. Then assign the Page Master document type to the Home page template via Allowed templates.
-OR-
* Write an XSLT macro that grabs the headerText property from the Header document, and sticks that into the master page template.
Does this sound right to you?
Thanks,
-NorthK
Hi NorthK,
You may be on the right track here, creating a master doc type which Header and Home inherit from, and add the property headerText to the master doc type, that way it will be available for all documents of type Header and Home, and then just add the item to the master template.
Hope this helps.
Regards,
/Dirk
Well, what I suggested doesn't seem to work either-- every page that inherits from the master doc type, also gets its own headerText property.
What I want is for the headerText property to only show up once within the master doc type. Does anyone have ideas on this, or perhaps there is a better way to share an editable header on every page of the site?
Thanks,
-NorthK
Hi NorthK,
OK, the issue here is that your 'headerText' property is in your "Header" content page/node, so when you try to view the "Home" page that property doesn't exist ... hence it doesn't display.
Alas, there is a solution. With the Item tag there is a little-known property called "NodeId" that lets you specify which content node you want to use. Try this...
... replace the "NodeId" value (1234) with whatever the correct nodeId is of "Header" content page/node.
Let us know if that works for you.
Good luck, Lee.
... also just remembered Hendy's blog post about using content nodes as re-usable chunks of content (i.e. sidebar widgets). Have a read, it might help your understanding?
http://blog.hendyracher.co.uk/sidebar-widgets-with-umbraco-v4/
Cheers, Lee.
Hi guys,
I re-installed the Runway template and looked at it a lot closer. I see how to do what I want now-- I needed to have a base Home content document that stores the header and footer once for the site, and then create the other pages as child nodes of the Home content document. I was mistakenly thinking I should inherit document types rather than the content documents themselves as child nodes.
Thanks alot for taking the time to help,
-NorthK
is working on a reply...