Как использовать ContentPaceLeeryID CMS (Umbraco)
-
14-11-2019 - |
Вопрос
У меня есть простой основной шаблон с тегами HTML, и я хочу положить в него нижний колонтитул и заголовок.По какой-то причине он не отображает как заголовок, так и нижний колонтитул одновременно.Я использую ContentPareDheerid не так?Должны ли они не все шаблоны?
Мастер шаблон
<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 типа дока (мастер, заголовок, нижний колонтитул) с идентификатором заголовка и нижнего колонтитула.
Решение
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