Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple applications in same codeigniter installation sharing same view layout menu

I am using a single codeigniter installation to host 2 applications. But my problem is to share the same menu at the top of the page for both application. With my actual files structure, I don't know how to have the same header or menu for both application. Here is my actual structure :

system
application
--base_loisirs (folder application of base loisirs)
base_loisir.php (with $application_folder = 'application/base_loisirs';)
--parc_auto (folder application of parc auto)
parc_auto.php (with $application_folder = 'application/parc_auto';)

The folder application contain all the folders of different folders application. Is it possible for me in the base loisir view for example, to include a layout included in the par auto folder or vice versa ? How ?

like image 929
pollux1er Avatar asked Aug 11 '26 20:08

pollux1er


1 Answers

Create one menu.php on root folder

Now create one directory name 'common' in view folder in both applications

/application
 /view
  /common ( new directory )

Now create another menu.php in common directory and put following code

require($_SERVER['DOCUMENT_ROOT'].'/menu.php');

Now load menu in any file of view using following code

<?php echo $this->load->view('common/menu', '', TRUE);?>
like image 54
Hardik Raval Avatar answered Aug 14 '26 11:08

Hardik Raval



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!