开发者

How to use ContentPlaceHolderId CMS (Umbraco)

I have a simple master template with HTML tags and I want to put a footer and header in it. For some reason it doesn't display both the header and footer at the same time. Am I using ContentPlaceHolderId wrong? Should they not be all templates?

MASTER template

<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<head>
</head>
<body>

<asp:ContentPlaceHolder Id="header" runat="server"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder Id="footer" runat="server"></asp:ContentPlaceHolder>
</body></html>
</asp:Content>

Master (child node: header) template:

<asp:con开发者_StackOverflow社区tent ContentPlaceHolderId="header" runat="server">TEST</asp:content>

Master (child node: footer) template:

<asp:content ContentPlaceHolderId="footer" runat="server">TEST</asp:content>

I have 3 doc types (master, header, footer) with the id of header and footer.


Sounds like you've set up your header/footer templates as children of your "site master" template, which means you can only pick either header or footer template. Also sounds like you've set them up as sub-nodes of your homepage... I'm not sure why you'd do this.

You should be putting header and footer content inside your main template. If you want it to be content-editable (which it sounds like you might), set up a document type with the rich text fields "bodyHeader" and "bodyFooter", then use <umbraco:Item Field="bodyHeader" runat="server" /> to insert the content into your template.

HTH,

Benjamin


Do one thing. Create a template and inside

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

< div>header< /div>

< div>body< /div>

< div>footer< /div>

< /asp:Content>

add your html code which will contain the header,body and footer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜