2009年4月12日星期日

Re: [fw-mvc] view, code reuse

Getting this done using a view helper is a good idea. I don't think the view script using the dialog generator has to know the path to it.
Hardcoding this in every view script, you'll have to edit them every time the path changes. Also, the view helper should do the interaction with jQuery (and not that dialogGenerator.phtml) - generally speaking, the less code in a view script, the better.

You should also take a look at the ZendX_JQuery-Classes. There already are some view helpers you may want to use.
See: http://framework.zend.com/manual/en/zendx.jquery.view.html

----- Original Message -----
From: "helderfelipe" <helderfelipe@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Monday, 13 April, 2009 02:05:50 GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna
Subject: [fw-mvc] view, code reuse


I created a view witch generate a dialog with jquery, this file can be called
in any view of the application.
i'm doing this way:

<?php echo $this->partial('parts/dialogGenerator.phtml', array(
'title' => 'Title of the dliaog',
'var1' => 'var2',
'var2' => 'var2'
)); ?>

is it correct in MVC pattern ?
can i do this using view helpers ?
--
View this message in context: http://www.nabble.com/view%2C-code-reuse-tp23016128p23016128.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: