我想将一个新模块实现到使用CI创建的站点中。我是CI的绝对新手,我无法弄清楚如何创建控制器和视图文件。我需要将新内容加载到当前网站的iframe中。到目前为止,我有:用于将页面加载到iframe中的CI控制器
控制器:
class Module extends Controller {
function __construct() {
parent::Controller();
}
function index() {
$this->common->loadView('module/module');
}
}
观点:
<iframe src="/new_module/index.php" width="100%" height="100%" scrolling="NO" frameborder="0" >An iframe capable browser is required to view this web site.</iframe>
路线:
$route['module/(:any)'] = "module/$1";
网站结构:
resources/
system/
....
new_module/
new_module/index.php
new_module/page1.php
new_module/page2.php
链接应该是:
http://mydomain.com/module/page1
http://mydomain.com/module/page2
链接在外面的iframe,内容应在iframe中加载。所以,iframe src应该动态改变。
很明显,它不起作用。可以有更多CI经验的人告诉我应该怎么做?
谢谢!
您的iframe源代码将是您最初展示的内容,新内容将由您的链接决定。你需要用你的链接''的TARGET属性来指定你的iframe'name =“myframe”'。 –
danneth