2
Answers

HTML Helpers return multiple menu and footers

Joshua Wakhata

Joshua Wakhata

7y
213
1
I have this htmlhelper that has returned the menu and footer yet my interest was to have the menu and footer static. Below is the piece of code
 
@using Blog.Models;
@helper Render(Post post, System.Web.Mvc.HtmlHelper html, bool isAdmin, bool ShowComments)
{
<div class="main">
<div class="header_block">
<div class="header_resize">
<div class="search">
<form method="get" id="search" action="#">
<span>
<input type="text" value="Search..." name="s" id="s" />
<input name="searchsubmit" type="image" src="images/search.gif" value="Go" id="searchsubmit" class="btn" />
</span>
</form>
<div class="clr"></div>
</div>
<div class="menu_nav">
<ul>
<li class="active"><a href="index.html">Home</a></li>
<li><a href="support.html">Monitoring</a></li>
<li><a href="about.html">Early Alert</a></li>
<li><a href="blog.html">Recoveries</a></li>
<li><a href="contact.html">Contact Us</a></li>
</ul>
</div>
<div class="clr"></div>
</div>
</div>
<div class="clr"></div>
<div class="header">
<div class="logo">
<h1><a href="#">Blog <span>Joshua</span><small>Testing</small></a></h1>
</div>
<div class="clr"></div>
</div>
<div class="content">
<div class="mainbar">
<div class="article">
<h2><span><a href="@Href("~/Posts/Details/" + post.ID)">@post.Title</a></span></h2>
<div class="clr"></div>
<p class="post-data"><span class="date">@post.DateTime.ToString("MMM").ToUpper()</span> &nbsp;|&nbsp; Posted by <a href="#">Owner</a> &nbsp;|&nbsp;<a href="#">templates</a>, <a href="#">internet</a></p>
<img src="images/images_1.jpg" width="209" height="238" alt="" class="fl" />
@html.Raw(post.Body)
<p class="spec"><a href="#" class="com">Comments (3)</a> <a href="#" class="rm">Read more</a></p>
</div>
<div class="pagenavi"><span class="pages">Page 1 of 2</span><span class="current">1</span><a href="#">2</a><a href="#" >&raquo;</a></div>
</div>
<div class="sidebar">
<div class="gadget">
<h2 class="star"><span>Sidebar</span> Menu</h2>
<div class="clr"></div>
<ul class="sb_menu">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">TemplateInfo</a></li>
<li><a href="#">Style Demo</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Archives</a></li>
<li><a href="#">Web Templates</a></li>
</ul>
</div>
<div class="gadget">
<h2 class="star"><span>Sponsors</span></h2>
<div class="clr"></div>
<ul class="ex_menu">
<li><a href="#">Lorem ipsum dolor</a><br />
Donec libero. Suspendisse bibendum</li>
<li><a href="#">Dui pede condimentum</a><br />
Phasellus suscipit, leo a pharetra</li>
<li><a href="#">Condimentum lorem</a><br />
Tellus eleifend magna eget</li>
<li><a href="#">Fringilla velit magna</a><br />
Curabitur vel urna in tristique</li>
<li><a href="#">Suspendisse bibendum</a><br />
Cras id urna orbi tincidunt orci ac</li>
<li><a href="#">Donec mattis</a><br />
purus nec placerat bibendum</li>
</ul>
</div>
</div>
<div class="clr"></div>
</div>
<div class="fbg">
<div class="col c1">
<h2><span>Image Gallery</span></h2>
<a href="#"><img src="images/pic_1.jpg" width="58" height="58" alt="" /></a> <a href="#"><img src="images/pic_2.jpg" width="58" height="58" alt="" /></a> <a href="#"><img src="images/pic_3.jpg" width="58" height="58" alt="" /></a> <a href="#"><img src="images/pic_4.jpg" width="58" height="58" alt="" /></a> <a href="#"><img src="images/pic_5.jpg" width="58" height="58" alt="" /></a> <a href="#"><img src="images/pic_6.jpg" width="58" height="58" alt="" /></a> </div>
<div class="col c2">
<h2><span>Lorem Ipsum</span></h2>
<p>Lorem ipsum dolor<br />
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. <a href="#">Morbi tincidunt, orci ac convallis aliquam</a>, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam.</p>
</div>
<div class="col c3">
<h2><span>About</span></h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. llorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum. <a href="#">Learn more...</a></p>
</div>
<div class="clr"></div>
</div>
</div>
<div class="postTitle"><a href="@Href("~/Posts/Details/" + post.ID)">@post.Title</a></div>
<div class="postContainer">
<div class="postTabs">
<div class="dateTab">
<div class="month">@post.DateTime.ToString("MMM").ToUpper()</div>
<div class="day">@post.DateTime.ToString("dd")</div>
</div>
<div class="commentsTab">
<a href="@Href("~/Posts/Details/" + post.ID + "#comments")">@post.Comments.Count</a>
</div>
</div>
<div class="postContent">
<div class="postBody">@html.Raw(post.Body)</div>
<div class="tagList">
@foreach (Tag tag in post.Tags)
{
<span class="tag"><a href="@Href("~/Posts/Tags/" + tag.Name)">@tag.Name</a></span>
}
</div>
<div class="linkList">
@{ string url = "http://www.google.com/posts/details" + post.ID; }
<a href="http://reddit.com/submit?url=<URL>&title=<TITLE>"><IMAGE OR LINK GOES HERE></a>
</div>
</div>
@if (isAdmin)
{
<div class="postControlPanel">
<a href="@Href("~/Posts/Delete/" + post.ID)">Delete</a>
<a href="@Href("~/Posts/Edit/" + post.ID)">Edit</a>
</div>
}
</div>
if (ShowComments)
{
<div id="commentContainer">
<a id="comments"></a>
@foreach (Comment comment in post.Comments.OrderBy(x => x.DateTime))
{
<div class="comment">
<div class="commentName">
@if (!string.IsNullOrWhiteSpace(comment.Email))
{
<a href="mailto:@comment.Email">@comment.Name</a>
}
else
{
@comment.Name;
}
</div>
<div class="commentBody">@html.Raw(html.Encode(comment.Body).Replace("\n", "<br/>"))</div>
<div class="commentTime">at @comment.DateTime.ToString("HH:mm") on @comment.DateTime.ToString("yyyy/MM/dd")</div>
@if (isAdmin)
{
<div class="commentControlPanel">
<a href="@Href("~/Posts/DeleteComment/" + comment.ID)">Delete</a>
</div>
}
</div>
}
<div id="commentEditor">
<div id="commentPrompt">Leave a comment!</div>
<form action="@Href("~/Posts/Comment/" + post.ID)" method="post">
<input type="text" id="commentNamePrompt" name="name"/> Name (Required) <br />
<input type="text" id="commentEmailPrompt" name="email"/> Email (Optional) <br />
<textarea id="commentBodyInput" name="body" rows="10" cols="60"></textarea> <br />
<input type="submit" id="commentSubmitInput" name="submit" value="Submit!"/>
</form>
</div>
</div>
}
} 

Answers (2)