Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • North Krimsly 59 posts 80 karma points
    Jun 07, 2010 @ 01:30
    North Krimsly
    0

    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

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 07, 2010 @ 01:53
    Lee Kelleher
    0

    Hi NorthK,

    Few of sanity checks, (apologies if you've already done these):

    • Check that the content page is published.
    • In the document-type, check that the "alias" name is correct. It is also case-sensitive; (and remove any extra spaces).
    • Are you viewing the correct content page? and not a sub-page? (sorry, had to ask).

    Let us know how it goes. Hopefully it's a straight-forward fix.

    Cheers, Lee.

     

  • North Krimsly 59 posts 80 karma points
    Jun 07, 2010 @ 04:19
    North Krimsly
    0

    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

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 07, 2010 @ 10:39
    Dirk De Grave
    0

    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

  • North Krimsly 59 posts 80 karma points
    Jun 08, 2010 @ 03:09
    North Krimsly
    0

    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

     

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jun 08, 2010 @ 09:34
    Dirk De Grave
    0

    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

  • North Krimsly 59 posts 80 karma points
    Jun 09, 2010 @ 03:51
    North Krimsly
    0

    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

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 09, 2010 @ 09:22
    Lee Kelleher
    1

    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...

    <umbraco:Item runat="server" field="headerText" NodeId="1234" />

    ... 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.

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 09, 2010 @ 09:24
    Lee Kelleher
    0

    ... 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.

  • North Krimsly 59 posts 80 karma points
    Jun 09, 2010 @ 23:54
    North Krimsly
    0

    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

Please Sign in or register to post replies

Write your reply to:

Draft