Archive for January, 2009

The NHaml way to prevent presentation concerns in controllers Comments Off

Based on Ayende’s post about not putting presentation concerns in the controller, here is the NHaml way of setting the page title in the view.

Views\Share\Application.haml:

^ var title = “Page”;
!!!
%html{xmlns=”http://www.w3.org/1999/xhtml”}
%head
%title = title
%body
_

Views\Home\Index.haml;

- title = “Home Page”;
%content
This is my Home Page

Views\Home\About.haml;

- title = “About Page”;
%content
This is my About Page

Simple isnt it?