Rain
unread,Feb 28, 2011, 3:34:07 AM2/28/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rainframework
Hello,
Now in RF the layout is managed by the Loader, directly from the
index.php file.
This approach is cool because simplify the designing of an
application, but has a problem in the Ajax management.
An Ajax call can return a JSON, more general a string, or just a true/
false value.
Usually when you do an Ajax call you don't need to render the layout,
right? We solved by adding an ajax.php file that doesn't render the
layout and just print the output of the controller loaded. It works
but it is not elegant at all.
We are evaluating the possibility to let the Controllers and Models to
load the Layout with the View class, here we go:
Example_Controller extends Controller{
function example( ){
// logic logic logic ... do logic ...
$view = new View();
$view->assign( 'logic' );
return $view->draw( "controller template", $in_layout=true/
false );
}
}
Let's see how works the $in_layout:
- true, the result will be added to the Layout
- false, the result will be printed directly, no Layout will be
rendered
We like this solution, is elegant and enough flexible, but we are open
to your suggestions,
and any comments are welcome.