我已经安装了全新的 codeigniter 2x 和模块化扩展(https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home)
这是我第一次使用 HMVC,从 MVC 迁移到 HMVC 的决定是为了让自己能够更好地控制我的登录、管理和成员区域。
我已经像这样在 HMVC 中创建了我的第一个控制器....
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends MX_Controller {
function __construct()
{
parent::__construct();
$this->load->model('Content_model');
}
public function index()
{
$this->load->view('includes/template');
}
}
和像这样的观点:
<?php echo doctype(); ?>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pagecontent['seo_title']; ?></title>
<meta name="description" content="<?php echo $pagecontent['seo_description']; ?>" />
<meta name="keywords" content="<?php echo $pagecontent['seo_keywords']; ?>" />
<meta name='robots' content='all' />
<link rel="icon" type="image/ico" href="<?php echo base_url("images/favicon.png"); ?>" />
<?php echo link_tag('css/style.css'); ?>
<script type="text/javascript" language="javascipt" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url("js/jquery.validate.min.js"); ?>"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url("js/main.js"); ?>"></script>
</head>
<body>
<?php $this->load->view('includes/notify'); ?>
<div id="topbar">
<?php $this->load->view('includes/topbar'); ?>
当我尝试在浏览器中查看页面时,出现以下错误:
Fatal error: Call to undefined function doctype() in C:\xampp\htdocs\mintfifty\application\modules\site\views\includes\template.php on line 1
该代码在我以前的所有 codeigniter (mvc) 项目中都有效,但在 (hmvc) 中无效,为什么它在 HMVC 中无效?我究竟做错了什么?