Hi,
alessandro cinelli wrote:
On Tue, Mar 18, 2008 at 10:58 AM, SWilk <[EMAIL PROTECTED]
Yes , i understand the reusability reason and i agree.
But what i mean is that instead of calling
$this->action($action,$controller, $module) directly in the view, i
think it would be better
if you call $this->action($action,$controller, $module) inside the
calling action(Main action).
That you can always do, either directly or with (controller)
$this->_forward(...);
But actions usually do render view scripts, which would either break
your layout (by displaying called action's view first, and then
calling action's script) or render only the called action's view.
If the action you call does not render the view script, then you could
do that.
The Called action is processed returning the CONTROL to the Main action
and passing it the generated values.
Then the Main action will call its view rendering also the value passed
by the Called action.
>
In my applications actions rarely return values, they rather render
view scripts, which usually do not return data, but echo them.
Unless you decide otherwise in your actions of course.
What i want to know now is if i change something to implement my own
"design", call another action from an action, could it break some Zend
Framework features?
You need to remember what that other action does and if it does render
a view script or not (or, whether it disables auto rendering).
So, if there is a part of your application witch have its own view
script, own model functions, and own action, witch together could be
used as component, you should use Action helper.
This way you call it with one line of code from any view script in
your page, passing an argument maybe. You can change something in the
"component" and you don't have to change anything else.
This way you can create a menu, or a widget or anything you need what
is a complete integral part of application and does not require any
external interventions.
If you need to fetch data and process them locally in some action, I
think you should not call other action, but call a model's method.
This is how I understand it, but I might be wrong.
--
Regards
Szymon Wilkolazki