I want to establish the similar setup Rails has, MVC, controller gets request, retrieves the model, view uses the model to output html.
What is the best way to pass the model variable from the controller script to the view script? (view function is called within controller script)
i.e.
//controller
<?php
$model = new User();
$model->user_name = "johnnyjohnny";
$output_html();
?>
//view
<?php
function output_html() {
echo "<div>$model->user_name</div>"
}
?>
how to pass model from controller to view?
thanks in advance