Showing posts with label NVelocity. Show all posts
Showing posts with label NVelocity. Show all posts

Sunday, November 30, 2008

Linking imges in Monorail

A quick one 

Say you have an image or god knows what and  you need to add a link to it, in html you ll do something like



<a href="http://foo.bar/something.html">
<img src="..." /> </a>

in a view you can do this

<a href=$UrlHelper.For("%{ controller='product'}")>  
  <img src="$!Image.Path" alt="$!Name" />
</a>


Wednesday, July 23, 2008

NVelocity Parse

A little thing that drove me completely insane

when using parse (appache ref) the path to the view includes the folder that you are in

say you are in the folder .../views/Blog
editing a view called one.vm
if you want to parse something in the same folder as one.vm you have to use

#parse("Blog/two.vm")
and if you happen to use a / before blog you ll get a nice exception that has a very unclear message

Just to note

NVelocity - creating urls

I always forget these two:

$Url.Link('label', "%{controller='controllerName',action='actionName'}")

and this:

To Create a form


$Form.FormTag("%{id= 'formId', action='save', immediate = 'true'}")
$Form.EndFormTag

I really wished there was a MR RC4 :D