我有一个简单的主模板,带有html标签,我想在其中放置页脚和标题。出于某种原因,它不会同时显示页眉和页脚。我使用ContentPlaceHolderid错误吗?他们不是不是所有模板吗?

主模板

<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(子节点:标题)模板:

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

master(子节点:页脚)模板:

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

我有3个DOC类型(主,标题,页脚),带有页眉和页脚的ID。

有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top