“Haml is a markup language that‘s used to cleanly and simply describe the XHTML of any web document, without the use of inline code. Haml functions as a replacement for inline page templating systems such as PHP, ERB, and ASP. However, Haml avoids the need for explicitly coding XHTML into the template, because it is actually an abstract description of the XHTML, with some code to generate dynamic content.” Basically Haml is a domain specific language for XHTML. Unlike Velocity, which can be used to output any text data, Haml focuses entirely on xhtml output — and does it well. Instead of:
<h2><%= ViewData.CategoryName %></h2>
<ul>
<% foreach (var product in ViewData.Products) { %>
<li>
<%= product.ProductName %>
<div class="editlink">
(<%= Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID })%>>
</div>
<% } %>
</li></ul>
<%= Html.ActionLink("Add New Product", new { Action="New" }) %>
You can do this:%h2= ViewData.CategoryName
%ul
- foreach (var product in ViewData.Products)
%li
= product.ProductName
.editlink
= Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID })
= Html.ActionLink("Add New Product", new { Action="New" })
(It does look like python, doesn't it?)
Do we need it?
Andrew Peters has created a NHaml, .NET port of Haml made as an alternative view engine for ASP.NET MVC.
I assume it wouldn't be too hard to take it apart and create a Haml rendering type for Sitecore as a downloadable extension. Is this something you find interesting? I love its clarity and wrist-friendliness, and it should be much easier to type online using Developer Center or even Content Editor.
The downside is that you'd lose intellisense in visual studio, but personally I'm much more annoyed by visual studio trying to format my <% %> code the way it thinks i like it. And yes, it's yet another templating engine.
* Haml reference
HTML5 first Working Draft is up, and its incredibly pragmatic, as in taking stuff that everyone does using javascript libraries and browser plugins, and pushing it into the standard. More semantics: nav, header, footer, section, dialog tags and more. Less presentation: getting rid of legacy elements like font, big, center and other tags. Use the CSS! Framesets are gone too. Cool stuff you always wanted to be there: <input type="email" autofocus="true" />, support for audio/video and canvas drawing, drag and drop. For shorter reading, HTML 5 differences from HTML 4. Now all we have to do is wait till IE9* becomes the oldest browser around. That'll be soon, right? Lets stay hopeful. * unless it takes years to get to further working drafts and recommendation. Or Microsoft decides HTML5 is against its interests. Or..
September has been a terrific month. Sitecore Ukraine is proud to have it's first intructor, certified for teaching both SCD1 and SCD2 level courses in English, Russian and Ukrainian - congratulations, Sergey! Peter Johansson has joined Sitecore as a Solution Architect. You know Peter from the SDN forum and all the cool Sitecore things he has made before and after becoming a Sitecore MVP. In a lucky turn of events we've met here in Copenhagen - thanks for the beers, Peter, I owe you some. And for me it's been a developer's dream - spending the month working with amazing people, discussing new ideas and getting the old ones to be heard. I am now allowed into the holy shrine of Sitecore, the source code repository, and that includes write access. Working on the core product is obviously very exciting. This is also a chance to explore my new found passion: designing and building user interfaces that do not suck.
It's time to get a break - I'm leaving to wonder around Crimea for the next couple of weeks. Next we're in Copenhagen for the annual Sitecore get together. We're having so much fun at these, that this time I'm staying for a month - what are the chances that I'll also have to work ? This should be really fun. To add some value to this otherwise boring post, I'm leaving you with the nicest 404 page I've seen in a while (via Smashing Magazine) : 
We have implemented a Single Sign-On system for SDN, SPN, Personal Portal and License System. It means that you only have to log in once on any of the sites to be able to access the rest. The side effect is that all remembered passwords are expired sooner than they usually do, which I hope is a minor inconvenience. The solution behind it is very low-tech: by setting the cookie domain to ".sitecore.net" (note the leading dot) we can share the same cookie accross multiple subdomains.
If you haven't already, check out the new .Mac Web Gallery for some interesting use of javascript. Here is a sample gallery - once it finished loading you can hover over the albums to quickly scan whats inside. Grid, Mosaic, Carousel and Slideshow modes are available for viewing individual albums. Mosaic looks great on wide screen displays, and makes perfect sense since most of the new Macs have one of those. Reducing clutter also helps - no ads, comments, ratings, tags and "related photos" of people you don't care about. It's also about using the effective use of available space. Compare with Flickr album view of same screen size and resolution and see how much space the later wastes by using the fixed width layout optimized to work on most screen sizes. Dot Mac gallery, on the other hand, uses a smart javascript driven fluid layout - when browser window is resized main image is scaled in steps, preserving the aspect ratio. .Mac gallery is not yet bug free, certainly feels heavy while it loads and with all javascript goodness I don't understand why it doesn't preload next image in individual / slideshow modes. However it is definitely more inspiring than yet-another-ajax-grid. I'm sure it gets dissected on patterns and controls soon enough. via Ajaxian.
Just in case anyone else is wondering how to play with first bits of IronRuby and DLR, here's from John Lam himself: Q: I am wondering if at all, i can see few working examples just like IronPython in asp.net futures section. A: We're still quite a ways from ASP.NET. There are a lot of implementation details to sort out, particularly around how we deal with isolating concurrently executing pages from each other.
As Peter was first to notice, we have recently made available a preview edition of the Search Engine Optimization module. It's purpose is to help website maintainers and contributors to get insight into SEO related aspects of the site and avoid common errors. To achieve the goal in a very visual way, the module embeds inself in live pages, similar to Sitecore WebEdit. The only limitation of the preview edition is that it expires on January 1st, 2008. It is of fairly solid beta quality and is avaiable for a download from SDN free of charge, along with documentation. The earlier version is also preinstalled in the latest SC Printers demo site (version 3.0.15) We're especially interested in feedback at this stage - good or bad, drop us a note: mail to ar at sitecore net, leave a comment or discuss at SDN forum. To continue with the visual theme, below is a short tour: Page Information provides a 'big picture' overview. Text Only View shows the page through the eyes of a search engine. Headings are stressed by larger font size, links are underlined and image alt texts are displayed in [square brackets]. Keywords shows statistics on how often 1, 2 and 3 word combinations are used on the page. It also allows quick search for any of the combinations on major search engines. Headings, Images and Links list all respective elements found on the page, along with some quick information. Clicking on any element highlights it's actual position on the page. Errors are easy to spot. They show up on the overview tab and the respective element tab. The coolest part is that the element itself is marked as erroneous on the page itself. Hovering over error marker displays the error information tooltip. The module also checks for broken links and presents them in the same way. Hope you like it. For more information, please refer to SDN documentation.
We've got a several reports about SDN5 being unresponsive, throwing Application Unavailable errors and having poor search quality in the last several days. From what it looks like, it's another windows update that became evil. Symptoms: random "Application Unavailable" screens caused by worker pool restarts. To diagnose the error, open the Event Viewer and look for the error below, following by a notice that asp.net was stopped unexpectedly: EventType clr20r3, P1 aspnet_wp.exe, P2 2.0.50727.832, P3 461ef1db, P4 system.web, P5 2.0.0.0, P6 461ef1d2, P7 297c, P8 8d, P9 system.nullreferenceexception, P10 NIL. The solution for me was to uninstall the Security Update for .NET Framework 2.0 (KB928365) and then repair the .net framework 2.0. Unfortunately the update was pushed to fix a critical remote code execution vulnerability - so I'm not really happy with the solution, hope the new update is out soon. SDN5 runs on older Windows 2000, our newer Windows 2003 box is fine. Found it by googling the error message, which lead me to the asp.net forum post regarding the KB928265 that also mentions that other possible issues. Internet is full of other fun ways this update breaks .net applications and reading through the reports is similar to browsing wikipedia - getting to the wet t-shirt contest page is only matter of time. Technorati tags: KB928365 update: if you continue to see SDN fail with Application Unavailable - please let us know.
|