Copied to clipboard

Flag this post as spam?

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


  • Dominic Brown 91 posts 111 karma points
    Jul 01, 2011 @ 16:19
    Dominic Brown
    0

    Editable Header/Footer

    Hi all,

    Back again lol

    I am trying to make the header and footer editable by the end user via the content area.

    I'm working from the business package where they are hardcoded in the master template. I've removed the hardcode and entered:

    <h1><umbraco:Item Field="bodyHeader" runat="server" /></h1>

    then added a tab in the Homepage doc type for the header and gave it a rich text editor property called bodyHeader.

    In the business package there is 2 elements to the header, one being the text and the other is the logo:

      <div id="header">
       
        <a href="/"><img src="/images/logo.gif" width="259" height="65" /></a>
        <div id="sitedescription">
          <h1><umbraco:Item Field="bodyHeader" runat="server" /></h1>
        </div>

    I've tried to make the logo editable aswell by following the same process but giving the property a mediapicker instead of rich text editor and then uploaded my own pic to the media section and pointed it to that.


      <div id="header">
         <a href="/"><umbraco:Item Field="picHeader" runat="server" /></a>
     
        <div id="sitedescription">
          <h1><umbraco:Item Field="bodyHeader" runat="server" /></h1>
        </div>

    i've tried it like this aswell


      <div id="header">
         <umbraco:Item Field="picHeader" runat="server" />
     
        <div id="sitedescription">
          <h1><umbraco:Item Field="bodyHeader" runat="server" /></h1>
        </div>

    This has not worked, where the pic should be in the head i have 1088 instead, and i don't understand why?!

    Can anyone advise how i can get this logo in via the content section? Also, i've added the code to the master template but adjusted the doc type for the homepage, as you will know, this will only display what the end user enters in the homepage and not any of the others. I don't seem to have a doc type for the whole site, how can i make it so what is entered is shown on every page?

    Hope this makes sense, thanks in advance for your help!

    Dom

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 01, 2011 @ 16:29
    Tom Fulton
    0

    Hi Dominic,

    The Media Picker stores the ID of the selected Media Item.  To translate that into an image, you need to use the umbraco library method called GetMedia.  Usually this is done from an XSLT Macro, but you can also do it via inline XSLT on your umbraco:Item tag:

    <img src='<umbraco:Item Field="picHeader" runat="server" Xslt="umbraco.library:GetMedia({0},false())/umbracoFile" />' />

    For info on doing this in XSLT check out Lee's blog post.

    Hope this helps,
    Tom

  • Dominic Brown 91 posts 111 karma points
    Jul 01, 2011 @ 16:47
    Dominic Brown
    0

    Thanks for your reply Tom.

    I've added the extra bit of code but know it displays /media/148/cu.jpg'/> instead of the image :oS

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 01, 2011 @ 16:48
    Tom Fulton
    0

    Hmm..did you wrap the <img src=' tag around it like I have above?

  • Dominic Brown 91 posts 111 karma points
    Jul 01, 2011 @ 16:51
    Dominic Brown
    0

    ops, i did not.

    its working now. thanks ever so much :oD

    Now i just need to know how to apply it to all the pages at once rather then just the home page

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Jul 01, 2011 @ 16:55
    Tom Fulton
    0

    Oh yeah, sorry forgot to mention that.

    If you add recursive="true" to your umbraco:Item tag, it will walk up the content tree until it finds a page with that field and will use the value from there.

  • Dominic Brown 91 posts 111 karma points
    Jul 01, 2011 @ 17:00
    Dominic Brown
    0

    simple as that eh, been trying for hours hehe

    thanks again mate, you've saved my headache lol

Please Sign in or register to post replies

Write your reply to:

Draft