How do I pass information my a controller to a view in PHP (no framework)? -


using php, if have model (a class) various queries, whatever need, , in controller, use mymodel = new customermodel(); , later in controller, call mymyodel in controller (i know looks codeigniter not using framework) to:

$data['query'] = mymodel.orderbylastname();

how pass $data['query'] view, separate .php page?

i don't wan echo controller.

also, hoping design, way explained makes sense. or wasting time model class?

typically, you'd instantiate view object:

$view = new view(); 

pass info needs():

$view->set($name1, $value1); $view->set($name2, $value2); ... 

then invoke view's renderer:

$view->render(); 

Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -