在CodeIgniter中添加新页面 [英] Adding A New Page In CodeIgniter

查看:77
本文介绍了在CodeIgniter中添加新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我对CodeIgniter和MVC系统的无知,我事先表示歉意。

I apologize in advance for my ignorance of CodeIgniter and the MVC system.

我正在通过其商务网站帮助一位家庭成员,到目前为止,我已经仅仅使用逻辑就能够完成大多数必需的更改,但是现在我已经走到了尽头。我不打算继续支持他们,因为我显然不是CodeIgniter专家。但是我希望该网站至少可以正常运行,以便他们可以开始使用它。

I'm helping a family member with their business website and up until now I've been able to complete most of the required changes just by using logic but now I've hit a dead end. I don't plan to continue supporting them as I'm obviously no CodeIgniter expert. But I'm hoping to leave the website at least functional, so that they can start using it.

我只是想在网站内创建一个新的页面,但是似乎不可能。如果我能做到这一点,我想我可以自己解决所有其他问题。

I simply want to create a new "page" within the website but it seems impossible. If I can achieve this I think I can figure everything else out on my own.

例如,我目前有一个页面,显示已取消的工作。它链接到的导航HTML是这样的:

For example I currently have a "page" for Cancelled Jobs. It the navigation HTML it is linked to like this:

http://localhost/admin/modules/cancelled_jobs

并在此处具有相应的文件:admin / application / controllers / cancelled_jobs.php

and has a corresponding file here: admin/application/controllers/cancelled_jobs.php

其中包含以下php代码:

which contains this php code:

class Cancelled_jobs extends CIID_Controller {


    public function __construct()

    {       

        parent::__construct();

        $this->set_table('job', 'Cancelled Job', 'Cancelled Jobs');

        $this->allow_delete = false;
        $this->allow_cancel = false;
        $this->allow_edit = false;
        $this->allow_reactivate = true;
        $this->allow_add = false;

        $this->overview
            ->add_item('Job No', 'active', 'job_id')
            ->add_item('Client', 'active|relationship', 'client.name')
            ->add_item('Name', 'active', 'name')
            ->add_item('Status', 'active|relationship', 'job_status.name')
            ->add_item('Assignee', 'active|relationship', 'team_member.name')
            ->add_item('Scheduled Date', 'active', 'scheduled_date')

            ->where("job.cancel_job = '1'")
            ->order_by('job.created_date DESC');

        $this->init();

    }


}

我想创建一个名为已关闭的工作的新页面。

I would like to create a new "page" called Closed Jobs.

我尝试复制admin / application / controllers / cancelled_jobs.php并将其重命名为closed_jobs.php,并将第一行代码更改为:

I've tried copying admin/application/controllers/cancelled_jobs.php and renaming it closed_jobs.php and changing the first line of code to read:

class Closed_jobs extends CIID_Controller {

然后我在导航HTML中添加链接:

I then add a link in the navigation HTML:

http://localhost/admin/modules/closed_jobs

但是,单击时只会导致 404页面未找到错误。

However, when clicked, this only results in a "404 Page Not Found" error.

有人可以指出我在创建新页面的过程中缺少什么吗?

Can anyone point out what I'm missing in the process of creating a new page?

推荐答案

通常,CodeIgniter URL结构为:

Generally, CodeIgniter URLstructure is:

sitename.com/controller_name/function_name/parameter_1/parameter_2/parameter_3/

您可以根据需要添加任意数量的参数。

You can add as many parameters as you want.

要访问

模块/封闭式作业

在控制器 mo中添加新功能dules

function closed_jobs() {
  $this->load->view('closed_jobs');
}

并创建视图 closed_jobs.php

应用程序/视图中

cancelled_jobs

这篇关于在CodeIgniter中添加新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆