title: Calling a controller's method from within the view CakePHP
body: <p>I've been wondering what the best way to do this would be. I've got a SubmissionsController and within it, a view() method which is the display for each submission. All submissions have favorites, and users can vote on those favorites. I want to change an icon depending on whether or not the user voted on something previously. I've thought about doing it something like this:</p>
  
  <pre><code>// checkExistingFavorite would be a boolean method which returns true if the user has             already favorited it
  &lt;?= if (SubmissionsController::checkExistingFavorite($userId, $submissionId)) { ?&gt;
  &lt;span style="favorited"&gt;Remove Favorite&lt;/span&gt;
  &lt;? } else { ?&gt;
  &lt;span style="not-favorited"&gt;Favorite&lt;/span&gt;
  &lt;? } ?&gt;
  </code></pre>
  
  <p>But obviously, I shouldn't be calling the SubmissionsController directly from within my view. My question is what's the best way to handle this? It'd need to be checked each time a user goes to view a submission though, so I'm not sure if I should even cache this?</p>