开发者

How to use ContentPlaceHolderId CMS (Umbraco)

开发者 https://www.devze.com 2023-03-06 18:58 出处:网络
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 ContentPlaceHold

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

精彩评论

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