title: Where should number_format (logic relating to the view) go un CakePHP?
body: <p>After discussing with a colleague, we are mixed in where we think logic relating to the view should go.</p>
  
  <p>For example lets say we have a number that we want to show in our view. I think the <code>number_format</code> (or <code>CakeNumber::format</code> as we're using CakePHP) should go in the view as it's related to what we show. My colleague thinks it should go in the controller because that's where all logic goes.</p>
  
  <p>In this case we have two views, one for the website and end users and an API view which returns a json response. If I were to put the code in the controller I'd have to check which view I'm using as not to give a string in the json response when really it is an integer. For this reason I'm heavily supporting the code in the view.</p>
  
  <p>The question is, who is "more" right, where should that number formatting go?</p>
  
  <p>Further to my argument of putting code in the view, he is happy to use <code>htmlentities</code> in the view but I argue that if I'm not allowed number_format, he can't have <code>htmlentities</code> and that it should be done in the controller.</p>