Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#set ($ItemsPerPage = 6)
#if ($formatHelper.parseInteger($parameters.get("ItemsPerPage")))
  #set ($ItemsPerPage = $formatHelper.parseInteger($parameters.get("ItemsPerPage")))
  #if ($ItemPerPage < 1 || $ItemPerPage > 50)
    #set ($ItemsPerPage = 6)
  #end
#end

Notice that we default to 6, if the parameter is parsable then we'll assign it's parsed value to the ItemsPerPage variable.  $Integer.parseIntWe then sanity check the range of the value to make sure it's reasonable.