div标签未显示在codeigniter查看器中

时间:2014-11-05 17:22:10

标签: php codeigniter viewer

我是CI的新手,在尝试显示简单的登录表单时对2个问题感到困惑......

控制器:

function login()
    {
        $this->data['title'] = "Login";
        // render the header
        $data['css'] = 'login.css';
        $this->load->view('layouts/header', $data);

        //validate form input
        $this->form_validation->set_rules('identity', 'Identity', 'required');
        $this->form_validation->set_rules('password', 'Password', 'required');

        //the user is not logging in so display the login page
        //set the flash data error message if there is one
        $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');

        $this->data['identity'] = array('name' => 'identity',
            'id' => 'identity',
            'type' => 'text',
            'required' => 'required',
            'value' => $this->form_validation->set_value('identity'),
        );
        $this->data['password'] = array('name' => 'password',
            'id' => 'password',
            'required' => 'required',
            'type' => 'password',
        );
        //$this->load->template('login');
        $this->load->view('auth/login', $this->data);
    }
    // render the footer
    $this->load->view('layouts/footer');
}

这是我的查看器(auth / login.php):

<div class="container">
    <div class="form-signin">
        <h1>Login</h1>
        <p>Please login with your email/username and password below.</p>

        <div id="infoMessage"><?php echo $message;?></div>

        <?php
        $attributes = array('class' => 'form-signin', 'id' => 'form-signin');
        echo form_open('auth/login', $attributes);
        ?>

          <p>
            <label for="identity">Email/Username:</label>
            <?php echo form_input($identity);?>
          </p>

          <p>
            <label for="password">Password:</label>
            <?php echo form_input($password);?>
          </p>

          <p>
            <label for="remember">Remember Me:</label>
            <?php echo form_checkbox('remember', '1', FALSE, 'id="remember"');?>
          </p>


          <p><?php echo form_submit('submit', 'Login');?></p>

        <?php echo form_close();?>

        <p><a href="forgot_password">Forgot your password?</a></p>
    </div>
</div>

当我在浏览器中查看页面源代码时,表单没有将“class”属性设置为“form-signin”(我无法弄清楚为什么?)。这就是为什么我试图添加一个DIV来保存表单但是在页面源中也找不到div ....任何建议都将受到高度赞赏。

0 个答案:

没有答案