SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
Velocity	
  Tips	
  and	
  Tricks	
  	
  

      Simple	
  Solu5ons	
  to	
  
      Common	
  Problems	
  
      Wed.,	
  April	
  14,	
  2010	
  
Velocity	
  ABC	
  
•  Variables:	
  
   –  #set($thumbWidth	
  =	
  55)	
  
   –  #set($varString	
  =	
  ‘ The	
  width	
  is‘)	
  
   –  #set($varString	
  =	
  “${varString}	
  ${thumbWidth}	
  px“)	
  
•  Proper5es:	
  
   –  $news.shortSummary	
  
   –  $news.expireDate	
  
•  Methods:	
  
   –  #set($_today	
  =	
  $date.getDate())	
  
   –  #set($_todayFormated	
  =	
  $date.format('yyyyMMddHHmmss',
      $_today))	
  
Velocity	
  ABC	
  
•  If	
  /	
  ElseIf	
  /	
  Else	
  statements	
  
#if($condi5on_1)	
  
	
  	
  	
  	
  Condi5on	
  1	
  was	
  met	
  
#elseif($condi5on_2)	
  
	
  	
  	
  	
  Condi5on	
  2	
  was	
  met	
  
#else	
  
	
  	
  	
  	
  	
  Another	
  condi5on	
  was	
  met	
  
#end	
  


•  AND	
  /	
  OR	
  	
  
#if($condi5on_1	
  &&	
  $condi5on_2)	
  	
  …	
  	
  #end	
  
#if($condi5on_1	
  ||	
  $condi5on_2)	
  	
  …	
  #end	
  
Velocity	
  ABC	
  
•  Lists	
  
#set($mylist	
  =	
  [])	
  
$mylist.add("asd")	
  
$mylist.add(123)	
  
$mylist.get(0)	
  

•  Maps	
  
#set($contentList	
  =	
  $!{contents.getEmptyList()})	
  	
  
#set($item	
  =	
  $!{contents.getEmptyMap()})	
  	
  
#set($_dummy	
  =	
  $item.put('guid',	
  $!content.get('iden5fier')))	
  	
  
#set($_dummy	
  =	
  $item.put('5tle',	
  $content.get($5tleField)))	
  
#set($_dummy	
  =	
  $!contentList.add($item))	
  	
  
Velocity	
  ABC	
  
•  Lists	
  and	
  Foreach	
  	
  
#foreach($item	
  in	
  $myList)	
  
	
  	
  	
  $item.5tle	
  <br/>	
  	
  
#end	
  


•  Velocity	
  Comments	
  
##	
  Commen5ng	
  one	
  line	
  
#*	
  	
  	
  Commen5ng	
  
	
  	
  	
  	
  	
  	
  	
  Mul5ple	
  lines	
  

*#	
  
Velocity	
  and	
  dotCMS	
  
•  Useful	
  variables:	
  
   –  $EDIT_MODE	
  
   –  $CONTAINER_NUM_CONTENTLETS	
  
   –  $VTLSERVLET_URI	
  
Velocity	
  and	
  dotCMS	
  
•  View	
  Tools	
  are	
  configured	
  in:	
  
    –  dotCMSWEB-­‐INFtoolbox.xml	
  


•  Three	
  types	
  of	
  view	
  tools:	
  
    –  Velocity	
  view	
  tools:	
  org.apache.velocity.tools….	
  
    –  dotCMS	
  view	
  tools:	
  
       com.dotmarke5ng.viewtools….	
  
    –  Customized	
  view	
  tools:	
  plugins	
  
Velocity	
  and	
  dotCMS	
  

•  Velocity	
  View	
  Tool	
  
   samples:	
  

    –  MathTool	
  
    –  ListTool	
  
    –  DateTool	
  



  hpp://velocity.apache.org/tools/devel/javadoc/   	
  
Velocity	
  and	
  dotCMS	
  
•  dotCMS	
  View	
  Tool	
  
   samples:	
  
    –  CategoriesWebAPI	
  
    –  WebAPI	
  
    –  ContentsWebAPI	
  




  hpp://www.dotcms.org/api/     	
  
Velocity	
  and	
  dotCMS	
  
•  org.apache.velocity.tools.generic.MathTool:	
  
   –  java.lang.Number	
  add(java.lang.Object	
  num1,	
  
      java.lang.Object	
  num2)	
  
   –  java.lang.Number	
  div(java.lang.Object	
  num1,	
  
      java.lang.Object	
  num2)	
  
   –  java.lang.Double	
  getRandom()	
  
   –  java.lang.Number	
  max(java.lang.Object	
  num1,	
  
      java.lang.Object	
  num2)	
  
   –  java.lang.Number	
  sub(java.lang.Object	
  num1,	
  
      java.lang.Object	
  num2)	
  	
  
Velocity	
  and	
  dotCMS	
  
•  org.apache.velocity.tools.generic.ListTool:	
  
   –  java.lang.Boolean	
  contains(java.lang.Object	
  list,	
  
      java.lang.Object	
  element)	
  	
  
   –  java.lang.Object	
  get(java.lang.Object	
  list,	
  int	
  index)	
  	
  
   –  java.lang.Boolean	
  isEmpty(java.lang.Object	
  list)	
  	
  
   –  java.lang.Integer	
  size(java.lang.Object	
  list)	
  	
  
Velocity	
  and	
  dotCMS	
  
•  org.apache.velocity.tools.generic.DateTool:	
  
   –  java.u5l.Date	
  getDate()	
  
   –  java.lang.Integer	
  getDay(java.lang.Object	
  date)	
  
   –  java.lang.Integer	
  getMonth(java.lang.Object	
  date)	
  
   –  sta5c	
  java.u5l.Date	
  getSystemDate()	
  
   –  java.lang.Integer	
  getYear(java.lang.Object	
  date)	
  
   –  java.u5l.Date	
  toDate(java.lang.Object	
  obj)	
  
   –  java.lang.String	
  toString()	
  
Velocity	
  and	
  dotCMS	
  
•  CategoriesWebAPI:	
  
   –  List<Category>	
  getChildrenCategoriesByKey(String	
  
      key)	
  
   –  Category	
  getCategoryByKey(String	
  key)	
  
   –  Category	
  getCategoryByName(String	
  name)	
  
   –  List<Category>	
  getChildrenCategories(Category	
  cat)	
  
   –  List<Category>	
  getChildrenCategories(Inode	
  inode)	
  
   –  List<Category>	
  getChildrenCategories(String	
  inode)	
  
   –  String	
  getCategoryKeyByContentlet(String	
  
      contentletInode)	
  
Velocity	
  and	
  dotCMS	
  
•  WebAPI:	
  
   –  int	
  parseInt(String	
  num)	
  
   –  int	
  parseInt(int	
  num)	
  
   –  String	
  toString(long	
  num)	
  
   –  boolean	
  isSet(String	
  input)	
  
   –  List<String>	
  splitString(String	
  str,	
  String	
  sep)	
  
   –  String	
  encodeURL(String	
  url)	
  
   –  List<Contentlet>	
  getContentletsByCategory(String	
  
      catInode)	
  
   –  	
  String	
  getContentIden5fier(String	
  parsePath)	
  
   –  String	
  getUserFullName()	
  
Velocity	
  and	
  dotCMS	
  
•  ContentsWebAPI:	
  
   –  Contentlet	
  getContentByInode(String	
  inode)	
  
   –  Structure	
  getStructureByType(String	
  structureType)	
  
   –  Structure	
  getStructureByInode(String	
  structureInode)	
  
   –  Field	
  getFieldByName(Structure	
  st,	
  String	
  fieldName)	
  
   –  List<Contentlet>	
  getContents(String	
  structureType,	
  
      String	
  categoryName)	
  
   –  List<Category>	
  getContentletCategories(String	
  inode)	
  	
  
   –  List	
  getEmptyList()	
  
Examples	
  
•    Dynamic	
  Banner	
  
•    Category	
  Example	
  
•    News	
  Pull	
  
•    Simple	
  Year	
  Archive	
  

Weitere ähnliche Inhalte

Ähnlich wie Velocity tips and tricks

第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
Kaz Watanabe
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
Justin Cataldo
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 

Ähnlich wie Velocity tips and tricks (20)

Learning How To Use Jquery #3
Learning How To Use Jquery #3Learning How To Use Jquery #3
Learning How To Use Jquery #3
 
Schema Design by Chad Tindel, Solution Architect, 10gen
Schema Design  by Chad Tindel, Solution Architect, 10genSchema Design  by Chad Tindel, Solution Architect, 10gen
Schema Design by Chad Tindel, Solution Architect, 10gen
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Super spike
Super spikeSuper spike
Super spike
 
Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2Collections Framework Beginners Guide 2
Collections Framework Beginners Guide 2
 
Collections Framework Begineers guide 2
Collections Framework Begineers guide 2Collections Framework Begineers guide 2
Collections Framework Begineers guide 2
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development Intro
 
Introductionto fp with groovy
Introductionto fp with groovyIntroductionto fp with groovy
Introductionto fp with groovy
 
jQuery Essentials
jQuery EssentialsjQuery Essentials
jQuery Essentials
 
Fazendo mágica com ElasticSearch
Fazendo mágica com ElasticSearchFazendo mágica com ElasticSearch
Fazendo mágica com ElasticSearch
 
GreenDao Introduction
GreenDao IntroductionGreenDao Introduction
GreenDao Introduction
 
Iniciando com jquery
Iniciando com jqueryIniciando com jquery
Iniciando com jquery
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Jquery
JqueryJquery
Jquery
 
Django tech-talk
Django tech-talkDjango tech-talk
Django tech-talk
 
Amazon Web Services for PHP Developers
Amazon Web Services for PHP DevelopersAmazon Web Services for PHP Developers
Amazon Web Services for PHP Developers
 
Business Dashboards using Bonobo ETL, Grafana and Apache Airflow
Business Dashboards using Bonobo ETL, Grafana and Apache AirflowBusiness Dashboards using Bonobo ETL, Grafana and Apache Airflow
Business Dashboards using Bonobo ETL, Grafana and Apache Airflow
 
Understanding backbonejs
Understanding backbonejsUnderstanding backbonejs
Understanding backbonejs
 

Mehr von dotCMS

Building Mobile Apps and Sites in dotCMS
Building Mobile Apps and Sites in dotCMSBuilding Mobile Apps and Sites in dotCMS
Building Mobile Apps and Sites in dotCMS
dotCMS
 
Out ofmemory
Out ofmemoryOut ofmemory
Out ofmemory
dotCMS
 
Categories vs relationships
Categories vs relationshipsCategories vs relationships
Categories vs relationships
dotCMS
 

Mehr von dotCMS (17)

Unleash Your Content: Content-as-a-Service
Unleash Your Content: Content-as-a-ServiceUnleash Your Content: Content-as-a-Service
Unleash Your Content: Content-as-a-Service
 
How Does an Organization Manage Hundreds of Sites?
How Does an Organization Manage Hundreds of Sites?How Does an Organization Manage Hundreds of Sites?
How Does an Organization Manage Hundreds of Sites?
 
SEO
SEO SEO
SEO
 
The Making of a Rockin' Web Team
The Making of a Rockin' Web TeamThe Making of a Rockin' Web Team
The Making of a Rockin' Web Team
 
Justifying IT Spending
Justifying IT SpendingJustifying IT Spending
Justifying IT Spending
 
Aligning Your Web Initiative with Your Business
Aligning Your Web Initiative with Your BusinessAligning Your Web Initiative with Your Business
Aligning Your Web Initiative with Your Business
 
dotCMS Roadmap 2010
dotCMS Roadmap 2010dotCMS Roadmap 2010
dotCMS Roadmap 2010
 
Plugin Overview I and II
Plugin Overview I and IIPlugin Overview I and II
Plugin Overview I and II
 
Migrating to v1.9
Migrating to v1.9Migrating to v1.9
Migrating to v1.9
 
Going Multi-Tenant with dotCMS
Going Multi-Tenant with dotCMSGoing Multi-Tenant with dotCMS
Going Multi-Tenant with dotCMS
 
Building Mobile Apps and Sites in dotCMS
Building Mobile Apps and Sites in dotCMSBuilding Mobile Apps and Sites in dotCMS
Building Mobile Apps and Sites in dotCMS
 
Super widget
Super widgetSuper widget
Super widget
 
SEO and search plugins
SEO and search pluginsSEO and search plugins
SEO and search plugins
 
Out ofmemory
Out ofmemoryOut ofmemory
Out ofmemory
 
Host and Permissions in v1.9
Host and Permissions in v1.9 Host and Permissions in v1.9
Host and Permissions in v1.9
 
Forms as Structured Content
Forms as Structured Content Forms as Structured Content
Forms as Structured Content
 
Categories vs relationships
Categories vs relationshipsCategories vs relationships
Categories vs relationships
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Velocity tips and tricks

  • 1. Velocity  Tips  and  Tricks     Simple  Solu5ons  to   Common  Problems   Wed.,  April  14,  2010  
  • 2. Velocity  ABC   •  Variables:   –  #set($thumbWidth  =  55)   –  #set($varString  =  ‘ The  width  is‘)   –  #set($varString  =  “${varString}  ${thumbWidth}  px“)   •  Proper5es:   –  $news.shortSummary   –  $news.expireDate   •  Methods:   –  #set($_today  =  $date.getDate())   –  #set($_todayFormated  =  $date.format('yyyyMMddHHmmss', $_today))  
  • 3. Velocity  ABC   •  If  /  ElseIf  /  Else  statements   #if($condi5on_1)          Condi5on  1  was  met   #elseif($condi5on_2)          Condi5on  2  was  met   #else            Another  condi5on  was  met   #end   •  AND  /  OR     #if($condi5on_1  &&  $condi5on_2)    …    #end   #if($condi5on_1  ||  $condi5on_2)    …  #end  
  • 4. Velocity  ABC   •  Lists   #set($mylist  =  [])   $mylist.add("asd")   $mylist.add(123)   $mylist.get(0)   •  Maps   #set($contentList  =  $!{contents.getEmptyList()})     #set($item  =  $!{contents.getEmptyMap()})     #set($_dummy  =  $item.put('guid',  $!content.get('iden5fier')))     #set($_dummy  =  $item.put('5tle',  $content.get($5tleField)))   #set($_dummy  =  $!contentList.add($item))    
  • 5. Velocity  ABC   •  Lists  and  Foreach     #foreach($item  in  $myList)        $item.5tle  <br/>     #end   •  Velocity  Comments   ##  Commen5ng  one  line   #*      Commen5ng                Mul5ple  lines   *#  
  • 6. Velocity  and  dotCMS   •  Useful  variables:   –  $EDIT_MODE   –  $CONTAINER_NUM_CONTENTLETS   –  $VTLSERVLET_URI  
  • 7. Velocity  and  dotCMS   •  View  Tools  are  configured  in:   –  dotCMSWEB-­‐INFtoolbox.xml   •  Three  types  of  view  tools:   –  Velocity  view  tools:  org.apache.velocity.tools….   –  dotCMS  view  tools:   com.dotmarke5ng.viewtools….   –  Customized  view  tools:  plugins  
  • 8. Velocity  and  dotCMS   •  Velocity  View  Tool   samples:   –  MathTool   –  ListTool   –  DateTool   hpp://velocity.apache.org/tools/devel/javadoc/  
  • 9. Velocity  and  dotCMS   •  dotCMS  View  Tool   samples:   –  CategoriesWebAPI   –  WebAPI   –  ContentsWebAPI   hpp://www.dotcms.org/api/  
  • 10. Velocity  and  dotCMS   •  org.apache.velocity.tools.generic.MathTool:   –  java.lang.Number  add(java.lang.Object  num1,   java.lang.Object  num2)   –  java.lang.Number  div(java.lang.Object  num1,   java.lang.Object  num2)   –  java.lang.Double  getRandom()   –  java.lang.Number  max(java.lang.Object  num1,   java.lang.Object  num2)   –  java.lang.Number  sub(java.lang.Object  num1,   java.lang.Object  num2)    
  • 11. Velocity  and  dotCMS   •  org.apache.velocity.tools.generic.ListTool:   –  java.lang.Boolean  contains(java.lang.Object  list,   java.lang.Object  element)     –  java.lang.Object  get(java.lang.Object  list,  int  index)     –  java.lang.Boolean  isEmpty(java.lang.Object  list)     –  java.lang.Integer  size(java.lang.Object  list)    
  • 12. Velocity  and  dotCMS   •  org.apache.velocity.tools.generic.DateTool:   –  java.u5l.Date  getDate()   –  java.lang.Integer  getDay(java.lang.Object  date)   –  java.lang.Integer  getMonth(java.lang.Object  date)   –  sta5c  java.u5l.Date  getSystemDate()   –  java.lang.Integer  getYear(java.lang.Object  date)   –  java.u5l.Date  toDate(java.lang.Object  obj)   –  java.lang.String  toString()  
  • 13. Velocity  and  dotCMS   •  CategoriesWebAPI:   –  List<Category>  getChildrenCategoriesByKey(String   key)   –  Category  getCategoryByKey(String  key)   –  Category  getCategoryByName(String  name)   –  List<Category>  getChildrenCategories(Category  cat)   –  List<Category>  getChildrenCategories(Inode  inode)   –  List<Category>  getChildrenCategories(String  inode)   –  String  getCategoryKeyByContentlet(String   contentletInode)  
  • 14. Velocity  and  dotCMS   •  WebAPI:   –  int  parseInt(String  num)   –  int  parseInt(int  num)   –  String  toString(long  num)   –  boolean  isSet(String  input)   –  List<String>  splitString(String  str,  String  sep)   –  String  encodeURL(String  url)   –  List<Contentlet>  getContentletsByCategory(String   catInode)   –   String  getContentIden5fier(String  parsePath)   –  String  getUserFullName()  
  • 15. Velocity  and  dotCMS   •  ContentsWebAPI:   –  Contentlet  getContentByInode(String  inode)   –  Structure  getStructureByType(String  structureType)   –  Structure  getStructureByInode(String  structureInode)   –  Field  getFieldByName(Structure  st,  String  fieldName)   –  List<Contentlet>  getContents(String  structureType,   String  categoryName)   –  List<Category>  getContentletCategories(String  inode)     –  List  getEmptyList()  
  • 16. Examples   •  Dynamic  Banner   •  Category  Example   •  News  Pull   •  Simple  Year  Archive