CakePHP Girişi Düzeni

0 Cevap php

Benim Employee controller için bir giriş görünüm oluşturulur, ancak giriş görünüm işler olduğunda, bir düz beyaz sayfa (benim default.ctp değil düzeni) olarak gösterir.

I tried calling $this->layout = 'default'; from the login action,
but it sounds like that code will not execute until after the view has posted.

controllers/employee_controller.php

function login() {
    $this->layout = 'default';
}

views/layouts/default.ctp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title><?php echo $title_for_layout; ?></title>
        <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" type="text/css" href='<?php echo "css".DS."cake.generic.css" ?>' />
    </head>
    <body>
    <div id="parentDiv">
        <div id="menu">
            <div id="messages">
            </div>
        </div>
        <div id="header">
            <?= $this->element('search'); ?>
        </div>
        <div id="content">
            <?php echo $content_for_layout; ?>
        </div>
    </div>
    </body>
</html>

views/employees/login.ctp

<?= debug($this); ?>
<div>
    <div style="border: black solid 1px">
        <?php
        /*
         * To change this template, choose Tools | Templates
         * and open the template in the editor.
         */
        echo $this->Form->create('Employee', array('url' => array('controller' => 'employees', 'action' => 'login')));
        echo $this->Form->input('username');
        echo $this->Form->input('password');
        echo $this->Form->submit('Login');
        echo $this->Form->end();
        ?>
    </div>
</div>

0 Cevap