> In my experience, specific problems that warrant breaking rules are a
> lot rarer than many think. Are you wanting your users to be able to
> edit the view files? if not, your controller calls the view files - it
> knows which view file it's going to use it should know which data it
> wants to receive; if so, why? and in any event I'd suggest designing
> towards the same answer ;).

You're absolutely right... I think sometimes I come across as arrogant
when I'm just trying to get a discussion going :)

> If you are still not convinced, what's the code in your controller
> method /templates/get_items_this_month/ ? specific discussions are
> more likely to give you specific answers.

The code in that function (get_items_this_month) just does a findAll
based on the function parameters. The problem was that I needed to
find a way of sending an array as a parameter. Like you said, I could
actually do that with requestAction but that would not be a great
solution.

The solution I've gone for now is to split the template up. So I've
got one THTML file (template_name.thtml) which contains some
iterations with html inside of them. I've also got a raw include file
(template_name.php) which gets included before rendering the template
file.

My include file basically builds a massive array with all the data I
need and then does:
$this->set('templateData', $templateData);

dardosordi: is this maybe what you had in mind?

I would have rather made the data file a component instead of an
include, but that gave me lots of problems with things like $this no
longer referring to the controller. Also I would have to hardcode the
array of components to include, which means that I would have to edit
the controller in order to add a template (I want to avoid this).

Enough of my ramblings. I think I've got something working fairly well
now, albeit not as elegant as it could be.

S


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to