Search Results

Search found 2 results on 1 pages for 'sipiatti'.

Page 1/1 | 1 

  • How to set the content of the $script_for_layout in cakephp?

    - by sipiatti
    Hi, I am learning cakephp in an autodidact manner and I am a complete newbie :) I am creating a simple application. Some logic work so now I going to dive into designing views and layouts. I read the docs and the tutorial but I could not find where to set the content of $script_for_layout. Especially I want to set a $html-css to create link in pages to the stylesheet. I found out that I could do it in directly in the layout template but I would like to create the same link in all pages/views/layouts to the stylesheet so I hope there is a simple way, and avoid to do this in all layouts and/or controllers

    Read the article

  • Is there a better way to change user password in cakephp using Auth?

    - by sipiatti
    Hi, I am learning cakephp by myself. I tried to create a user controller with a changepassword function. It works, but I am not sure if this is the best way, and I could not googled up useful tutorials on this. Here is my code: class UsersController extends AppController { var $name = 'Users'; function login() { } function logout() { $this->redirect($this->Auth->logout()); } function changepassword() { $session=$this->Session->read(); $id=$session['Auth']['User']['id']; $user=$this->User->find('first',array('conditions' => array('id' => $id))); $this->set('user',$user); if (!empty($this->data)) { if ($this->Auth->password($this->data['User']['password'])==$user['User']['password']) { if ($this->data['User']['passwordn']==$this->data['User']['password2']) { // Passwords match, continue processing $data=$this->data; $this->data=$user; $this->data['User']['password']=$this->Auth->password($data['User']['passwordn']); $this->User->id=$id; $this->User->save($this->data); $this->Session->setFlash('Password changed.'); $this->redirect(array('controller'=>'Toners','action' => 'index')); } else { $this->Session->setFlash('New passwords differ.'); } } else { $this->Session->setFlash('Typed passwords did not match.'); } } } } password is the old password, passwordn is the new one, password2 is the new one retyped. Is there any other, more coomon way to do it in cake?

    Read the article

1