This project is read-only.

Conditional statement from sitemaster

Topics: Themes
Jan 26, 2015 at 3:57 AM
Is it possible to write a conditional statement in the site-master file that would distinguish between the postlist view and the postview?

Basically I want the postlist view to be a 4 column and the single post view to be a full width 12 column.

Jan 26, 2015 at 11:24 AM
Edited Jan 26, 2015 at 11:25 AM
If it's just for the display of posts, you should be able to do that from within PostView.ascx
<% if (Location == ServingLocation.SinglePost) { %> 
        <div>layout 1</div>
    <% } else { %>  
        <div>layout 2</div>
    <%} %>          
If you want to change overall layout based on certain conditions i.e is it a BE page(or some other page) I'm on as opposed to a post, etc then you might want some kind of page type detection. You can see an example of that in the root file default.aspx.cs.

Newer versions of BE also allow you to use a different front page.