ContentPlaceHolderID CMS (Umbraco)를 사용하는 방법
-
14-11-2019 - |
문제
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>
.
마스터 (하위 노드 : 헤더) 템플릿 :
<asp:content ContentPlaceHolderId="header" runat="server">TEST</asp:content>
.
마스터 (자식 노드 : 바닥 글) 템플릿 :
<asp:content ContentPlaceHolderId="footer" runat="server">TEST</asp:content>
.
헤더와 바닥 글 ID가있는 3 개의 DOC 유형 (마스터, 헤더, 바닥 글)이 있습니다.
해결책
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