Come utilizzare ContentPlaceholderID CMS (Umbraco)
-
14-11-2019 - |
Domanda
Ho un semplice modello principale con tag HTML e voglio mettere un piè di pagina e un intestazione.Per qualche motivo non mostra sia l'intestazione che il piè di pagina allo stesso tempo.Sto usando ContentPlaceholderID sbagliato?Non dovrebbero essere tutti i modelli?
Modello principale
<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 (nodo infantile: intestazione) Modello:
<asp:content ContentPlaceHolderId="header" runat="server">TEST</asp:content>
.
Master (nodo infantile: piè di pagina) Modello:
<asp:content ContentPlaceHolderId="footer" runat="server">TEST</asp:content>
.
Ho 3 tipi di DOC (master, intestazione, piè di pagina) con l'ID di intestazione e piè di pagina.
Soluzione
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.
Altri suggerimenti
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