I-AM-OBODO Posted March 19, 2012 Share Posted March 19, 2012 Hi, can i do an include in codeigniter? eg <?php include ‘menu.php’ ?> if possible, how can i achieve it. thanks Link to comment https://forums.phpfreaks.com/topic/259264-include-in-codeigniter/ Share on other sites More sharing options...
Mahngiel Posted March 19, 2012 Share Posted March 19, 2012 What are you attempting to do? Using INCLUDE() isn't going to be the way to do things. Link to comment https://forums.phpfreaks.com/topic/259264-include-in-codeigniter/#findComment-1329184 Share on other sites More sharing options...
chrsm Posted March 20, 2012 Share Posted March 20, 2012 Hi, can i do an include in codeigniter? eg <?php include ‘menu.php’ ?> if possible, how can i achieve it. thanks If it's a view ("template"), you'll want to use the "load" object inside the controller, for example: public function someAction() { $this->load->view('menu.php'); } If it is a "helper" or some kind of library, make sure it is in the right directory according to http://codeigniter.com/user_guide/libraries/loader.html. Link to comment https://forums.phpfreaks.com/topic/259264-include-in-codeigniter/#findComment-1329636 Share on other sites More sharing options...
Mahngiel Posted March 20, 2012 Share Posted March 20, 2012 public function someAction() { $this->load->view('menu.php'); } In CI, you do not use the file extension unless the file is not a php file Link to comment https://forums.phpfreaks.com/topic/259264-include-in-codeigniter/#findComment-1329646 Share on other sites More sharing options...
chrsm Posted March 21, 2012 Share Posted March 21, 2012 public function someAction() { $this->load->view('menu.php'); } In CI, you do not use the file extension unless the file is not a php file Ah, my bad. I was going with my memory, I haven't used CodeIgniter in a while =) Link to comment https://forums.phpfreaks.com/topic/259264-include-in-codeigniter/#findComment-1329731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.