i want to give my users the ability to add in a new link back to the main site in the top navigation. To facilitate this i have added a content picker data type into the landing doc type.
I now want to reference this in the uBlogsyNavigation.cshtml but not sure how i go about it..
can i just create a new variable?
var mainsitelink = @Model.NodeById(Model.uBlogsyMainSiteLink);
// get all pages var nodes = GetPageNodes(landing, Model.Id); // Get my return link var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding(Model.Id).GetPropertyValue("uBlogsyMainSiteLink"));
Link back to main site data type
i want to give my users the ability to add in a new link back to the main site in the top navigation. To facilitate this i have added a content picker data type into the landing doc type.
I now want to reference this in the uBlogsyNavigation.cshtml but not sure how i go about it..
can i just create a new variable?
var mainsitelink = @Model.NodeById(Model.uBlogsyMainSiteLink);
and then reference it?
Any advice welcome.
S
There's a method called GetLanding()
var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding().GetPropertyValue("uBlogsyMainSiteLink"));
Thanks Anthony,
I've added this into the uBlogsyNavigation.cshtml
// get all pages
var nodes = GetPageNodes(landing, Model.Id);
// Get my return link
var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding().GetPropertyValue("uBlogsyMainSiteLink"));
but i'm getting a razor error and in VS2010 i can see that "No overload method for GetLanding takes 0 Arguments".
TIA
Stephen
Sorry....
.GetLanding(Model.Id)
thanks Antony...worked that but out so i now have
// get all pages
var nodes = GetPageNodes(landing, Model.Id);
// Get my return link
var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding(Model.Id).GetPropertyValue("uBlogsyMainSiteLink"));
@if (Request.Url.AbsolutePath == landing.Url)
{
<li><a href="@landing.Url" class="uBlogsy_current">Blog Home</a></li>
<li><a href="@mainsitelink.Urls" class="uBlogsy_current">Main site</a></li>
}
else
{
<li><a href="@landing.Url">Home</a></li>
<li><a href="@mainsitelink.Url" >Main site</a></li>
}
But I still get a razor error on the browser...
Stumped.
S
var mainsitelink = @Model.NodeById(DataService.Instance.GetLanding(Model.Id).GetPropertyValue("uBlogsyMainSiteLink"));
@if (Request.Url.AbsolutePath == landing.Url)
{
you don't need the 2 @'s
is working on a reply...