License
Planet PHP
Certified Schizophrenic - zillablog - PHP
Ogres Select Consumption Over Networking (OSCON) - Terry Chay
What MySQL 5 features do I use? - Lukas Smith
Zend Framework 1.6 Release Candidate 1 now available! - planetphp
PHPSecInfo talk at OSCON 2008 - Ed Finkler
Usability FAIL - Brian Moon
Usability FAIL - Brian Moon
Dealing with non-paying client - Michael Kimsal
OSCON 2008: Day One - Ben Ramsey
Quality Assurance in PHP Projects - Sebastian Bergmann
Wednesday, July 23. 2008
Ogres Select Consumption Over Networking (OSCON) - Terry Chay
Tuesday, July 22. 2008
What MySQL 5 features do I use? - Lukas Smith
Tuesday, July 22. 2008
Zend Framework 1.6 Release Candidate 1 now available! - planetphp
Tuesday, July 22. 2008
PHPSecInfo talk at OSCON 2008 - Ed Finkler
Tuesday, July 22. 2008
Usability FAIL - Brian Moon
Tuesday, July 22. 2008
Usability FAIL - Brian Moon
Tuesday, July 22. 2008
Dealing with non-paying client - Michael Kimsal
Tuesday, July 22. 2008
OSCON 2008: Day One - Ben Ramsey
Monday, July 21. 2008
Quality Assurance in PHP Projects - Sebastian Bergmann
Monday, July 21. 2008
Statistics
Last entry: 18.07.2008 17:27
368 entries written
1136 comments have been made
Calendar
Quicksearch
Comments
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Tue, 22.07.2008 13:55
I'll never deny an influence f rom rspec
- only the accusa
tion that I'm motivated to re-
implement Ruby because i [...]
Tue, 22.07.2008 13:55
I'll never deny an influence f rom rspec
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Tue, 22.07.2008 10:11
Looking at your example, the f irst thing that comes to my mi nd is RSpec: [geshi lang=ru by] # bowling_spec.rb [...]
Tue, 22.07.2008 10:11
Looking at your example, the f irst thing that comes to my mi nd is RSpec: [geshi lang=ru by] # bowling_spec.rb [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Mon, 21.07.2008 11:15
The only change you made thoug h was to use a lamdba - it sti ll suffers from the same probl ems of being verbose, no [...]
Mon, 21.07.2008 11:15
The only change you made thoug h was to use a lamdba - it sti ll suffers from the same probl ems of being verbose, no [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Sun, 20.07.2008 10:56
I'm not convinced if a DSL is the way to go. What about a re ally base class for BDD storie s. [geshi lang=php] [...]
Sun, 20.07.2008 10:56
I'm not convinced if a DSL is the way to go. What about a re ally base class for BDD storie s. [geshi lang=php] [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Sat, 19.07.2008 00:21
Final clarification - the exte rnal DSL is not based on any e xisting language. Man, I will never mention Ruby in a [...]
Sat, 19.07.2008 00:21
Final clarification - the exte rnal DSL is not based on any e xisting language. Man, I will never mention Ruby in a [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 23:50
If your going to change langua ge. Go for Python, I find it f ar superior to Ruby. By the way, I don't think decr [...]
Fri, 18.07.2008 23:50
If your going to change langua ge. Go for Python, I find it f ar superior to Ruby. By the way, I don't think decr [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 20:44
And I misread you
. Sorry.
The DSL is for BDD which pla
ces an emphasis on intuitive p
rediction - "equals" is [...]
Fri, 18.07.2008 20:44
And I misread you
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 20:17
PHP and Ruby are both general programming languages. The Zen d Framework and Ruby On Rails are both frameworks. I c [...]
Fri, 18.07.2008 20:17
PHP and Ruby are both general programming languages. The Zen d Framework and Ruby On Rails are both frameworks. I c [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 20:04
Hi Vincent - == is the PHP equ ality comparison, just as === is for making an identical che ck. Plain old = is just [...]
Fri, 18.07.2008 20:04
Hi Vincent - == is the PHP equ ality comparison, just as === is for making an identical che ck. Plain old = is just [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 19:10
Never been one to argue with y ou but you've just gone and co mpared PHP to Ruby which is a very load no no... Th [...]
Fri, 18.07.2008 19:10
Never been one to argue with y ou but you've just gone and co mpared PHP to Ruby which is a very load no no... Th [...]
about A Domain Specific Language for Behaviour Driven Development (BDD) in PHP
Fri, 18.07.2008 18:58
Hmm, why are you using "==" in stead of "equal"?
Fri, 18.07.2008 18:58
Hmm, why are you using "==" in stead of "equal"?
about Google roll out OAuth Authorisation to all Google Data APIs
Wed, 16.07.2008 01:00
Crazy release time hasn't let me check it out again - but th anks for addressing those conc erns. It looks like tha [...]
Wed, 16.07.2008 01:00
Crazy release time hasn't let me check it out again - but th anks for addressing those conc erns. It looks like tha [...]
about Google roll out OAuth Authorisation to all Google Data APIs
Tue, 01.07.2008 12:15
Hi Justin, Zend_Crypt_Hmac is available from the ZF Incub ator repository as it is not y et within Core. It does [...]
Tue, 01.07.2008 12:15
Hi Justin, Zend_Crypt_Hmac is available from the ZF Incub ator repository as it is not y et within Core. It does [...]
about Google roll out OAuth Authorisation to all Google Data APIs
Tue, 01.07.2008 01:41
Hey, I'm trying to test out ba sed on the code you linked - b ut it looks like the Zend_Cryp t_Hmac package is not av [...]
Tue, 01.07.2008 01:41
Hey, I'm trying to test out ba sed on the code you linked - b ut it looks like the Zend_Cryp t_Hmac package is not av [...]
about MIA from Planet PHP
Wed, 25.06.2008 17:21
Yes, I noticed. I haven't re-s ubmitted a request yet though. So they are still aggregating the posts I was refused [...]
Wed, 25.06.2008 17:21
Yes, I noticed. I haven't re-s ubmitted a request yet though. So they are still aggregating the posts I was refused [...]
Categories
Top Referrers
Show tagged entries
application security
astrum futura
bdd
behavior-driven development
behaviour-driven development
design patterns
devnetwork
eve online
games
htmlpurifier
irish php user group
irishisms
maugrim
microformat
mock objects
mvc
oauth
openid
openid and yadis
pc gaming
pear
phing
php
php game development
php games
php general
php security
phpmock
phpspec
phpunit
qgl
quantum game library
quantum star se
rantings
simpletest
solar empire
tdd
tutorial
unit testing
xp programming
xrd
xrds
xri
yadis
yaml
zend framework
zf proposalComplex Views with the Zend Framework - Part 6: Setting The Terminology
Trackbacks
Extending Zend Framework’s ViewRenderer Helper to Allow Application and Controller Page Layouts
I intend to do a write-up of my experiences choosing a PHP framework, but for now, I just thought I would share this. One of the out-of-the-box features that the Zend Framework is missing is "layouts". These are the templates that contain the...
I intend to do a write-up of my experiences choosing a PHP framework, but for now, I just thought I would share this. One of the out-of-the-box features that the Zend Framework is missing is "layouts". These are the templates that contain the...
Weblog: Deprecated Behaviour
Tracked: Jun 25, 16:49
Tracked: Jun 25, 16:49


Friday, June 8. 2007 at 01:59 (Link) (Reply)
Propel is also a great ORM tool that helps in complex Views with paging/filtering/sorting etc.
Here's how we do complex views:
http://www.xml.lt/Blog/2007/06/05/DIY+tips%3A+Propel+does+a+great+job+for+Views
Friday, June 8. 2007 at 10:15 (Link) (Reply)
1. Layouts seem like MVC exceptions to me. I don't mean the programmer's kind of exceptions, I mean the literal sense. I understand that they can save us from redundant includes. But why should we include header and footer when we can have a generic top view that includes a nested main view? The controller could tell the top view which one it should include. Then we wouldn't need those "exceptions" anymore.
2. Those placeholders look appealing. But shouldn't it be possible to append (instead of overwrite) data to them? Maybe line-wise? I'm thinking about JS includes, where every view component needs its own script. Therefore every component should be able to add another include line to the placeholder value.
3. I've been asking this to myself for a while now: You're proposing nested views, which is a good idea. And you're saying, that views should be able to read from the model directly or over a view helper. That sounds great, but I'm thinking in components. So what if a nested component (i.e. a nested view) needs to change something to the model? It doesn't have controller anymore and no state changing code should be put in that component's view.
Here's an example: I've got a login component (box) somewhere on most of my pages, but not all of them. According to your composite view pattern, it's being displayed by a nested view and pulls it's data (if and who's logged in at the moment) directly from the model, somehow. But what if a user logs in or out? That's a change to the model and should be handled by the controller. But I can't put that login checking code in every page's controller. That would be unDRY and, after all, not every page has a login box.. maybe it's displayed dynamically. So where to put that code? Can i create a new controller and attach it to a nested view somehow? This applies to other components as well (comment component, rating component, etc.).
My guts say I missed something simple here..
Friday, June 8. 2007 at 14:36 (Link) (Reply)
1. I've taken a stab at defining the process, but the implementation can vary. Many folk might prefer letting the Response object operate as your "top view". Others might prefer a Two-Step View style implementation using dispatch plugins. Here I've tried to keep Zend_View isolated. As far as a user is concerned these implementations work without Controllers even present (apart from Dispatches obviously). By removing the Controller as a dependency I'm forced to keep everything completely decoupled.
2. Placeholders, like some other of these, can look incredibly obvious
3. From what I understand you mean checking per page (dynamically) whether or not to display the login form or a default greeting/status type message?
The way I do it is simple enough. The login form is in it's own template since it's a variable element across pages (and not always displayed). When it is displayed it calls to a small View Helper. The Helper then perform a Model read to check whether the user is logged in or not. Model here takes the broad definition - in my ZF apps I use a simple call to get a boolean result using:
A simple one liner. Not sure if this is what you meant though? Either way, ALL Model changes may only take place from a Controller. A login/logout is never handled by the View - all it can do is read that status and determine whether or not to display elements with a dependency on authentication. If the entire page is authentication sensitive then the Controller (higher up) needs to do something (like redirecting).
Make any sense here?
Friday, June 8. 2007 at 16:28 (Reply)
Friday, June 8. 2007 at 16:59 (Link) (Reply)
I'm sure frameworks have different names for these concepts, but the concepts themselves have been in use since the dawn of time
I'm also sure I tried using Symfony as a club when discussing Zend_View on the ZF mailing lists a few times
Saturday, June 9. 2007 at 09:38 (Reply)
I am using smarty to achieve more or less the things you mentioned above.
1) includes: just using the smarty equivalent {include file='filename.tpl'}
2) partials: using {include file='filename.tpl' data=$data} in foreach statements
3) dispatches: i have no idea on how to implement this, because there is some discussion on how to do it with as less overhead and loss in performance (for example the widget function that was posted on the wiki). I strongly believe (unless you can convince me otherwise
4) layouts: i am using the smarty capture blocks to achieve this.
Example:
page.tpl file:
{capture name=’content’ assign=’content’}
this is my content
{/capture}
{include file=’base.tpl’ content=$content}
base.tpl file:
{include file=’header.tpl’}
{include file=’sometemplate.tpl’}
{$content}
{include file=’footer.tpl’}
5) placeholders: i am using the same approach as mentioned above. you can define more capture blocks that insert things in a specific plac (placeholder).
Example:
page.tpl file:
{capture name=’content’ assign=’content’}
this is my content
{/capture}
{capture name='head' assign='head'}
{/capture}
{include file=’base.tpl’ content=$content
head=$head}
base.tpl file:
{$head}
{include file=’header.tpl’}
{include file=’sometemplate.tpl’}
{$content}
{include file=’footer.tpl’}
I don't know if this is the best approach when looking at performance but this works for me. I would like to have some comments on my way of working and compare it to the article above.
Saturday, June 9. 2007 at 18:03 (Link) (Reply)
Even something like Partials can be found everywhere these days: Smarty, Solar Framework, Symfony, etc. - but not Zend_View
Wednesday, June 20. 2007 at 16:24 (Reply)
Thursday, June 28. 2007 at 16:29 (Reply)
Thursday, September 6. 2007 at 17:40 (Link) (Reply)
{
/**
zend view instance
@var Zend_View
/
public $view;
public function setView(Zend_View_Interface $view){
$this->view = $view;
}
public function Partial($sTemplate, $variables = array())
{
// copy old view
$view = clone $this->view;
// unset old variables to remove name conflicts
$view->clearVars();
foreach ($variables as $id => $val){
$view->$id = $val;
}
return $view->render($sTemplate);
}
}
partial helper
Thursday, October 18. 2007 at 10:30 (Link) (Reply)
It is quite easy to make a view helper that allows to you declare certain parts of the output in a named segment. We can then forward to another controller that would populate other named segments like the common 'header', 'menu', 'footer'
And at the end, as you said construct a page from the named segments combined with a common template.
For a simple application, we can complete avoid the more complex proposals of Zend_Layout. This simple approach looks very friendly with Template_Lite too.
This is what i'm doing:
class View_Help_Blocks {
$_currentSegment
function begin($name) {
$_currentSegment = $name;
ob_start();
}
function end() {
getResponse->appendBody(_$currentSegment, ob_get_clean());
}
}
Perhaps you can something like this in your Zend_View_Enhanced proposal
Regards,