3

Connection to cake does not work

 3 years ago
source link: https://www.codesd.com/item/connection-to-cake-does-not-work.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Connection to cake does not work

advertisements

I have a litle problem with my app in cakephp because i need to do a login page. I try to force it with a diferent css.

This is my default.php in view layouts.

                    <ul>
                        <li>
                            <?php
                                echo $this->Html->link('<p>Login</p>',
                                    array('controller'=>'users','action'=>'login'),
                                    array('class' => 'parent', 'escape'=> false)
                                    );
                            ?>
                        </li>
                    </ul>

And i have this layout for login page.

<?php
  echo $this->Html->css('login');
?>

In route.php i have this:

Router::connect('/login', array('controller' => 'users', 'action' => 'login'));

With all of this the login page Keep white page.

Can you help me please?


to set layout: you need to set the layout inside your login action in User controller

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

//in your login layout
echo $this->fetch('content');

this line is to set your css

echo $this->Html->css('login');

Even though I am not sure if you have created your login layout here: app/View/Layouts/login.ctp

Tags cakephp

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK