Posts

Showing posts from September, 2013

Umbraco Razor test to see if on current page

if(@node.Url == @Model.Url)
{
<li>
<a href="@node.Url"><span style="text-decoration:underline">@node.Name</span></a>                                      
</li>
}
else
{
<li>
<a href="@node.Url">@node.Name</a>                                      
</li>
}

Umbraco Razor Add Line Breaks to Textbox multiple

@if (@Model.address != "")
{

var output = (umbraco.library.ReplaceLineBreaks(@Model.address));
<p>@Html.Raw(@output)</p>
}

Umbraco 4 Backend not showing CSS, Javascript or Sections after moving to Local Host

Image
The issue below can be resolved by:


1) Rename the Folders: App_Browser and App_Data to something like, App_Browser_old and App_Data_old
2) Log in to your Umbraco Backend

If you receive errors like:
 "Values cannot be returned until Resolution is frozen" , Press the refresh button.

If you then get the message:

The website is restarting Please wait for 10s while we prepare to serve the page you have requested...

Go for a cup of tea and come back.





















Umbraco 4 Backend Still not working?  In IIS --> Application Pools --> Change the Managed Pipeline to Classic instead of Integrated for the site




Umbraco Razor - List Subpages from Specific Node - byNodeId - Liist Lates News - Get Node By Id

@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.NodeFactory

@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (Model.NodeById(1850).Children.Any())
{
<div class="sideBarWidget">
<h2><a style="color:#ffffff" href="@Model.NodeById(1850).Url" title="News">Scottish Medical Training<br />Latest News</a></h2>


    <ul>          
        @* For each child page under the root node, where the property umbracoNaviHide is not True *@


         @foreach (var childPage in Model.NodeById(1850).Children.OrderBy("newsArticleDate descending").Take(4))
       {
            <li>
   <a href="@childPage.Url">@childPage.newsArticleTitle</a>  -  @childPage.newsArticleDate.ToString("dd MMM yyyy")
            </li>
        }
    </ul>
</div>
}