I like to keep some separation. I find a Response object fills in where there is not enough complexity to need a View.sike wrote:yeah i see what you mean. the thing is that i don't distinguish too much between views and templates. on most pages i use a component based approach - each component inherits from template (i do this to avoid juggling template vars around) and is plugged into a page object (which i see as the "view"). works out ok this far. one thing that made me think in the past was the blurry line between view and controller when working with components.
I might do something like this, and then have a replaceable default render for the response that builds the standard page wraparound HTML and fills in you headline, etc. In one way it is just a formalism, but the Response also does redirects and gathers up headers, styles, scripts, etc.
Code: Select all
/**
* @return void
*/
protected function buildContent()
{
$data = $this->getData();
$response= $this->getResponse();
$Headline = new WebsiteHeadlinePartial($this->getApplication());
$Headline['Headline'] = $data->get('Headline');
$Headline['SubHeadline'] = $data->get('SubHeadline');
$response->addElement($Headline);
$Images = new WebsiteDistributorLevel1IPartial($this->getApplication());
$Images['Images'] = $data->getImages();
$response->addElement($Images);
$Teasers = new WebsiteTeaserModulesPartial($this->getApplication());
$Teasers['Teasers'] = $data->getTeasers();
$response->addElement($Teasers);
}I think of them on a continum of sorts. I think of a Template as doing a transform based on some algorithm. A View adds presentation logic. But that means some things that are called "template systems" like Smarty are actually creating View in my book.sike wrote:what's your differentiation between a view and a template?