Copied to clipboard

Flag this post as spam?

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


  • Ravi 11 posts 31 karma points
    Nov 16, 2009 @ 03:42
    Ravi
    0

    Common header/footer for website

    I am building a website which would have a common header, footer and side bar for the entire site. I wanna make these 3 components editable by the end user but I am not sure how to go about. I made a User Control for the side bar, but it looks like I gotta add it to each of my templates, and the end user cannot edit it.  I need to know any/all of the following:

    • Is it possible to make a User control editable? Can I make it a document type and make it appear in my site structure?

    • How about "Repeatable Custom Content" (http://our.umbraco.org/projects/repeatable-custom-content) in order to repeat the content across all pages, but make it editable too? if so, how do I go about doing that?

     

    Please help soon!

  • Richard 146 posts 168 karma points
    Nov 16, 2009 @ 13:52
    Richard
    0

    I would create a new top level folder, say called site-control, and make this folder hidden so that it does not appear in the navigation (create a property with the alias umbgracoNaviHide). Then create a document type to hold the text for your header and a page that uses this document type in the site-control folder. Create a macro and XSLT to display the content of this page.

    Then include this macro in the master page. You could either create a new document type for the footer, or have a single document type that has a field for the header and another one for the footer, just decide which will be most logical for the site administrators.

  • Rich Green 2246 posts 4008 karma points
    Nov 16, 2009 @ 14:00
    Rich Green
    2

    Ravi,

    I'm not sure why you are using a usercontrol? Unless i'm mistaken what you're doing is very common.

    The use of a 'Master Page' means that the header, nav bar and footer are 're-used'.

    I usually put these any editable elements of these in a tab on the 'Home' page in the UI under 'Site Settings'.

    Rich

  • Ricky Beard 61 posts 116 karma points
    Nov 16, 2009 @ 15:47
    Ricky Beard
    0

    Rich has the right idea.

  • Ravi 11 posts 31 karma points
    Nov 17, 2009 @ 04:09
    Ravi
    0

    Rich, I don't get it.

    I want to have a common master template for the entire site, which would have the header,footer and side bar. So I made that and created another template for my index page which inherited from the master. Now if I create a document of type 'index', the header does not appear. It appears only in documents of type 'master' :(

    What do I do?

    I am using the User Control to include code which fetches links from a RSS feed. Its part of the side bar.

     

  • Ravi 11 posts 31 karma points
    Nov 17, 2009 @ 04:18
    Ravi
    0

    To be precise:

    if i put this in my master template:

    <asp:ContentPlaceHolder ID="Header" runat="server" >
    <umbraco:Item field="header" runat="server" recursive="true"></umbraco:Item>
    </asp:ContentPlaceHolder>

    and this is my inherited template(index):


    <asp:Content ContentPlaceHolderID="Header" runat="server">

    </asp:Content>

     

    then-

    when I preview documents of type 'index', it does not contain the header....

  • Rich Green 2246 posts 4008 karma points
    Nov 17, 2009 @ 08:39
    Rich Green
    0

    Hi Ravi,

    The following empty code 'overwrites' your master page templates header.

    <asp:Content ContentPlaceHolderID="Header" runat="server">

    </asp:Content>

    If you remove this code your inherited template will display the header.

    Rich

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 17, 2009 @ 10:37
    Chris Houston
    0

    Hi Ravi,

    As Rich has pointed out you have a problem with your templates. Here are examples of a Master template and a child template that will work together:

    Master  ( Template is called !Master )

    <%@ Master Language="C#" MasterPageFile="/umbraco/masterpages/default.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Your Title</title>
    </head>
    <body>
    <div id="ContentContainer">
    <asp:ContentPlaceHolder ID="MasterPlaceHolder" runat="server"></asp:ContentPlaceHolder>
    </div>
    </body>
    </html>
    </asp:Content>

    Child

    <%@ Master Language="C#" MasterPageFile="/masterpages/!Master.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="MasterPlaceHolder" runat="server">
    <div id="Content">
    Hello World
    </div>
    </asp:Content>

    What you should be able to see in the child template the name of the Master template needs to be in the Master definition line:

    <%@ Master Language="C#" MasterPageFile="/masterpages/!Master.master" AutoEventWireup="true" %>

    Some times this is broken if you move templates about so it's always worth checking.

    Also in the Master file you have the following line:

    <asp:ContentPlaceHolder ID="MasterPlaceHolder" runat="server"></asp:ContentPlaceHolder>

    Which relates to the following lines in the child template:

    <asp:Content ContentPlaceHolderID="MasterPlaceHolder" runat="server">
    <!-- Your child content here -->
    </asp:Content>

    You should see that the ID is the same "MasterPlaceHolder"

    I hope this helps!

    Cheers,

    Chris

  • Ravi 11 posts 31 karma points
    Nov 17, 2009 @ 20:27
    Ravi
    0

    Rich and Chris, I am afraid I am still confused.

    There is an editable tab field in my master template:

    <asp:ContentPlaceHolder ID="Header" runat="server" >
    <umbraco:Item field="header" runat="server" recursive="true"></umbraco:Item>
    </asp:ContentPlaceHolder>

    The field is called "header", as you can see it. I make another template, say index, that inherits from this master. I am not sure where the tab field should be- in which document type? I have two document types, one corresponding to the master, the other corresponding to the child. So I put the editable field in the master doc type, create content pages of both the types- but I can see the header only in the content page of type 'master', and not 'child'.

    My understanding of templates and document types is totally skewed!

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 17, 2009 @ 21:54
    Dirk De Grave
    0

    Hi Ravi,

    From what I read in your post, I'm thinking you might be confused by the recursive attribute set to "true". It does mean that if the property is not found on the document currently being viewed, umbraco will look up this property on parent documents up in your content structure hierarchy. It should not read 

    "templates (master/child) define the structure of the site, whereas the master/child document type relation defines the data!"

     

    Hope this helps.

    Regards,

    /Dirk

     

  • Ravi 11 posts 31 karma points
    Nov 18, 2009 @ 07:57
    Ravi
    0

    I understand what you are saying Dirk, but I still don't understand how to have common headers in my website which I need to edit only in one place!

  • wolulcmit 357 posts 693 karma points
    Nov 18, 2009 @ 08:46
    wolulcmit
    0

    Maybe you could look at a fresh install with Runway on it, and see how the TextPage template and Hompage template are set up and how they inherit from each other and just learn or copy from that? it's probably the most basic example that I can think of. Which is what I learnt from.

    - Tim

  • jaygreasley 416 posts 403 karma points
    Nov 18, 2009 @ 09:59
    jaygreasley
    0

    sage advice young Tim

  • Ravi 11 posts 31 karma points
    Nov 18, 2009 @ 18:29
    Ravi
    0

    Yeah, I guess I'll do that. Is there any way to backup whatever I have built now so that I don't lose it when I install the runaway module?

  • Rich Green 2246 posts 4008 karma points
    Nov 18, 2009 @ 18:53
    Rich Green
    1

    Hi Ravi,

    You can back up the database and also all the web files.

    You shouldn't lose what you've done but best to be sure.

    Best thing however would be to set up a brand new Umbraco install and then install Runway as part of this (it's an option of the install).

    Best of luck

    Rich 

  • Ravi 11 posts 31 karma points
    Nov 19, 2009 @ 08:25
    Ravi
    0

    Phew....I finally understood how it works after having a look at the Runaway module! Thanks a million you guys, especially Rich, for being so patient.

  • wolulcmit 357 posts 693 karma points
    Nov 19, 2009 @ 10:20
    wolulcmit
    0

    Good to know you sorted it!

  • Ravi 11 posts 31 karma points
    Nov 20, 2009 @ 02:18
    Ravi
    0

    yeah. But I think Umbraco's documentation needs a lot of revving up - its pretty hazy with many articles overlapping each other, incomplete articles, etc.

Please Sign in or register to post replies

Write your reply to:

Draft