I want to put some conditional code (in this case h1 styling) based on if the page is the home page or not of the site. My ID of the home page is 1163, so I would like the h1 to show up in one place, if it isn't the home page, for it to show up in a different place. You would think this would be really easy to accomplish, but being the nOOb that I am, I cannot for the life of me figure out how to do it on my page template. Here is the code I am using, it throws no error, just doesn't do anything.
Conditional field based on the nodeID of a page
I want to put some conditional code (in this case h1 styling) based on if the page is the home page or not of the site. My ID of the home page is 1163, so I would like the h1 to show up in one place, if it isn't the home page, for it to show up in a different place. You would think this would be really easy to accomplish, but being the nOOb that I am, I cannot for the life of me figure out how to do it on my page template. Here is the code I am using, it throws no error, just doesn't do anything.
<umbraco:Macro Alias="YourMacroAlias" runat="server" YourPropertyName="[#pageID]">
if(YourPropertyName == "1163")
{
<h1 style="float:right; width:570px;">
}
else
{
<h1 style="padding-left:32px;">
}
</umbraco:Macro>
I guess, I sort of figured it out.
<% if (umbraco.presentation.nodeFactory.Node.GetCurrent().Id == 1163) { %>
<h1 style="padding-left:32px;"><font color="004a8c"><umbraco:Item field="pageTitle" runat="server" /></font></h1>
<% } %>
<% if (umbraco.presentation.nodeFactory.Node.GetCurrent().Id != 1163) { %>
<h1 style="float:right; width:570px;"><font color="004a8c"><umbraco:Item field="pageTitle" runat="server" /></font></h1>
<% } %>
is working on a reply...