O'Reilly logo

Programming with CodeIgniter MVC by Yehuda Zadik, Eli Orr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing the libraries/helpers

As mentioned earlier, the CI PHP view file can access any of the CI resources, such as calling the CI helpers, libraries, or models in the same way the controller does.

The following is a more elaborated and complete example of a PHP CI view file, accessing CI resources, such as libraries/models/helpers:

<HTML> <?PHP // URI is a built-in CI library // if the rendering controller for this view was// http://mysite/myproject/mycontroller/test3 // the segment(1) = mycontroller – the controller name // the segment(2) = test3 - the controller method $the_controller = $this->uri->segment(1); $the_method = $this->uri->segment(2); ?> <H1>This View Rendered by Controller <?=$the_controller; ?> </H1> <H1>Using its method named ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required