Re: $this-Model-variable, read

2007-09-27 Thread Antonio Cortés
Try the FindBy[Field] method ;-)

  function profile($username) {
 $this-set('user', $this-User-findByUsername( $username ));
   }





2007/9/27, Travis [EMAIL PROTECTED]:


 I am trying to gather profile information in my users controller by
 using this function:

function profile($username) {
  $this-User-username = $username;
  $this-set('user', $this-User-read());
}

 However, when I visit http://localhost/users/profile/
 username_goes_here the query returns:

 SELECT `User`.`id`, `User`.`username`, `User`.`password`,
 `User`.`first_name`, `User`.`last_name` FROM `users` AS `User` WHERE
 `User`.`id` = 'username_goes_here' LIMIT 1

 How can I make it search for the username and not the ID?


 Antonio Cortés (Dr Zippie)

 El ordenador es la evolucion logica del hombre: Inteligencia sin moral:
 John Osborne.
 A nullo videbatur, ipse autem omnia videbat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



special helper

2007-09-26 Thread Antonio Cortés
Hi,

   I needed to generate contents (like a sidebar, a custom footer) in the
default layout (layout.ctp) outside $content_for_layout from the views.

   I just made a simple helper to solve this:



 ?php
 class BlockHelper extends Helper
 {
var $prefix = 'dataBlock';
function setValue( $key = '', $value = 'value' ) {
   $view = ClassRegistry::getObject('view');
   $view-viewVars[$this-prefix][$key] = $value  ;

  }
  function getValue( $key = '' , $defaulValue = '' ) {
$view = ClassRegistry::getObject('view');
 if  ( isset( $view-viewVars[$this-prefix][$key] ) ) {
 return $view-viewVars[$this-prefix][$key]  ;
} else {
 return  $defaultValue ;
}
}
 }
 ?


In the layout I use:



 echo $block-getValue( 'sidebar' ) ;



and in the views:


 // inside view posts/view


 $block-setValue ( 'sidebar', 'There isn't comments' );


// inside view contents/view


 $block-setValue ( 'sidebar', $this-requestAction('/contents/menu/1',
 array('return'))  );


[...]

I don't know if it is the best way to solve it. ¿ Any ideas ?





-- 

Antonio Cortés (Dr Zippie)

El ordenador es la evolucion logica del hombre: Inteligencia sin moral:
John Osborne.
A nullo videbatur, ipse autem omnia videbat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: json displaying data

2007-05-16 Thread Antonio Cortés
You must add

$this-layout = 'ajax';

inside method.

function grid_data() {

   $this-layout = 'ajax' ;
   [...]


-- 

Antonio Cortés (Dr Zippie)

El ordenador es la evolucion logica del hombre: Inteligencia sin moral:
John Osborne.
A nullo videbatur, ipse autem omnia videbat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Problems with the latest nightly MySql

2006-06-02 Thread Antonio Cortés

I got the same problem. It seems to be a problem with sessions,
changing session management from database to php it works.



2006/6/2, nate [EMAIL PROTECTED]:

 Are you getting any warnings from mysql_connect?


 



-- 

Antonio Cortés (Dr Zippie)

El ordenador es la evolucion logica del hombre: Inteligencia sin
moral: John Osborne.
A nullo videbatur, ipse autem omnia videbat

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake 
PHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---