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 proposal

Saturday, April 21. 2007 at 13:17 (Link) (Reply)
First off, change your __construct() method to rss(). Second, in your bootstrap or in a controller, add the path to the directory containing your custom helpers via $view->addHelperPath() (tip: you can pass a class prefix as the second argument, which allows you to use your own namespace for helpers).
Once you've done the above steps, you can make the call much more simply in your view script:$feed = $this->rss('http://www.planet-php.net/rss/');
Another thing: you mention that the view sometimes needs access to the model, and you've shown one way here via a helper. Something else you can do is pass models to the view from your controller, or a plugin, or your bootstrap, or... The point is, there's no limitation on what types of variables you pass to the view, so you can pass whatever objects you need to have access to. You might even try creating a view helper that can load model objects on the fly for you...
Saturday, April 21. 2007 at 19:28 (Link) (Reply)
I already noted the controller method. Propagating Models across nested Views is also possible from the bootstrap/other but View Helpers are a cleaner than other methods since the Views just go get data as needed in a very visible accessible fashion.
The point I was making here is that there is no reason to stop the View directly querying the Model layer when it's needed. There are a lot of people using the framework who don't see that and run off to nest controllers needlessly. A short manual note would go a long way...
Are you summarising me with that last sentence?
Saturday, May 5. 2007 at 08:02 (Link) (Reply)
I read directly from the model in view helpers too when necessary as otherwise you run the risk of the controller action acting as a proxy to the view for stuff that is completely unrelated to the current action. One solution is of course to use _forward() which requires a linear chain to be constructed and I find less flexible.
(It's just as easy in Smarty as in Zend_View too
Regards,
Rob...
(finally catching up...)
Saturday, May 5. 2007 at 10:47 (Link) (Reply)
Yep, I have a comment for this entry giving a brief overview of adding suitable tags to the Smarty compiler
Saturday, April 21. 2007 at 19:40 (Link) (Reply)
I've typically shied away from pulling directly from models in my view layer, though Fowler clearly shows this intention in his discussion of MVC in POEAA. In some recent projects I've been working on, however, I can definitely see the use for it, and you're definitely making a good case for it (and showing how Zend_View can make it easily possible).
One note: in Fowler's discussion of MVC< he does note that typically you should not do anything that alters your model directly from the view -- i.e., you wouldn't want to do anything that would insert, update, or delete data, only pull data from the model.
Saturday, April 21. 2007 at 19:51 (Link) (Reply)
I do agree - I very much prefer my templates in PHP. Tagsoup does have it uses when you're not fully in control of who's editing the templates - but generally I don't see that scenario very often.
Saturday, April 28. 2007 at 03:45 (Link) (Reply)
and we dont want any php coding in the view at all?
how would we access the models from there if we can't initialize it from the view?
and I don't want to initialize every models i have in the controller and pass to the view.
i want to dynamically call the model from the view.
is this possible?
Saturday, April 28. 2007 at 11:17 (Link) (Reply)
Adding the Model this way is possible, but not very clean since the smarty bits are procedural functions, not OO View Helpers. If you are comfortable doing so you can use them mainly to create new View Helper instances inside the function as static variables (Singleton style), which are written as in my example, or ZF's view helper outline.
The function is then just a Proxy, using a specific Smarty tag parameter to hold the method name to call on the View Helper object. If you took mt RSS helper, a Smarty function for this could be called "smarty_function_rss" and have the following tag type:
{rss method='getTitles' number='5' assign='titles' url='http://www.planet-php.net/rss/'}
Might not make perfect sense to you right now, but check the Smarty source for the function files in its plugin directory. This function would assign the 5 headlines to the template variable called $titles as an array. Since all functions get a reference to the Smarty object, that as easy as
$smarty->assign('titles', $resultFromViewHelper);
Could write a whole blog post about this but this will get you started in the right direction.
Tuesday, August 21. 2007 at 00:41 (Reply)
Monday, August 27. 2007 at 04:00 (Link) (Reply)