Cómo usar ContentPlaceHolderid CMS (Umbraco)
-
14-11-2019 - |
Pregunta
Tengo una plantilla maestra simple con etiquetas HTML y quiero poner un pie de página y encabezado en él.Por alguna razón, no muestra tanto el encabezado como el pie de página al mismo tiempo.¿Estoy usando un errorPlacePlaceholderido?¿No deberían ser todas plantillas?
plantilla maestra
<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 (NIÑO NODE: encabezado) Plantilla:
<asp:content ContentPlaceHolderId="header" runat="server">TEST</asp:content>
Master (Nodo NIÑO: Footer) Plantilla:
<asp:content ContentPlaceHolderId="footer" runat="server">TEST</asp:content>
Tengo 3 tipos de documentos (maestro, encabezado, pie de página) con la identificación del encabezado y el pie de página.
Solución
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.
Otros consejos
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