Friday, October 22, 2010

Multi-line strings in Velocity

Just noticed you can use multi-line strings in Velocity strings to maintain maximum readability. For example:

#getSQLResults("select distinct(t.child) as identifier, c.text1 as title, c.text_area1 as summary
      from tree t, inode i, contentlet c
      where c.live = true
          and t.child = i.identifier
          and i.inode = c.inode
          and (relation_type = 'Gen_Prod_Overview_Tab-Overview_Tab_Articles'
          or t.relation_type = 'Gen_Prod_Specif_Tab-Specif_Tab_Articles'
          or t.relation_type = 'App_Ov_Tab-Ov_Tab_Articles'
          or t.relation_type = 'App_Specif_Tab-Specif_Tab_Articles'
          or t.relation_type = 'App_Key_Cons_Tab-Key_Consideration_Articles'
          or t.relation_type = 'App_Install_Tab-Install_Tab_Articles'
          or t.relation_type = 'App_Finishes_Tab-Finishes_Tab_Articles'
          or t.relation_type = 'App_Supp_Tab-Supp_Tab_Articles')
      order by c.text1
      offset $offset
      limit $resultsPerPage;" )

My dotCMS notes.