| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Alternative View Engines for MVC

Page history last edited by Kurt Johnson 13 years, 11 months ago

Alternative View Engines for ASP.NET

 

NHaml is another project that no one seems to no about. Rob Conery seems to like it. Haml is a view engine in Rails. Haml-lang bad for content because of the tags. Structure of Haml is nice. White space sensitive

 

#profile

    .left.column

        #date= print_date

        #address=current_user.address

        

This produces a div of id profile with date and address. On Herding Code, Rob said it forces you to simplify your code to eliminate if statements. You write a lot of extensions methods to

 

Spark has the best community support. Louis Dejardins is lately at Microsoft and has the community doing a good job of stepping in to keep the project going. MVC2 support is up to RC2 as of today.

 

NVelocity is waning in terms of use. Has great support for Castle. Accessing extension methods required a hack to tell the parser all of the extensions you intended to run. In MVCContrib, they had done that, but custom extensions had to be bootstrapped.

 

 

Spark uses ${something}. You get Intellisense form the project's VS Plug-in.

 

<var names="new[] {'','',''}" />

 

<ul>

    <li each="var name in names">${name}{/li>

</ul>

 

or.....

 

<Viewdata myOrder="Order" />

 

<render partial="orderline" order="myOrder" rowIndex="5" />  // renders a partial looking for _ordeline.spark

<orderline order="myorder" rowIndex="5" />// also renders a partial

 

if is a tag, also an attribute of any tag

 

<ul>

    <li each="var name in names" if="name == 'a'">${name}{/li> // check quotes! didn't see

</ul>

 

 

Partials can register their own scripts. You can tell a partial to register it's own script, and it will only if it hasn't been registered before.

So you can add items from a partial to the <head> by (because Sharp buffers the content it will put stuff in other pages):

 

<use content="head" />

 

<content for="head">

    <script type="javascript" src="...jquery.js" unless="jquery" /> //loads this ONCE because of jquery.

</content>

 

Aaron Jensen had a project who controllers returned only Json so that all methods were all AJAX ready. Testers could tinker with the data ... just for development.

 

django

djangoproject.com

 

Markup uses angle brackets. A little too familiar.

 

Spark is the works well with designers. They would simply have to not mess with any tags that are unfamiliar.

 

Line items are great partial candidates. You can pass an object to a line item. Then for inline editing, you would add a partial after the partial for your line items.

 

And then we got distracted and off-topic, but the session became more fun.

Comments (0)

You don't have permission to comment on this page.