简体   繁体   English

同一个codeigniter安装中的多个应用程序共享相同的视图布局菜单

[英]Multiple applications in same codeigniter installation sharing same view layout menu

I am using a single codeigniter installation to host 2 applications. 我使用单个codeigniter安装来托管2个应用程序。 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 ? 例如,我可以在基础loisir视图中包含par自动文件夹中包含的布局,反之亦然? How ? 怎么样 ?

Create one menu.php on root folder 在根文件夹上创建一个menu.php

Now create one directory name ' common ' in view folder in both applications 现在在两个应用程序的视图文件夹中创建一个目录名称' common '

/application
 /view
  /common ( new directory )

Now create another menu.php in common directory and put following code 现在在公共目录中创建另一个menu.php并放入以下代码

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);?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM