|
|
 Rank: Enthusiast
Joined: 7/2/2008 Posts: 34 Location: India
|
Hi ,
I just got v4 setup and was thinking to implement masterpage concept as we use to do in ASP.NET. The following are my concerns:
1.)I failed to figure out how to make reference to masterpage if I dont want to use macro for reuse of content 2.)How to pass the value to the <asp:content id="MasterContent" ContentPlaceHolderID="ContentPlaceHolderMaster" runat="server"></asp:content> 3.)Can I have more than one content place holder in a page like in ASP.NET
Please guide me if there is a tutorial regarding this or if someone can guide me please help me with the masterpage usage in v4.
Thanks, Amritanshu
Good judgment comes from experience, and often experience comes from bad judgment. So experience is simply the name we give our mistakes...
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 820 Location: Benfleet, Essex, UK
|
Hi Amritanshu, I dont really understand your first two questions, but with your third question yes it is possible to have multiple placeholders as you do with regular ASP.NET masterpages. This is because umbraco uses the ASP.NET masterpages that most .NET developers are familiar with. In regards to syntax to use for specific umbraco items I recommend you read my blog post http://www.creativewebspecialist.co.uk/2008/06/23/masterpages-in-umbraco-v4.aspxWarren Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
 Rank: Enthusiast
Joined: 7/2/2008 Posts: 34 Location: India
|
Thanks Warren for the reply...  My first 2 questions where in the context of using the multiple place holder , means do we need to make a reference in the different template to the master template. Sorry if i am complex here... Lets say I have created one master doctype with one content tab with richtext editor as its type. I written the template for my header footer and for content placeholder now what my concern was that I will be in need of few more templates for my articles section and news section and product section where I would be in need if more palceholders so so do I have the option to just reference the child articles news and products template to the master template page so that I dont have to write codes for header footer section... like we do in asp.net Code:<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="MasterPage.Master" %> or we need to use the macro for reuse content for this then how will I be using the value to my default master template placeholder...which I intended to ask in my second question. I went through your blog and found the information useful.. Quote:Hello all I am currently looking into making my Creative Website Wizard package ready for V4 of Umbraco and with this I will move away from the OLD templating system to the NEW ASP.NET MasterPages support. With this I thought I would share with you all the new Syntax for the Umbraco functionality. Page Fields
Before <?UMBRACO_GETITEM field="pageName"/>
After <umbraco:Item field="pageName" runat="server"/> Macros
Before <?UMBRACO_MACRO macroAlias="XSLTNavi" ></?UMBRACO_MACRO>
After <umbraco:Macro macroAlias="XSLTNavi" Alias="XSLTNavi" runat="server"/> Child Template
Before <?UMBRACO_TEMPLATE_LOAD_CHILD/>
After <asp:ContentPlaceHolder ID="MasterTemplateContentPlaceHolder" runat="server"></asp:ContentPlaceHolder> ....but if you can guide me through this masterpage usage and multiple placeholder usage it would be a great favour... thanks, Amritanshu Good judgment comes from experience, and often experience comes from bad judgment. So experience is simply the name we give our mistakes...
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 820 Location: Benfleet, Essex, UK
|
OK in your top level master page put your header and footer information into it. Here is an example. Code: <asp:Content id="Mastercontent" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Xeed</title> </head> <body>
<!-- Header --> <umbraco:Item field="HeaderText" runat="server">
<!-- Child template start --> <asp:ContentPlaceHolder runat="server" id="MasterContentPlaceHolder" /> <!-- Child template end -->
<!-- Footer --> <umbraco:Item field="FooterText" runat="server"> </body> </html> </asp:Content>
Next is a child template say a text page Code:
<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %> <asp:Content id="Aboutcontent" ContentPlaceHolderID="MasterContentPlaceHolder" runat="server">
<p>I am in the child template and I will inherit my master's header and footer</p> <umbraco:Item field="BodyText" runat="server"> </asp:Content>
I hope this has helped you. Warren Warren Buckley an Umbraco MVP 08-09 & level 1 certified developer
|
|
 Rank: Enthusiast
Joined: 7/2/2008 Posts: 34 Location: India
|
Thanks a TON Warren Good judgment comes from experience, and often experience comes from bad judgment. So experience is simply the name we give our mistakes...
|
|
Rank: Newbie
Joined: 8/18/2008 Posts: 21 Location: bangalore
|
Hi Warren, Thankyou for your reply to amritanshu.It has helped me a lot.But, I Wrote code as u said but I am getting header and footer except the contentholder thing. we declared a child template as u said,but the content or description watver we declared in the child template is not displaying. As soon as we save the child template by adding "<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>",this code it is disappearing after saving the template successfully. One more thing,If we use contentPlaceHolder directly with in the MasterTemplate,it will work fine.But if we declare the Child Template say as a textpage and then using the declare child template In master Template as: <asp:ContentPlaceHolder ID="MasterContentPlaceHolder1content" runat="server"></asp:ContentPlaceHolder>
then It is not working.Can you suggest,what I am missing here?
Thanks & Regards, Ammu
|
|
 Rank: Enthusiast
Joined: 7/2/2008 Posts: 34 Location: India
|
Hi Ammu, In order to make the child template inherit the master template instead of using the code "<%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>" you can also select the master template dropdown from the template edit section which will allow you to inherit custom master template created by you and letting the child to have its own .... Say this is the mastertemplate.master Code: <asp:Content id="Mastercontent" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Xeed</title> </head> <body>
<!-- Header --> <umbraco:Item field="HeaderText" runat="server">
<!-- Child template start --> <asp:ContentPlaceHolder runat="server" id="MasterContentPlaceHolder" /> <!-- Child template end -->
<!-- Footer --> <umbraco:Item field="FooterText" runat="server"> </body> </html> </asp:Content>
Then the child will have the master template selection from the dropdown been the mastertemplate.master and child template say a text page Code: <!-- You cab put the child in the desired contentplaceholder that you created in the master template you just need to include that contentplaceholder ID here --> <asp:Content id="Aboutcontent" ContentPlaceHolderID="MasterContentPlaceHolder" runat="server">
<p>I am in the child template and I will inherit my master's header and footer</p> <umbraco:Item field="BodyText" runat="server"> </asp:Content>
Hope it works for you.... Cheers, Amritanshu Good judgment comes from experience, and often experience comes from bad judgment. So experience is simply the name we give our mistakes...
|
|
|
Guest |