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