I agree, like I said, getters will be available in my template engine. You can access methods, you just can't pass arguments to them. It would look something like thisChris Corbyn wrote:If you want a solution that doesn't introduce yet another syntax, try playing with XML and XSLT. You provide your model as XML... the your template (XSL) creates a view in HTML. I also think you can extend a template with XSL (though I'm not an expert so I could be wrong, I've just seen it done in DITA).
Never feels nicer than PHP though.
I agree with pytrin too. IMHO, passing objects (just domain object mind you) into the view is an everyday practice for me. I don't want my page controller to know specifically *what* data it will use from my $auction domain object, I just know that my page displays an auction. What's so different about this:
Code: Select all
$this->view->set('auction', $auction);And this....Code: Select all
<h2 class="auctiontitle"><?php $this->escape($auction->getTitle()); ?></h2>
Code: Select all
$this->view->set('auctionTitle', $auction->getTitle());Your domain objects are just containers for information, and many believe it's a best-practice to allow your view to grab the data they need rather than being passed the information they need.Code: Select all
<h2 class="auctiontitle"><?php $this->escape($aucionTitle); ?></h2>
And no, don't move complex view logic into the page controller... that's simply not the correct place for it. View logic can get complex (when you've got loops full of conditions), but changing the foreach and the if..else syntax doens't remove the complexity, it just changes the syntax. It's still view logic at the end of the day.
Code: Select all
<?= $auction.gettitle ?>