0

I have a layout file and many controller for every job.

------------------------------
|   {menuController/index}    |
|                             |
-------------------------------
| {slideshowController/index} |
-------------------------------
|  {footerController/index}   |
-------------------------------

postController/index for show all post into home page.

menuController/index for show menu into top of home page.

... footerController,slideshowController and so on.

I will use same

{{postController/index}}
{{menuController/index}}
{{footerController/index}}

Inject to Html of Layout.php file.

footerController/index

that's call index function of footerController so return Html of View related to it.

I put in the Layout where appropriate. How do I do this?

Do you have another solution?

hamed hossani
  • 986
  • 2
  • 14
  • 33

2 Answers2

1

By using view method you can echo html content.

 <?php
         $data = $this->load->view('view_file', true) ;
  ?>
1
$this->load->library('../controllers/myothercontroller');

Then do this:

echo( $this->myothercontroller->function_name() );

that's answer me.

in function_name()

return  $this->ci->load->view ('myothercontroller/view',array ( 'item' => $items ),true);
hamed hossani
  • 986
  • 2
  • 14
  • 33
  • 2
    USE HMVC if you need to load controllers with in controllers. Normal MVC cannot do it. –  Mar 04 '17 at 21:55