Get skin path in Magento?

The way that Magento themes handle actual url’s is as such (in view partials – phtml files): echo $this->getSkinUrl(‘images/logo.png’); If you need the actual base path on disk to the image directory use: echo Mage::getBaseDir(‘skin’); Some more base directory types are available in this great blog post: http://alanstorm.com/magento_base_directories

Handlebars.js if block helper ==

The easiest thing would be to add a custom if_eq helper: Handlebars.registerHelper(‘if_eq’, function(a, b, opts) { if(a == b) // Or === depending on your needs return opts.fn(this); else return opts.inverse(this); }); and then adjust your template: {{#if_eq this “some message”}} … {{else}} … {{/if_eq}} Demo: http://jsfiddle.net/ambiguous/d4adQ/ If your errors entries weren’t simple strings then … Read more

Recommended scalable AngularJS project structure?

You can take a look at a demo application that Pawel Kozlowski and I are putting together: https://github.com/angular-app/angular-app. It doesn’t provide any support for loading files on demand but you can see we spit modules up into separate files and set up testing as a first class component. We have a build process (using Grunt) … Read more

Calling a template with several pipeline parameters

You could register a “dict” function in your templates that you can use to pass multiple values to a template call. The call itself would then look like that: {{template “userlist” dict “Users” .MostPopular “Current” .CurrentUser}} The code for the little “dict” helper, including registering it as a template func is here: var tmpl = … Read more

underscore.js nested templates

You can pass the nested template as a variable in the template assignments to the main template, e.g.: HTML: <script type=”text/template” id=”sub_template”> <article> <h1>id: <%= id %><h1> </article> </script> <script type=”text/template” id=”main_template”> <% for (var i = 0; i < num; i++) { %> <%= renderSub({id:i}) %> <% } %> </script> JS: var renderSub = … Read more

Razor views as email templates

You can use http://razorengine.codeplex.com/ to achieve this. It allows you to use razor outside of mvc. string Email = “Hello @Model.Name! Welcome to Razor!”; string EmailBody = Razor.Parse(Email, new { Name = “World” }); It’s simple to implement and it’s available on http://nuget.codeplex.com/ for easy integration into your projects.