Re: URLs estranhas, outra vez

2007-12-10 Thread Josenivaldo Benito Junior
Bom dia Dérico,

Então, eu digitei o comando de cabeça, não foi copy and paste mas, te
garante que no código está correto. Foi uma das primeiras coisas que
chequei.

De qualquer forma, ao clicar no link ruim o Cake reclama e diz que não
existe um controller chamado pages, ou seja, por pior que estivesse escrito
register teria que reclamar da falta dele. Pages não é um controller
mesmo, é o diretório onde colocam-se as páginas do cake, como home.ctp.

Todas as URLs geradas dentro dos controller estão 100% ok, a URL gerada
dentro home está estranha.

Alguma luz?

Obrigado.
Benito.

On 12/8/07, Dérico Filho [EMAIL PROTECTED] wrote:


 pode parece um pouco frívolo...

 mas cadê o s entre i o t na linha
 $html-link(meu querido link que não funciona,/regiters);


 On 7 Dez, 18:35, Josenivaldo Benito Junior [EMAIL PROTECTED]
 wrote:
  Olá Galera,
 
  Comecei a ter problemas com URLs novamente, mas agora é no home.ctp
 
  Alterei o home.ctp para conter o seguinte link:
 
  $html-link(meu querido link que não funciona,/regiters);
 
  Eu presumo que isso deveria gerar um link para:
 
  http://meu_servidor/registers(ou seja, um link para o controller
 registers)
 
  Mas gera:
 
  http://meu_servidor/pages/registers
 
  Os links gerados dentro das views estão perfeitos!
  Alguma luz?
 
  Abraço,
  Benito.
 


--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Re: Falha de CSS no CAKE

2007-12-10 Thread Bráulio Machado Campos
Só por curiosidade :

Não está faltando um ; (ponto e vírgula) na última instrução em  display:
block ; ?

a.principal{
 font-family: arial;
 font-size: 11px;
 text-transform: capitalize;
 color: #FF;
 left: 15px;
 text-decoration: none;
 display: block ;
}



E pelas dicas acima, limpe o cache e use o firebug ! Também, uma que
aprendi, leia novamente o código !  ;-)


At +!

--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



redirecionamento do othAuth para noaccess_page

2007-12-10 Thread igor_rj

Blz grupo??
Estou com o seguinte problema no componente othAuth:
Após logar , caso o usuário tente acessar alguma funcionalidade a qual
ele não tenha permissão, ao invés dele ser redirecionado para a página
de noacces ele esta indo para a página de login.

Alguém pode me dar uma ajuda??

valeu abs.
igor
--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Re: redirecionamento do othAuth para noaccess_page

2007-12-10 Thread DJ Spark

por favor, mande mais alguns dados, como seu codigo, as versoes que vc
estah usando, etc

On Dec 10, 2007 1:55 PM, igor_rj [EMAIL PROTECTED] wrote:

 Blz grupo??
 Estou com o seguinte problema no componente othAuth:
 Após logar , caso o usuário tente acessar alguma funcionalidade a qual
 ele não tenha permissão, ao invés dele ser redirecionado para a página
 de noacces ele esta indo para a página de login.

 Alguém pode me dar uma ajuda??

 valeu abs.
 igor
 




-- 
[livesets] http://djspark.com.br/
[web] http://sydi.net
[filmes] http://melhoresfilmes.com.br

--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Estrutura de diretórios

2007-12-10 Thread Juan Basso

Pessoal,

Minha empresa desenvolve diversos softwares e eu estava querendo
migrar para utilizar o modelo Cake. Porém, fica uma dúvida: Todas as
aplicações compartilham coisas em comum, por exemplo os CSS, algumas
formas de apresentar tabelas (elements), alguns objetos para abrir
janelas (layers) em javascript (helpers), forma de comunicação com a
parte de modelagem (datasource - aqui eu uso sempre XML-RPC, não uso
dbo datasource), etc.

O problema é como eu organizaria isso? Faria cada aplicação uma pasta
nova e replicaria as coisas em comum? Mas e a manutenção?

Pensei em fazer algo como um framework que utilizasse o Cake como
engine hehe, ou seja, utilizo o Cake e dentro de app coloco toda a
parte comum das aplicações e dentro de plugins ficariam as aplicações.
O que acham? O problema é que as aplicações ainda podem ter plugins e
estes eu gostaria que fossem plug  play, ou seja, colocando no
diretório plugins a aplicação já entenda que é para carregá-los.

Outra idéia seria modificar o framework do Cake, mas isso é mais
custoso na parte de manutenção, pois a cada alteração do Cake eu teria
que ficar comparando e atualizando a mão, ou um merge meio fajuto e
cuidadoso. Com esse framework alterado, eu colocaria ele dentro da
path do php, onde as aplicações rodariam direto.

O que acham? Já passaram por isso? Têm alguma sugestão?


Juan Basso
--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Re: URLs estranhas, outra vez

2007-12-10 Thread Dérico Filho

Humn, você está usando rotas especiais?

Pois na verdade há um controller pages, que vem embutido no CakePHP,
só que vc vai encontrar ele no diretório /cake e não no /app.

Bom, eu dei uma olhada no api.cakephp.org... Acho que o problema está
no fato que ele espera uma das três condições:

1o. Um endereço começando com http:// - que ele irá tratar de forma
absoluta.
2o. Uma mudança de método dentro de um controller - quando o endereço
possui uma barra, com somente um item, exemplo: /registers
3o. Uma mudança de método para outro controller - quando o endereço
possui ao menos uma barra, com uma expressão antes e depois: /
registers/index

Abraços,

Dérico


On 10 dez, 11:31, Josenivaldo Benito Junior [EMAIL PROTECTED]
wrote:
 Bom dia Dérico,

 Então, eu digitei o comando de cabeça, não foi copy and paste mas, te
 garante que no código está correto. Foi uma das primeiras coisas que
 chequei.

 De qualquer forma, ao clicar no link ruim o Cake reclama e diz que não
 existe um controller chamado pages, ou seja, por pior que estivesse escrito
 register teria que reclamar da falta dele. Pages não é um controller
 mesmo, é o diretório onde colocam-se as páginas do cake, como home.ctp.

 Todas as URLs geradas dentro dos controller estão 100% ok, a URL gerada
 dentro home está estranha.

 Alguma luz?

 Obrigado.
 Benito.

 On 12/8/07, Dérico Filho [EMAIL PROTECTED] wrote:





  pode parece um pouco frívolo...

  mas cadê o s entre i o t na linha
  $html-link(meu querido link que não funciona,/regiters);

  On 7 Dez, 18:35, Josenivaldo Benito Junior [EMAIL PROTECTED]
  wrote:
   Olá Galera,

   Comecei a ter problemas com URLs novamente, mas agora é no home.ctp

   Alterei o home.ctp para conter o seguinte link:

   $html-link(meu querido link que não funciona,/regiters);

   Eu presumo que isso deveria gerar um link para:

  http://meu_servidor/registers(ouseja, um link para o controller
  registers)

   Mas gera:

  http://meu_servidor/pages/registers

   Os links gerados dentro das views estão perfeitos!
   Alguma luz?

   Abraço,
   Benito.- Ocultar texto entre aspas -

 - Mostrar texto entre aspas -
--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Re: Duplicidade de servidores

2007-12-10 Thread Josenivaldo Benito Junior
Olá, o meu ficou assim:

#switch between configs
function __construct() {

#wildcard the subdomains
$host_r = explode('.', $_SERVER['SERVER_NAME']);
// unnecessary line
//if(count($host_r)2) while(count($host_r)2)array_shift($host_r);
$mainhost = implode('.', $host_r);

#switch between servers
switch(strtolower($mainhost)) {
case 'sistemas.gbvudx.qsl.br':
$this-default = $this-default;
break;
case 'localhost1':
$this-default = $this-test;
break;
case 'localhost':
$this-default = $this-test;
break;
default:
$this-default = $this-test;
}

}

Copiei de um dica e fiz as alterações devidas. Funciona 100% também.

$this-default e $this-test

São arrays para cada uma das configurações (poderiam haver N).

Para compatibilidade com PHP4 (meu caso) acrescentar:

#php 4 compatibility
function DATABASE_CONFIG() {
$this-__construct();
}

Abraço,
Benito

On 12/7/07, Juan Basso [EMAIL PROTECTED] wrote:


 Boa a tática. :) (PS: Eu sempre me esqueço que DATABASE_CONFIG é uma
 classe, sempre acho que é um Array, não sei porquê... hehehe)

 Só uma sugestão no código, substitua:
 $oldDebugLevel = error_reporting(0);
 $link = mysql_connect($this-users['host'], $this-users['login'],
 $this-users['password']);
 error_reporting($oldDebugLevel);


 por:
 $link = @mysql_connect($this-users['host'], $this-users['login'],
 $this-users['password']);


 O arroba na frente das funções serve para fazer o que você fez com o
 error_reporting. :)


 Juan Basso


 HR escreveu:

  Funcionou como m�gica... A gente fica t�o dentro do framework que
  esquecemos q estamos trabalhando com PHP :-)
 
  Na classe DATABASE_CONFIG em app/config/database.php:
  1. Tenho 3 configura��es:
 - default: local
 - users: servidor de usuarios
 - users_backup: retundancia do servidor de usuarios
 
  2. Inclu� as fun��es:
function __construct() {
if(!$this-usersIsOnline()){
$this-users= $this-users_backup;
}
}
 
function usersIsOnline(){
$oldDebugLevel = error_reporting(0);
$link = mysql_connect($this-users['host'],
$this-users['login'], $this-users['password']);
error_reporting($oldDebugLevel);
 
if (!$link) {
return false;
} else {
mysql_close($link);
return true;
}
}
 
  Valeu,
  HR
 
  On 5 dez, 13:46, Josenivaldo Benito Junior [EMAIL PROTECTED]
  wrote:
   N�o sei se entendi direito mas, no database.php do cake voc�,
 provavelmente
   est� selecionando entre uma das configura��es certo?
  
   Fa�a uma fun��o ali (m�todo construtor ou qualquer coisa que seja
 executada
   ali) que teste qual server est� dispon�vel.
  
   On 12/5/07, HR [EMAIL PROTECTED] wrote:
Tenho um sistema que usa 2 configura��es de banco de dados, uma
 local
e outra em outro servidor usada somente para login e profile. At� a�
tudo bem.
  
Algu�m sabe como podemos proceder para que se este servidor externo
(usuarios.xxx.com) estiver fora do ar, o sistema use um outro
 servidor
(usuarios2.xxx.com)?
 


--~--~-~--~~~---~--~~
Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do 
Grupos Google.
 Para enviar mensagens para este grupo, envie um email para 
cake-php-pt@googlegroups.com
 Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED]
 Para mais opções, visite este grupo em 
http://groups.google.com/group/cake-php-pt?hl=pt-PT
-~--~~~~--~~--~--~---



Re: versions of CakePHP - How to locate

2007-12-10 Thread Howard Glynn
I doubt you will be able to see that URL via the browser as the trailing
@5875 is special to SVN when accessing particular versions via command line
etc I think

Try  https://svn.cakephp.org/repo/trunk/cake/1.2.x.x/

This will almost certainly show you the bleeding edge code (~6139?)

Alternatively, if you really just want the latest recommended version, just
go to the Downloads section of the website and pull the zip file from
there.

http://www.cakephp.org/downloads/


On Dec 9, 2007 7:25 PM, sum1kul [EMAIL PROTECTED] wrote:


 Thank you all.

 I tried to browse to 5875 revision (using TortoiseSVN), and got this
 error:
 Error * 'https://svn.cakephp.org/repo/trunk/cake/1.2.x.x/[EMAIL PROTECTED]'
 non-existence in that revision

 Also tried via web browser and got a 404 error page.

 Anything I missed?



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Why my observeField does not work properly?

2007-12-10 Thread Steveston

In view:

 ?php
echo $html-input('User/username', array('id'='username',
'size'='50'));
echo $html-tagErrorMsg('User/username', 'User name must unique 
and
contain at least 5 and no more than 8 chars');
?
div id=err
?php
echo $ajax-observeField('username', array('update'='err',
'url'=/users/checkduplicate, 'frequency'=1));
 ?
 /div

In controller:

function checkduplicate()
{
$this-layout='ajax';
$this-autoRender=false;
$condition=array('username'=$this-data['User']['username']);
if (!empty($this-data['User']['username']))
{
 $a=$this-User-find($condition);
 if (!empty($a)); //I also tried isset, isset  !empty
 echo $this-data['User']['username'].: Duplicate Entry;
}
}

Whenever I enter some value in username text field, I always get the
message that:  :Duplicate Entry, even the entry does not exist in
db.

Why?
--~--~-~--~~~---~--~~
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: One form with two submit buttons

2007-12-10 Thread websta*

No worries, you can of course give your submits a cake like name
data[Model][submit] or some such, and it'll come through in your data array.
From there logic could be shifted to your model or some such even. Options
are endless.

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
Of Arne-Kolja Bachstein
Sent: Monday, 10 December 2007 7:59 p.m.
To: Cake PHP
Subject: Re: One form with two submit buttons


Hi websta,

thanks, that did the trick. Didnt notice the submit button doesn't
need a cake style predefined name, so its been quite obvious I think.
But now with your help it works, thanks :-)

Bye

Arne

On Dec 10, 4:21 am, websta* [EMAIL PROTECTED]
wrote:
 Pretty straight forward, name your submit buttons (my example uses form
 helper format)

 echo $form-create());
 echo $form-input('query');
 echo $form-submit('Submit A',array('name'='sa'));
 echo $form-submit('Submit B',array('name'='sb'));
 echo $form-end();

 then in your controller you can pick up which submit has been hit by
 checking the Controller::params['form'].

 Add this in your controller method and you'll get what I mean.

 function my_method(){
 if(!empty($this-data)){
 pr($this-params);
 }

 }

 So you can go:

 if(!empty($this-data)){
 if(isset($this-params['form']['sa'])){
 $searchField = 'field_a';
 }elseif(isset($this-params['form']['sb'])){
 $searchField = 'field_b';
 }

 ... do search

 }

 or something similar.

 There of course a many of ways of doing this but that's a start for ya.

 HTH.

 -Original Message-
 From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf

 Of Arne-Kolja Bachstein
 Sent: Sunday, 9 December 2007 6:24 p.m.
 To: Cake PHP
 Subject: One form with two submit buttons

 Hi,

 I have to implement a search form like

 form
 input type=text /
 input type=submit value=Search for phrase in A /
 input type=submit value=Search for phrase in B /
 /form

 How could I do this the cake way, is there any option? I cannot
 imagine atm how to do this at all, but maybe someone out there has a
 clue...

 Thanks in advance

 Arne

 __ NOD32 2711 (20071207) Information __

 This message was checked by NOD32 antivirus system.http://www.eset.com



__ NOD32 2712 (20071209) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake and JSON.

2007-12-10 Thread kchopein

Hi!!

First of all, thanks for the work!

I'm trying to use the JSON component with the Dojo Toolkit but I'm
having a problem: the generated json code includes the model level,
and I only need the data. I mean, I'm getting this:


{timestamp:1193692111, items:[
{Post:{id:1,title:The title,body:This is the post
body.,created:2007-11-07 00:44:54}},
{Post:{id:2,title:A title once again,body:And the post
body follows.,created:2007-11-07 00:45:15}},
{Post:{id:3,title:Title strikes back,body:This is really
exciting! Not.,created:2007-11-07 00:45:44}},
{Post:
{id:4,title:aa,body:aadadasdas,created:2007-11-12
10:00:45}}
]}

but I need something like this:


{timestamp:1193692111, items:[
{id:1,title:The title,body:This
is ...,created:2007-11-07 00:44:54},
{id:2,title:A title once
again,body:And ...,created:2007-11-07 00:45:15}
]}

Since I'm a Cake newbe I don't know if there's a way to do this or if
I have to do it myself. How do you solve this?

Thanks in advance!!

--~--~-~--~~~---~--~~
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: set a date on default.ctp, on all pages?

2007-12-10 Thread grigri

Try putting your $this-set(...) inside AppController::beforeFilter()
or AppController::beforeRender()

On Dec 10, 6:18 am, Louie Miranda [EMAIL PROTECTED] wrote:
 Simply replace

  ?php echo $date; ?

 To (on view -- default.ctp) 1.2.x

  ?php echo date('r'); ?

 Solved!

 On Dec 10, 2007 2:03 PM, Louie Miranda [EMAIL PROTECTED] wrote:



  I have added this on one of my controller for function index()

   $this-set('date', date(r));

  And added

  ?php echo $date; ?

  On /app/views/layout/default.ctp

  It works only on that controller, and when i go to other pages. Obviously,
  i would add $this-set('date', date(r)); this for all to be able to work.
  Is there like a global preference for this kind of things? It would be
  tiring to set this for all of my controllers and functions.

  Thanks
  --
  Louie Miranda ([EMAIL PROTECTED])
 http://www.axishift.com

  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)

 --
 Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com

 Security Is A Series Of Well-Defined Steps
 chmod -R 0 / ; and smile :)
--~--~-~--~~~---~--~~
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: Why my observeField does not work properly?

2007-12-10 Thread francky06l

 if (!empty($a)); //I also tried isset, isset  !empty

Is the semi column here a typo ? If not this explains the origin of
your problem

On Dec 10, 10:29 am, Steveston [EMAIL PROTECTED] wrote:
 In view:

  ?php
 echo $html-input('User/username', array('id'='username',
 'size'='50'));
 echo $html-tagErrorMsg('User/username', 'User name must 
 unique and
 contain at least 5 and no more than 8 chars');
 ?
 div id=err
 ?php
 echo $ajax-observeField('username', array('update'='err',
 'url'=/users/checkduplicate, 'frequency'=1));
  ?
  /div

 In controller:

 function checkduplicate()
 {
 $this-layout='ajax';
 $this-autoRender=false;
 $condition=array('username'=$this-data['User']['username']);
 if (!empty($this-data['User']['username']))
 {
  $a=$this-User-find($condition);
  if (!empty($a)); //I also tried isset, isset  !empty
  echo $this-data['User']['username'].: Duplicate Entry;
 }
 }

 Whenever I enter some value in username text field, I always get the
 message that:  :Duplicate Entry, even the entry does not exist in
 db.

 Why?
--~--~-~--~~~---~--~~
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: Obtain all elements of multiple select

2007-12-10 Thread dandreta



On 6 dic, 19:19, dandreta [EMAIL PROTECTED] wrote:
 I have an HABTM relation  between ModelA and ModelB.
 In the add view of A, I have created two lists, one with all B
 elements of the database and other one empty . I pass elements of the
 first list to the second one with javascript and the second list will
 contain the B elements that will be related to the A element which I
 am creating. The problem is that in order that the controller obtains
 the B elements of the second list I must select with the mouse. Then
 it saves the relations ok.
 But, anyone knows how I can achieve that the elements of the second
 list do not have to be selected or that always they are selected
 without having to do it with the mouse?

 Any suggestion or help?
 I hope you can help me.
 Thanks and regards
--~--~-~--~~~---~--~~
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: CURRENT_TIMESTAMP in findall

2007-12-10 Thread Adam Royle

This is something that I've also wondered about in the past so if
anyone has better ideas please let me know. The way I do it is just
use a string condition (or combination of array and string
conditions).

$continent =  $this-mymodel-findAll(mymodel.start_time  = NOW()
AND mymodel.end_time  NOW(), null, null, null, 0, 1);

Cheers,
Adam

On Dec 9, 7:39 pm, Cristian Vrabie [EMAIL PROTECTED]
wrote:
 If i use something like the find below, it will issue wrong results because
 CURRENT_TIMESTAMP it will be wrapped in single quotes as a string. I know
 that CURRENT_TIMESTAMP is not available on all db sources, but as i'm
 interested only in mysql and oracle (that do support), can't i do something
 so that cake won't interpret it as a string?

 $continent = $this-mymodel-findAll(
 array ('`mymodel`.`start_time`' = '=
 CURRENT_TIMESTAMP',
  '`mymodel`.`end_time`' = '
 CURRENT_TIMESTAMP' ),
 null, null, null, 0, 1
 );
--~--~-~--~~~---~--~~
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: Cake and JSON.

2007-12-10 Thread hydra12

Try this (works in 1.2):

First, put all of your data into a variable, for instance if your
model is called items:

$items = $this-Item-findAll();
$timestamp = 1193692111; // put your timestamp here
$itemArray = Set::extract($items, '{n}.Item');
$this-set('items','{timestamp:'.
$timestamp.',items:'.json_encode($itemArray).'}');

Note - I haven't tested this, but it's modified from code I use for
ExtJS.  I blogged about it here: http://www.ntatd.org/mark/?p=29
(shameless plug).  Make sure to check the value of items as sent to
your view to make sure all the [ and ] are in the right place.

hydra12

On Dec 10, 3:41 am, kchopein [EMAIL PROTECTED] wrote:
 Hi!!

 First of all, thanks for the work!

 I'm trying to use the JSON component with the Dojo Toolkit but I'm
 having a problem: the generated json code includes the model level,
 and I only need the data. I mean, I'm getting this:

 {timestamp:1193692111, items:[
 {Post:{id:1,title:The title,body:This is the post
 body.,created:2007-11-07 00:44:54}},
 {Post:{id:2,title:A title once again,body:And the post
 body follows.,created:2007-11-07 00:45:15}},
 {Post:{id:3,title:Title strikes back,body:This is really
 exciting! Not.,created:2007-11-07 00:45:44}},
 {Post:
 {id:4,title:aa,body:aadadasdas,created:2007-11-12
 10:00:45}}
 ]}

 but I need something like this:

 {timestamp:1193692111, items:[
 {id:1,title:The title,body:This
 is ...,created:2007-11-07 00:44:54},
 {id:2,title:A title once
 again,body:And ...,created:2007-11-07 00:45:15}
 ]}

 Since I'm a Cake newbe I don't know if there's a way to do this or if
 I have to do it myself. How do you solve this?

 Thanks in advance!!
--~--~-~--~~~---~--~~
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: Selective Recursive Find

2007-12-10 Thread Serge Rodovnichenko

For Cake 1.2 take a look at Containable behaviour
http://www.thinkingphp.org/2007/06/14/containable-20-beta/ or Bindable
behaviour (I prefer it! :-) : http://cake-syrup.sourceforge.net/

For cake 1.1 search this group for keyword 'expects' :-)

On Dec 10, 4:24 pm, Baz [EMAIL PROTECTED] wrote:
 I have a simple question (I think).

 I have a model (Requests), which has a lot of relationships including 3
 belongsTo (Equipment, Classroom, Department).
 The Classroom model has a belongsTo (Building).

 I'm doing a findAll/paginate in the Request controller with
 $this-Request-recursive = 1 and get MOST of what I need. However, I'm
 trying to tack onto that, the Building reference.

 I've tried this:
 $this-Request-Classroom-recursive = 2;

 To just set the recursive set to 2 on the Classroom model only (Doesn't
 work).

 I've tried doing a $this-Request-Classroom-bindModel(.)
 Doesn't work.

 What does work is:
 $this-Request-recursive = 2, however I get a whole recursive mess on the
 other models (Eqiupment, Department). Then I have to go unbind ALL the other
 stuff I don't need.

 Is there a shortcut here? I just wanna change the recursiveness on ONE
 associated model.

 Please ask for details if I'm unclear:
 --
 Baz L
 Web Development 2.0: Web Design, CakePHP, 
 Javascripthttp://www.WebDevelopment2.com/
--~--~-~--~~~---~--~~
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: set a date on default.ctp, on all pages?

2007-12-10 Thread abstract

or, if You need to place in all views something more sophisticated,
You can add
$this-set(...) to beforeFilter in app_controller

On Dec 10, 7:03 am, Louie Miranda [EMAIL PROTECTED] wrote:
 I have added this on one of my controller for function index()

  $this-set('date', date(r));

 And added

 ?php echo $date; ?



 On /app/views/layout/default.ctp

 It works only on that controller, and when i go to other pages. Obviously, i
 would add $this-set('date', date(r)); this for all to be able to work.
 Is there like a global preference for this kind of things? It would be
 tiring to set this for all of my controllers and functions.

 Thanks
 --
 Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com

 Security Is A Series Of Well-Defined Steps
 chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: Obtain all elements of multiple select

2007-12-10 Thread dr. Hannibal Lecter

On Dec 9, 4:45 pm, dandreta [EMAIL PROTECTED] wrote:
 Thanks for your response.
 But I dont understand how I can do this.
 Can you explain me, please?
 Regards

I'm assuming you're using javascript for item switching, so setting
select.options[index].selected to true would do the trick.
There is more info here: http://www.mredkj.com/tutorials/tutorial003.html

Hope that helps,
dr. H.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Problem sessions

2007-12-10 Thread inver

Hello, before a write in this group I read all literature about
sessions problem in 1.1.18.5850 version. Well, I change in config.php
the CAKE_SECURITY to medium, but my data session lost, this happen in
'database', 'cake' and 'php' mode for session.
checkout my cakephp version in CVS but it does not work.
my server is a secure server https://

what's happen ?
some idea ?

sorry for my horribilus english

--~--~-~--~~~---~--~~
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: saving multiple foreign keys in one field

2007-12-10 Thread dr. Hannibal Lecter

 I know the right approach for something like this is the HABTM, but I
 really need to just store the selected options in a single database
 field.

Well, it is true that that you should have a proper many-to-many DB
implementation, but if you REALLY want to hack it like that...

All you need to do is create a multivalue select input. After that
it's only a matter of hacking: your field will be (for example) comma-
separated, so all you need to do is split and join selected values and
select them in the view / insert them in the database.

Hope that helps,
dr. H.

--~--~-~--~~~---~--~~
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: Login box

2007-12-10 Thread dr. Hannibal Lecter

Elements are the way to go, just create the loginbox element and
optionbox element and switch them depending on user presence.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



views without controllers

2007-12-10 Thread boris

Hi. I am new to CakePHP and would be thankful for help:

I'm creating a social networking website. Suppose I want to create a
profile page, which displays a user's data. The view would be app/
views/users/profile.php and there would be a controller app/
controllers/users_controller.php with a profile() function (i.e.
action).

What if I want to create a homepage? I don't want this homepage to be
under app/views/users and have a corresponding homepage() function is
app/controllers/users_controller.php. I want the homepage to have
access to data from the 'users' table (e.g. to display a random user's
information), but don't believe it should be associated in the CakePHP
structure to the 'users' table. A homepage is a more general sort of
page.

Is this possible in CakePHP or am I constrained to associate every
view with a database table, model, and controller?

Thank you. Any help is much appreciated.

~ Boris

--~--~-~--~~~---~--~~
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: views without controllers

2007-12-10 Thread Chris Hartjes

On Dec 10, 2007 10:34 AM, boris [EMAIL PROTECTED] wrote:

 Is this possible in CakePHP or am I constrained to associate every
 view with a database table, model, and controller?


Well, you can certainly create models that don't use databases, and
controllers that don't need a model, but given the very nature of MVC
I think you could not create a view without a controller...


-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Selective Recursive Find

2007-12-10 Thread Baz
I came across the bindable stuffHere's my issue though:

With these bindables, you need and SVN version of CakePHP.
- I'm still not sure how to download ONE SPECIFIC version of this (All I can
get is the latest nightly).
- Last time I tried the nightly, it screwed up some stuff for me due to some
changes that I wasn't prepared for.


On Dec 10, 2007 8:11 AM, Serge Rodovnichenko [EMAIL PROTECTED] wrote:


 For Cake 1.2 take a look at Containable behaviour
 http://www.thinkingphp.org/2007/06/14/containable-20-beta/ or Bindable
 behaviour (I prefer it! :-) : http://cake-syrup.sourceforge.net/

 For cake 1.1 search this group for keyword 'expects' :-)

 On Dec 10, 4:24 pm, Baz [EMAIL PROTECTED] wrote:
  I have a simple question (I think).
 
  I have a model (Requests), which has a lot of relationships including 3
  belongsTo (Equipment, Classroom, Department).
  The Classroom model has a belongsTo (Building).
 
  I'm doing a findAll/paginate in the Request controller with
  $this-Request-recursive = 1 and get MOST of what I need. However, I'm
  trying to tack onto that, the Building reference.
 
  I've tried this:
  $this-Request-Classroom-recursive = 2;
 
  To just set the recursive set to 2 on the Classroom model only (Doesn't
  work).
 
  I've tried doing a $this-Request-Classroom-bindModel(.)
  Doesn't work.
 
  What does work is:
  $this-Request-recursive = 2, however I get a whole recursive mess on
 the
  other models (Eqiupment, Department). Then I have to go unbind ALL the
 other
  stuff I don't need.
 
  Is there a shortcut here? I just wanna change the recursiveness on ONE
  associated model.
 
  Please ask for details if I'm unclear:
  --
  Baz L
  Web Development 2.0: Web Design, CakePHP,
 Javascripthttp://www.WebDevelopment2.com/
 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Where write setlocale to custom date in all the application?

2007-12-10 Thread avairet

Hi,

I'm using $form-input() to create a date field in a form.

Cake create fine 3 selects (one for Days, one for Month and one for
Year) and with cleanUpFields method it save my date very well. But I
would translate the names of month in French.

It's work fine if I use setlocale directly in the dateTime method of
FormHelper, but it's not a good practice to modify the Cake's original
helper.

So where can I write setlocale to translate date in alla of my
application?
In AppHelper? In config/core.php? another place?

Thanks for help and sorry for my simple frenchy English.

BR

Avairet
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



i18n and belongsTo

2007-12-10 Thread Klokan

Hi there,
I have problem with i18n.
I have model user which is belongsTo group.
I have model group where fields are localized:
var $actsAs = array('Translate' = array('name','description'));

When I load data from user, I have any fields from group but not
localized fields .
CakePhp reads only from tables users and groups
I read about Translate::bindTranslation, but this isn't work :o(.

Do you have any solutions ?
(Sorry for my bad english).

--~--~-~--~~~---~--~~
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: $this-Session-setFlash(' -- msg here -- '); not showing up on 1.2.x

2007-12-10 Thread daphonz

Also make sure you have something in your view to display the message:

?php
if($session-check('Message.flash')):
$session-flash();
endif;
?

Or the like.

-Casey

On Dec 9, 10:44 pm, Louie Miranda [EMAIL PROTECTED] wrote:
 Got this working..

 Just add..

 $this-Session-setFlash('Sorry, the information you\'ve
 entered is incorrect.');
 $this-redirect('login');

 *$this-redirect('login');*

 So, there will be no blank page. And the flash message will be shown on the
 login()

 Louie

 On Dec 10, 2007 8:51 AM, Louie Miranda [EMAIL PROTECTED] wrote:



  Guys,

  this is fairly simple setFlash. But, i wonder why it is now showing up?

  A few of my simple auth codes..
  ?php
  class UsersController extends AppController
  {
  var $name = Users;
  var $helpers = array('Html', 'Form', 'Session');

 

  function login()
  {
  if(empty($this-data) == false)
  {
  if(($user = $this-User-validateLogin($this-data['User']))
  == true)
  {
  $this-Session-write('User', $user);
  $this-Session-setFlash('You\'ve successfully logged
  in.');
  $this-redirect('/statistics/display');
  exit();
  }
  else
  {
  $this-Session-setFlash('Sorry, the information you\'ve
  entered is incorrect.');
  exit();
  }
  }
  }
  ...
  ?

  I can successfully login, and it redirects right away. But, i could not
  see the flash message. Did, i missed something here?
  I am using the latest 1.2.x (pre-beta)

  Please help!

  --
  Louie Miranda ([EMAIL PROTECTED])
 http://www.axishift.com

  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)

 --
 Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com

 Security Is A Series Of Well-Defined Steps
 chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: views without controllers

2007-12-10 Thread Mike Green

A view without a controller.. is just a php page. you could achieve
the same effect by other means but it would be pointless.

On 10/12/2007, Chris Hartjes [EMAIL PROTECTED] wrote:

 On Dec 10, 2007 10:34 AM, boris [EMAIL PROTECTED] wrote:
 
  Is this possible in CakePHP or am I constrained to associate every
  view with a database table, model, and controller?
 

 Well, you can certainly create models that don't use databases, and
 controllers that don't need a model, but given the very nature of MVC
 I think you could not create a view without a controller...


 --
 Chris Hartjes

 My motto for 2007:  Just build it, damnit!

 @TheKeyboard - http://www.littlehart.net/atthekeyboard

 



-- 

Mike Green

Find yourself some misspelled ebay bargains!
http://www.typingwand.com

--~--~-~--~~~---~--~~
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: othAuth component + CakePHP 1.2.0.5875 prebeta = broken == saveField not working

2007-12-10 Thread daphonz

I had some issues getting the othAuth component to work with Cake pre-
beta as well.  I think had the same problem you did.  You can read my
blog post about it:

http://www.ancientwisdom.cc/news/archives/111

Hope that helps.

Casey

On Dec 8, 11:09 am, bingo [EMAIL PROTECTED] wrote:
 hi,

 I did some debugging..and it seems the above problem is only with
 OthAuth component. I searched through all the possible sources..but
 couldn't find any reason why its not working. Any help will be
 appreciated.

 Regards,
 Ritesh
--~--~-~--~~~---~--~~
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: othAuth component + CakePHP 1.2.0.5875 prebeta = broken == saveField not working

2007-12-10 Thread luke BAKING barker

check red frogs blog on this too and other posts in the group..othAuth
1.2 pre-beta

On Dec 10, 4:19 pm, daphonz [EMAIL PROTECTED] wrote:
 I had some issues getting the othAuth component to work with Cake pre-
 beta as well.  I think had the same problem you did.  You can read my
 blog post about it:

 http://www.ancientwisdom.cc/news/archives/111

 Hope that helps.

 Casey

 On Dec 8, 11:09 am, bingo [EMAIL PROTECTED] wrote:



  hi,

  I did some debugging..and it seems the above problem is only with
  OthAuth component. I searched through all the possible sources..but
  couldn't find any reason why its not working. Any help will be
  appreciated.

  Regards,
  Ritesh
--~--~-~--~~~---~--~~
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: Function aliases will be deprecated?

2007-12-10 Thread Gwoo

where does it say that?
--~--~-~--~~~---~--~~
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: Problem sessions

2007-12-10 Thread inver

solvent, problem in cake installation, cake directory out of
virtualhost.
I change my index.php in webroot directory.
Thanks.

On 10 dic, 16:31, powtac [EMAIL PROTECTED] wrote:
 What does it mean exactly but my data session lost?
 Example code?

--~--~-~--~~~---~--~~
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: Function aliases will be deprecated?

2007-12-10 Thread Samuel DeVore

I don't think it does, but joel moss was pondering the fact that the
cake core code seems to be replacing some of those aliased functions
internally with the direct call.  I just thought that it was for small
performance boosts given the amount of times those things are probably
called internally

Sam D

On Dec 10, 2007 9:49 AM, Gwoo [EMAIL PROTECTED] wrote:

 where does it say that?

 




-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
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: othAuth component + CakePHP 1.2.0.5875 prebeta = broken == saveField not working

2007-12-10 Thread bingo

hi daphonz, luke,

I did check Red Frogs blog and made the suggested changes, but still
the problem exist.  :(
I will again check othAuth component to make sure I didn't miss any
changes suggested in Red Frogs blog

Regards,
bingo

On Dec 10, 11:40 am, luke BAKING barker [EMAIL PROTECTED] wrote:
 check red frogs blog on this too and other posts in the group..othAuth
 1.2 pre-beta

 On Dec 10, 4:19 pm, daphonz [EMAIL PROTECTED] wrote:



  I had some issues getting the othAuth component to work with Cake pre-
  beta as well.  I think had the same problem you did.  You can read my
  blog post about it:

 http://www.ancientwisdom.cc/news/archives/111

  Hope that helps.

  Casey

  On Dec 8, 11:09 am, bingo [EMAIL PROTECTED] wrote:

   hi,

   I did some debugging..and it seems the above problem is only with
   OthAuth component. I searched through all the possible sources..but
   couldn't find any reason why its not working. Any help will be
   appreciated.

   Regards,
   Ritesh- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: views without controllers

2007-12-10 Thread djiize

default page (see routes.php) is /app/views/home.ctp
you can cusomize this page like you want, and import data from DB in
it with elements/requestAction:
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

On 10 déc, 17:17, Mike Green [EMAIL PROTECTED] wrote:
 A view without a controller.. is just a php page. you could achieve
 the same effect by other means but it would be pointless.

 On 10/12/2007, Chris Hartjes [EMAIL PROTECTED] wrote:





  On Dec 10, 2007 10:34 AM, boris [EMAIL PROTECTED] wrote:

   Is this possible in CakePHP or am I constrained to associate every
   view with a database table, model, and controller?

  Well, you can certainly create models that don't use databases, and
  controllers that don't need a model, but given the very nature of MVC
  I think you could not create a view without a controller...

  --
  Chris Hartjes

  My motto for 2007:  Just build it, damnit!

  @TheKeyboard -http://www.littlehart.net/atthekeyboard

 --
 
 Mike Green

 Find yourself some misspelled ebay bargains!http://www.typingwand.com
--~--~-~--~~~---~--~~
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: saving multiple foreign keys in one field

2007-12-10 Thread Indian Baker

Hi,
Thanks for your reply, actually this is what I'm doing

in my view I'm calling it as

echo $form-input('jobposition_id',array('options'=
$jobpositions,'multiple'='true','size'='5'));

But when I submt I get an SQL error and in the post data only the word
Array is passed like below (part of debug sql queries)

`jobposition_id` = Array,`jobtype_id` = '1'

In the Model the Jobposition_id has a belongTo relation..

Any idea what would be wrong.. I'm using .1.2x

Thanks in advance



On Dec 10, 2:11 pm, dr. Hannibal Lecter [EMAIL PROTECTED] wrote:
  I know the right approach for something like this is the HABTM, but I
  really need to just store the selected options in a single database
  field.

 Well, it is true that that you should have a proper many-to-many DB
 implementation, but if you REALLY want to hack it like that...

 All you need to do is create a multivalue select input. After that
 it's only a matter of hacking: your field will be (for example) comma-
 separated, so all you need to do is split and join selected values and
 select them in the view / insert them in the database.

 Hope that helps,
 dr. H.
--~--~-~--~~~---~--~~
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: i18n and belongsTo

2007-12-10 Thread snowdog

I posted a ticket (#3680) for this issue. It looks we have to wait for
this 'enhancement'
--~--~-~--~~~---~--~~
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: Cake and JSON.

2007-12-10 Thread Marcos Hernández





Oh, man, you're my savior!!!
It works great without touching anything!! Thanks a lot!!

hydra12 escribi:

  Try this (works in 1.2):

First, put all of your data into a variable, for instance if your
model is called items:

$items = $this-Item-findAll();
$timestamp = 1193692111; // put your timestamp here
$itemArray = Set::extract($items, '{n}.Item');
$this-set('items','{"timestamp":'.
$timestamp.',"items":'.json_encode($itemArray).'}');

Note - I haven't tested this, but it's modified from code I use for
ExtJS.  I blogged about it here: http://www.ntatd.org/mark/?p=29
(shameless plug).  Make sure to check the value of items as sent to
your view to make sure all the [ and ] are in the right place.

hydra12

On Dec 10, 3:41 am, kchopein [EMAIL PROTECTED] wrote:
  
  
Hi!!

First of all, thanks for the work!

I'm trying to use the JSON component with the Dojo Toolkit but I'm
having a problem: the generated json code includes the model level,
and I only need the data. I mean, I'm getting this:

{"timestamp":1193692111, "items":[
{"Post":{"id":"1","title":"The title","body":"This is the post
body.","created":"2007-11-07 00:44:54"}},
{"Post":{"id":"2","title":"A title once again","body":"And the post
body follows.","created":"2007-11-07 00:45:15"}},
{"Post":{"id":"3","title":"Title strikes back","body":"This is really
exciting! Not.","created":"2007-11-07 00:45:44"}},
{"Post":
{"id":"4","title":"aa","body":"aadadasdas","created":"2007-11-12
10:00:45"}}
]}

but I need something like this:

{"timestamp":1193692111, "items":[
{"id":"1","title":"The title","body":"This
is ...","created":"2007-11-07 00:44:54"},
{"id":"2","title":"A title once
again","body":"And ...","created":"2007-11-07 00:45:15"}
]}

Since I'm a Cake newbe I don't know if there's a way to do this or if
I have to do it myself. How do you solve this?

Thanks in advance!!

  
  

  


--~--~-~--~~~---~--~~
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: Why my observeField does not work properly?

2007-12-10 Thread Steveston

That's it!

Thanks :)

On Dec 10, 2:50 am, francky06l [EMAIL PROTECTED] wrote:
  if (!empty($a)); //I also tried isset, isset  !empty

 Is the semi column here a typo ? If not this explains the origin of
 your problem

 On Dec 10, 10:29 am, Steveston [EMAIL PROTECTED] wrote:

  In view:

   ?php
  echo $html-input('User/username', array('id'='username',
  'size'='50'));
  echo $html-tagErrorMsg('User/username', 'User name must 
  unique and
  contain at least 5 and no more than 8 chars');
  ?
  div id=err
  ?php
  echo $ajax-observeField('username', array('update'='err',
  'url'=/users/checkduplicate, 'frequency'=1));
   ?
   /div

  In controller:

  function checkduplicate()
  {
  $this-layout='ajax';
  $this-autoRender=false;
  $condition=array('username'=$this-data['User']['username']);
  if (!empty($this-data['User']['username']))
  {
   $a=$this-User-find($condition);
   if (!empty($a)); //I also tried isset, isset  !empty
   echo $this-data['User']['username'].: Duplicate Entry;
  }
  }

  Whenever I enter some value in username text field, I always get the
  message that:  :Duplicate Entry, even the entry does not exist in
  db.

  Why?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Pagination my post category in cakephp1.1

2007-12-10 Thread Budi yanto

Some one help me. I have problem with my blog application. I can't
paginate my post category in cakephp 1.1. I use Andy Dawson pagination
commponent.

post
id
category_id
title
content

category
   id
   title

Thank's.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



observeField and app_controller

2007-12-10 Thread Steveston

In my application, whenever users input, I need to check if some
fields are duplicate frequently (for example, user name, email, course
title, etc). I am using AJAX to do this.

The problem is, I find I am repeating a method again and again in
various controllers.

Basically, in my view, I have something like:

echo $html-input('User/username', array('id'='username',
'size'='50'));

//User/username is just an example, it can be User/email, Course/
title, etc

div id=err
?php
echo $ajax-observeField('username', array('update'='err',
'url'=/users/checkduplicate, 'frequency'=1));
 ?
 /div

In my User cotroller, I have:

  function checkduplicate()
{
$this-autoRender=false;
if (!empty($this-data['User']['username']))
{$condition=array('username'=$this-data['User']
['username']);
 $a=$this-User-find($condition);
 if (!empty($a))
 echo $this-data['User']['username'].: Duplicate Entry;
}
}


I do not like repeating the same code again and again. I want to put
checkduplicate() in app_controller. Something like:

  function checkduplicate()
{
$this-autoRender=false;
if (!empty(VALUE_OF_THE_FIELDS_TO_BE_VALIDATED)
 
{$condition=array('FIELD_NAME'=VALUE_OF_THE_FIELDS_TO_BE_VALIDATED);
 $a=$this-THE_MODEL_THIS_FIELD_BELONGS_TO-
find($condition);
 if (!empty($a))
 echo VALUE_OF_THE_FIELDS_TO_BE_VALIDATED.: Duplicate
Entry;
}
}

However, how can I pass the field to the checkduplicate() in
app_controoller? The fields to be validated changes. In
checkduplicate(), I need to know which field it is and its value. How
can I do this?

Thanks,
--~--~-~--~~~---~--~~
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: Cake and JSON.

2007-12-10 Thread hydra12

:-)

I'm glad it worked!

On Dec 10, 11:35 am, Marcos Hernández [EMAIL PROTECTED]
wrote:
 Oh, man, you're my savior!!! It works great without touching anything!! 
 Thanks a lot!!
 hydra12 escribió:Try this (works in 1.2): First, put all of your data into a 
 variable, for instance if your model is called items: $items = 
 $this-Item-findAll(); $timestamp = 1193692111; // put your timestamp here 
 $itemArray = Set::extract($items, '{n}.Item'); 
 $this-set('items','{timestamp:'. 
 $timestamp.',items:'.json_encode($itemArray).'}'); Note - I haven't tested 
 this, but it's modified from code I use for ExtJS. I blogged about it 
 here:http://www.ntatd.org/mark/?p=29(shameless plug). Make sure to check the 
 value of items as sent to your view to make sure all the [ and ] are in the 
 right place. hydra12 On Dec 10, 3:41 am, kchopein[EMAIL 
 PROTECTED]wrote:Hi!! First of all, thanks for the work! I'm trying to use 
 the JSON component with the Dojo Toolkit but I'm having a problem: the 
 generated json code includes the model level, and I only need the data. I 
 mean, I'm getting this: {timestamp:1193692111, items:[ 
 {Post:{id:1,title:The title,body:This is the post 
 body.,created:2007-11-07 00:44:54}}, {Post:{id:2,title:A title 
 once again,body:And the post body follows.,created:2007-11-07 
 00:45:15}}, {Post:{id:3,title:Title strikes back,body:This is 
 really exciting! Not.,created:2007-11-07 00:45:44}}, {Post: 
 {id:4,title:aa,body:aadadasdas,created:2007-11-12 
 10:00:45}} ]} but I need something like this: {timestamp:1193692111, 
 items:[ {id:1,title:The title,body:This is 
 ...,created:2007-11-07 00:44:54}, {id:2,title:A title once 
 again,body:And ...,created:2007-11-07 00:45:15} ]} Since I'm a Cake 
 newbe I don't know if there's a way to do this or if I have to do it myself. 
 How do you solve this? Thanks in advance!!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Strategy for minimizing time in https/SSL

2007-12-10 Thread keymaster

In my appController I plan to check if a secure controller/action is
being referred to, and if so, redirect to https (assuming we are not
already https).

Similiarly, if a nonsecure controller/action is being referred to
(excluding webroot), I plan to redirect to http (assuming we are not
already http).

This way I am in https for the minimum amount of time.

Does this make sense? Or, is it better to just put the entire site in
https?

Does switching in and out of https incur any significant performance
overhead?

Will (cake) sessions survive from https to http and back?

Can anyone forsee any gotchas with form submission, or other?

Thanks.
--~--~-~--~~~---~--~~
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: views without controllers

2007-12-10 Thread AD7six



On Dec 10, 4:34 pm, boris [EMAIL PROTECTED] wrote:
 Hi. I am new to CakePHP and would be thankful for help:

 I'm creating a social networking website. Suppose I want to create a
 profile page, which displays a user's data. The view would be app/
 views/users/profile.php and there would be a controller app/
 controllers/users_controller.php with a profile() function (i.e.
 action).

 What if I want to create a homepage? I don't want this homepage to be
 under app/views/users and have a corresponding homepage() function is
 app/controllers/users_controller.php. I want the homepage to have
 access to data from the 'users' table (e.g. to display a random user's
 information),

A view receives it's data from a controller, a controller gets
information from models.

Where you put the controller and action for your homepage is up to you
- above you have described a controller action which requires access
to your User model, that doesn't mean the action must go in the Users
controller. Create a new one named WhateverController with a $uses =
array('User') and route / to WhateverController and whatever function
if you prefer - makes no difference to cake of course.

hth,

AD
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Inner Join on hasMany

2007-12-10 Thread Baz
Hey guys...this is what I'm trying to accomplish:

I got a model (Request). Each request hasMany Dates.

I'm doing a simple find on the Request, but I ONLY want to return those
requests that have a certain date range.

I'm been able to using the excellent Bindable behavior to set the condition
on the Date.

But, it always brings back ALL the requests.

After, I'm having to loop through the array and remove requests where the
...['Request']['Date'] array is empty. Beside the fact that this is
extremely sloppy (sorry had a deadline - this is just a demo anyway), it's
messing up the numbering on my paginator.

Any ideas on how to do this simply?
Someone once mentioned adding 'type' = 'INNER' to the association, but that
didn't work (also didn't find code to support it).

Any ideas? ThanX in advance.

BTW: Using Cake 1.2 Nightly (12-08-07)
--
Baz L
Web Development 2.0
http://WebDevelopment2.com/

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Controller theory question

2007-12-10 Thread Deane

Say I need to make some functionality globally available to all my
controllers.

What's the functional difference between (1) putting the method on the
app_controller, or (2) creating a component and importing it where
needed?

I can think of two differences, but are there are things I'm not
considering?

1. With a app_controller method, the method is automatically available
in all cases, rather than having to import a component.

2. With a component, you can get more complex because you have an
object which can contain multiple methods.

--~--~-~--~~~---~--~~
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: Controller theory question

2007-12-10 Thread Mech7

You can also load an object, in app_controller so the first is really
the only reason.. its available always, so you dont have to load it :)

On Dec 10, 10:49 pm, Deane [EMAIL PROTECTED] wrote:
 Say I need to make some functionality globally available to all my
 controllers.

 What's the functional difference between (1) putting the method on the
 app_controller, or (2) creating a component and importing it where
 needed?

 I can think of two differences, but are there are things I'm not
 considering?

 1. With a app_controller method, the method is automatically available
 in all cases, rather than having to import a component.

 2. With a component, you can get more complex because you have an
 object which can contain multiple methods.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



using generateList() to select correct entry

2007-12-10 Thread Adam D.

I have a properties controller and an images controller.

Properties hasMany Images.

Images belongsTo Properties.

I need to get the id property id so the properties list dropdown
selects the correct property.

So if the user, clicks the url 'images/add/6' the properties dropdown
will select the correct properti (id=6)

My problem is that the ImagesController thinks the 'id' is the image
id (I think).

Here is the ImagesController Code...

function add($id = null) {
if (empty($this-data)) {
$this-data = $this-Image-Property-read(null, $id);
$this-set('properties', 
$this-Image-Property-generateList());
} else {

--

I hope my ramblings make sense.

Thanks,
Adam

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cleanUpFields, $form-input, type date and nightly SVN version 1.2

2007-12-10 Thread Baz
I recenlty (12/07/07) downloaded a nightly build of CakePHP 1.2 and noticed
that some things have changed in the way this works:


$form-input('date',array('type'=' date')); (for model Post when date is
NOT in the database schema)

No longer do we have $this-data containing:
['Post']['date_year']
['Post']['date_month']
['Post']['date_day']

After calling cleanUpFields this would become (IF the field is the the
database schema) :
['Post']['date'].

Right now, with this latest build, what I noticed is that they've changed
this process and $this-data now contains:
['date']['year']
['date']['month']
['date']['day']

This is excellent. But I just have one quick question (I'm not complaining):
Is there something that goes one step further and concatenates?
In general, with an SVN version, how do we tell what's changed? Is there
something updated somewhere or do we strictly read code?

ThanX all.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cake Site Deployed - THANKS To All Cakers On the Board!

2007-12-10 Thread MikeK

I just wanted to take a breath and say MAJOR THANKS to all who have
answered questions, posted great answers, and generally helped to make
CakePHP such a great technology. We have finally deployed our site
after months of development, alphas, and betas. We are extremely
pleased with the productivity CakePHP has given us, as we are
primarily old operating systems hackers and not much of web
application coders.

Feel free to take a peek - it's at www.onlinefishingtournaments.com.
It includes a simple bridge to phpBB that enables site-wide single
login, authentication, and ACL through phpBB, and exercises most of
Cake 1.2's features.

The UI is still a WIP, the functionality continues to evolve, and we
are moving to phpBB3 when it is finally golden, but the basic
functionality is working.

Thanks again Cakers!
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Conditions and recursion

2007-12-10 Thread [EMAIL PROTECTED]

So I have:
(This is semi pseudo code as I am renaming things for convince so if
there are syntax errors ignore them)

class User extends AppModel {
var $name = 'User';


var $hasAndBelongsToMany = array('Cart' =
array('className'= 'Item',
'joinTable'= 'carts',
'foreignKey'   = 'user_id',
'associationForeignKey'= 'item_id',
'conditions'   = 'GROUP BY item_id',
'order'= '',
'limit'= '',
'unique'   = true,
'finderQuery'  = '',
'deleteQuery'  = '',
'recursive'= '5',
)
  )
}

and

class Item extends AppModel {
var $name = 'Item';

var $hasMany = array('Sale' =
array('className'= 'Sale',
'conditions'   = '',
'order'= '',
'dependent'=  true,
'foreignKey'   = 'item_id'
)
);
}

If I do a $this-User-findById($id) I get
Array
(
[User] = Array
(
[id] = 1
[email] = email
)
[Cart] = Array
(
[0] = Array
(
[id] = 2
[title] = Starbucks Assortment

[carts] = Array
(
[user_id] = 1
[item_id] = 2

)
  )
)

However if take out the conditions in the User Model I get:
Array
(
[User] = Array
(
[id] = 1
[email] = email
)
[Cart] = Array
(
[0] = Array
(
[id] = 2
[title] = Starbucks Assortment

[carts] = Array
(
[user_id] = 1
[item_id] = 2

)
[Sale] = Array
(
[0] = Array
[id] = 1
[item_id] = 2
[sale_price] =999
 )
  )
)


So my question is how can I have conditions and recursion at the same
time?

--~--~-~--~~~---~--~~
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: Conditions and recursion

2007-12-10 Thread [EMAIL PROTECTED]

I forgot to add, before I do the findBy I do $this-Users-recursive =
5;

so it isn't limiting it because of that

On Dec 10, 7:36 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
 So I have:
 (This is semi pseudo code as I am renaming things for convince so if
 there are syntax errors ignore them)

 class User extends AppModel {
 var $name = 'User';

 var $hasAndBelongsToMany = array('Cart' =
 array('className'= 'Item',
 'joinTable'= 'carts',
 'foreignKey'   = 'user_id',
 'associationForeignKey'= 'item_id',
 'conditions'   = 'GROUP BY item_id',
 'order'= '',
 'limit'= '',
 'unique'   = true,
 'finderQuery'  = '',
 'deleteQuery'  = '',
 'recursive'= '5',
 )
   )

 }

 and

 class Item extends AppModel {
 var $name = 'Item';

 var $hasMany = array('Sale' =
 array('className'= 'Sale',
 'conditions'   = '',
 'order'= '',
 'dependent'=  true,
 'foreignKey'   = 'item_id'
 )
 );

 }

 If I do a $this-User-findById($id) I get
 Array
 (
 [User] = Array
 (
 [id] = 1
 [email] = email
 )
 [Cart] = Array
 (
 [0] = Array
 (
 [id] = 2
 [title] = Starbucks Assortment

 [carts] = Array
 (
 [user_id] = 1
 [item_id] = 2

 )
   )
 )

 However if take out the conditions in the User Model I get:
 Array
 (
 [User] = Array
 (
 [id] = 1
 [email] = email
 )
 [Cart] = Array
 (
 [0] = Array
 (
 [id] = 2
 [title] = Starbucks Assortment

 [carts] = Array
 (
 [user_id] = 1
 [item_id] = 2

 )
 [Sale] = Array
 (
 [0] = Array
 [id] = 1
 [item_id] = 2
 [sale_price] =999
  )
   )
 )

 So my question is how can I have conditions and recursion at the same
 time?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Generate List of Full Names

2007-12-10 Thread Gould, Adrian

Problem:

The table AUTHORS has the fields (id, given_name, last_name, created, modified) 
but no title field.

I wish to fill a select box with the id and FULL NAME that is created by 
merging last_name and first_name. in SQL you'd do soemthing like:

SELECT id, CONCAT( last_name, ', ', first_name) AS title FROM authors

how can I use this form of query in CakePHP to generate the list using:

$this-set('authors', $this-Book-Author-generateList());


Thanks\

Adrian
---
Adrian Gould
Lecturer in IT / Network Engineering / Multimedia
Business Finance  Computing [Midland Campus]
Swan TAFE
PO BOX 1336, Midland WA 6936

Phone: (08) 9267 
eMail: [EMAIL PROTECTED]




--~--~-~--~~~---~--~~
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: i18n and belongsTo

2007-12-10 Thread mouth

Right now, all behavior callbacks are executed only on 'primary'
models, so there are only 2 possible solutions:

#1
extra query - don't fetch associated group data by User-find() but
call Group-find() with condition on known group ID (from previous
User-find() query)

#2
bind association Group hasOne SomeUser (className User) and query
Group-find() with condition on SomeUser.id - fact that you'll use
hasOne may looks weird (yes I know that Group hasMany User) but it
should work fine, because hasOne association is fetched in one query
(belongsTo is just other side of hasOne or hasMany association)
--~--~-~--~~~---~--~~
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: Function aliases will be deprecated?

2007-12-10 Thread Samuel DeVore

On Dec 10, 2007 9:52 AM, Samuel DeVore [EMAIL PROTECTED] wrote:
 I don't think it does, but joel moss was pondering the fact that the
 cake core code seems to be replacing some of those aliased functions
 internally with the direct call.  I just thought that it was for small
 performance boosts given the amount of times those things are probably
 called internally


This changeset
https://trac.cakephp.org/changeset/6128




-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~-~--~~~---~--~~
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: Multiple N to Distinct N Model

2007-12-10 Thread Santa

I considered option 2 as I believe this is a fairly straight forward
model and it should be handled quite easily by cake. I have completed
the baking as per your recipe and here is what I have come up
with.

When I bake the controller and the views, it gives me an error in the
controller. Let me explain. Because the model describes the
letter_content for all three sections (opening, middle, closing) by
the array key, but references the same model for each section, the
controller bakes the following with the generateList() function:

$this-set('openings', $this-Letter-Opening-generateList());
$this-set('middles', $this-Letter-Middle-generateList());
$this-set('endings', $this-Letter-Ending-generateList());

So now when I access the edit page, I get the following:

Notice: Undefined property: Letter::$Opening
Fatal error: Call to a member function generateList() on a non-object

This is apparently due to the idea that $this-Letter-Opening is not
really an object. Or is it?

So, with some creative license and knowing that I needed LetterContent
to fill in these areas, I update the controller to use the
LetterContent model:
var $uses = array('Letter', 'LetterContent');

And then I update the generateList as follows: (notice the change in
the reference to the LetterContent model and the addition of the
conditions in the generateList function)
$this-set('openings', $this-LetterContent-
generateList(`letter_section` = 'Opening'));
$this-set('middles', $this-LetterContent-
generateList(`letter_section` = 'Middle'));
$this-set('endings', $this-LetterContent-
generateList(`letter_section` = 'Ending'));

Now I can access the edit view and things are looking good except for
one issue. Now all three drop downs (Opening, Middle, Ending) are
populated with only openings. This is close to how things started, but
instead of showing all letter_content in every drop down, I get all
openings in every letter_content drop down.

It seems like cake should handle this, and I know it is due to my
inability to understand how it should be done. I don't want to have to
strip out each table if it can be avoided. I am still sticking to my
original thoughts that this is a simple model, very clear and concise,
and is the best wat to maintain the tables to keep it easily
understandable. It conforms to 3NF and is a valid schema.

What am I missing?  Any other ideas?

--~--~-~--~~~---~--~~
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: BuiltWith.com Detects CakePHP - But How?

2007-12-10 Thread Baz
Yep, session key was it.

On Aug 15, 2007 9:45 AM, rtconner [EMAIL PROTECTED] wrote:


 Maybe it seems the date[Model][field] input format. That's a pretty
 good giveaway.

 On Aug 15, 9:11 am, Samuel DeVore [EMAIL PROTECTED] wrote:
  wonder if there could be an adopted convention with a meta tag like
 
  meta name=generator content=CakePHPhttp://www.cakephp.org/;
 
  this is often used in templates used by bbedit, textmate, golive and
  some others.  I have started adding it to my templates as well.
 
  Sam D
 
  On 8/15/07, MattC [EMAIL PROTECTED] wrote:
 
 
 
   Looks like it.  I checked out my access log and the builtwith bot
   requested / and favicon.ico.  Of the three sites I mentioned above I
   left the CAKE_SESSION_COOKIE as CAKEPHP on rsstalker, but changed it
   on the other two.
 
   On Aug 15, 10:41 am, Gwoo [EMAIL PROTECTED] wrote:
Session Key?
 
  --
  (the old fart) the advice is free, the lack of crankiness will cost you
 
  - its a fine line between a real question and an idiot
 
  http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/


 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



findAll, associations, HABTM

2007-12-10 Thread Mr-Yellow

https://trac.cakephp.org/ticket/633
https://trac.cakephp.org/ticket/1209
http://groups.google.pl/group/cake-php/browse_thread/thread/d9468ba788c5ac2c/fb23c6ada4ae8ccd?#fb23c6ada4ae8ccd

So it's broken and has been for a year?

This is really odd. to my thinking, without findAll working
properly then the whole database abstraction is a waste of time and
it's better to use raw SQL in controllers then use Cakes models that
don't really connect?

-Ben

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



PHP Fatal error: Class 'Shell' not found in .../cake/console/libs/bake.php on line 37

2007-12-10 Thread Louie Miranda
currently on /www/cake/...

unix$ /usr/local/php5/bin/php cake/console/libs/bake.php
PHP Fatal error:  Class 'Shell' not found in
.../cake/console/libs/bake.php on line 37

Any ideas? this is cake 1.2.x

-- 
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: baking problem

2007-12-10 Thread Louie Miranda

Also have the same problem. Hope someone knows the answer.

On Dec 7, 4:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Here's one for all you Cake experts out there - I'm just trying to use
 'bake' for the first time having just setup 1.2 in my 'mysite'
 directory. General cake index page works fine, database is configured
 OK, and all is well, but upon running bake from the command line I get
 this error:

 Fatal error:Class'Shell'notfoundin C:\myserver\htdocs\mysite\cake
 \console\libs\bake.php on line 37

 The nearest I've got isclassShellis defined in console/libs/shell.php and 
 cake.php refers to this file, but working out why
 overall it'snotworking is beyond me!

 If anyone can suggest a solution, I'll be really grateful, thanks!

 Jon.
--~--~-~--~~~---~--~~
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: baking problem

2007-12-10 Thread Louie Miranda

Oh i think i got it!!

/usr/local/php5/bin/php cake/console/cake.php

Welcome to CakePHP v1.2.0.5875 pre-beta Console
---
Current Paths:
 -working: /adminpage/app
 -root: .../adminpage
 -app: .../adminpage/app/
 -core: .../adminpage/

Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

 app/vendors/shells/:
 - none

 vendors/shells/:
 - none

 cake/console/libs/:
 acl
 api
 bake
 console
 i18n
 schema

To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'


On Dec 11, 3:24 pm, Louie Miranda [EMAIL PROTECTED] wrote:
 Also have the same problem. Hope someone knows the answer.

 On Dec 7, 4:22 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

  Here's one for all you Cake experts out there - I'm just trying to use
  'bake' for the first time having just setup 1.2 in my 'mysite'
  directory. General cake index page works fine, database is configured
  OK, and all is well, but upon running bake from the command line I get
  this error:

  Fatal error:Class'Shell'notfoundin C:\myserver\htdocs\mysite\cake
  \console\libs\bake.php on line 37

  The nearest I've got isclassShellis defined in console/libs/shell.php and 
  cake.php refers to this file, but working out why
  overall it'snotworking is beyond me!

  If anyone can suggest a solution, I'll be really grateful, thanks!

  Jon.
--~--~-~--~~~---~--~~
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: PHP Fatal error: Class 'Shell' not found in .../cake/console/libs/bake.php on line 37

2007-12-10 Thread Louie Miranda
Got it...

On 1.2.x use...

/usr/local/php5/bin/php cake/console/cake.php

cake.php, note bake.php

On Dec 11, 2007 3:23 PM, Louie Miranda [EMAIL PROTECTED] wrote:

 currently on /www/cake/...

 unix$ /usr/local/php5/bin/php cake/console/libs/bake.php
 PHP Fatal error:  Class 'Shell' not found in
 .../cake/console/libs/bake.php on line 37

 Any ideas? this is cake 1.2.x

 --
 Louie Miranda ([EMAIL PROTECTED])
 http://www.axishift.com

 Security Is A Series Of Well-Defined Steps
 chmod -R 0 / ; and smile :)




-- 
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: set a date on default.ctp, on all pages?

2007-12-10 Thread Louie Miranda
Thanks a lot everyone!

On Dec 10, 2007 5:45 PM, abstract [EMAIL PROTECTED] wrote:


 or, if You need to place in all views something more sophisticated,
 You can add
 $this-set(...) to beforeFilter in app_controller

 On Dec 10, 7:03 am, Louie Miranda [EMAIL PROTECTED] wrote:
  I have added this on one of my controller for function index()
 
   $this-set('date', date(r));
 
  And added
 
  ?php echo $date; ?
 
 
 
  On /app/views/layout/default.ctp
 
  It works only on that controller, and when i go to other pages.
 Obviously, i
  would add $this-set('date', date(r)); this for all to be able to
 work.
  Is there like a global preference for this kind of things? It would be
  tiring to set this for all of my controllers and functions.
 
  Thanks
  --
  Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com
 
  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)

 



-- 
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: $this-Session-setFlash(' -- msg here -- '); not showing up on 1.2.x

2007-12-10 Thread Louie Miranda
Thanks a lot everyone!

On Dec 11, 2007 12:13 AM, daphonz [EMAIL PROTECTED] wrote:


 Also make sure you have something in your view to display the message:

 ?php
if($session-check('Message.flash')):
$session-flash();
endif;
 ?

 Or the like.

 -Casey

 On Dec 9, 10:44 pm, Louie Miranda [EMAIL PROTECTED] wrote:
  Got this working..
 
  Just add..
 
  $this-Session-setFlash('Sorry, the information you\'ve
  entered is incorrect.');
  $this-redirect('login');
 
  *$this-redirect('login');*
 
  So, there will be no blank page. And the flash message will be shown on
 the
  login()
 
  Louie
 
  On Dec 10, 2007 8:51 AM, Louie Miranda [EMAIL PROTECTED] wrote:
 
 
 
   Guys,
 
   this is fairly simple setFlash. But, i wonder why it is now showing
 up?
 
   A few of my simple auth codes..
   ?php
   class UsersController extends AppController
   {
   var $name = Users;
   var $helpers = array('Html', 'Form', 'Session');
 
  
 
   function login()
   {
   if(empty($this-data) == false)
   {
   if(($user =
 $this-User-validateLogin($this-data['User']))
   == true)
   {
   $this-Session-write('User', $user);
   $this-Session-setFlash('You\'ve successfully logged
   in.');
   $this-redirect('/statistics/display');
   exit();
   }
   else
   {
   $this-Session-setFlash('Sorry, the information
 you\'ve
   entered is incorrect.');
   exit();
   }
   }
   }
   ...
   ?
 
   I can successfully login, and it redirects right away. But, i could
 not
   see the flash message. Did, i missed something here?
   I am using the latest 1.2.x (pre-beta)
 
   Please help!
 
   --
   Louie Miranda ([EMAIL PROTECTED])
  http://www.axishift.com
 
   Security Is A Series Of Well-Defined Steps
   chmod -R 0 / ; and smile :)
 
  --
  Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com
 
  Security Is A Series Of Well-Defined Steps
  chmod -R 0 / ; and smile :)

 



-- 
Louie Miranda ([EMAIL PROTECTED])
http://www.axishift.com

Security Is A Series Of Well-Defined Steps
chmod -R 0 / ; and smile :)

--~--~-~--~~~---~--~~
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: Generate List of Full Names

2007-12-10 Thread aniston

Just an indicator that might help you, its an example on db column
merging with concat

http://groups.google.com/group/cake-php/msg/1a8b39d9062c21f3

(hth)
aniston
On Dec 11, 3:15 am, Gould, Adrian [EMAIL PROTECTED]
wrote:
 Problem:

 The table AUTHORS has the fields (id, given_name, last_name, created, 
 modified) but no title field.

 I wish to fill a select box with the id and FULL NAME that is created by 
 merging last_name and first_name. in SQL you'd do soemthing like:

 SELECT id, CONCAT( last_name, ', ', first_name) AS title FROM authors

 how can I use this form of query in CakePHP to generate the list using:

 $this-set('authors', $this-Book-Author-generateList());

 Thanks\

 Adrian
 ---
 Adrian Gould
 Lecturer in IT / Network Engineering / Multimedia
 Business Finance  Computing [Midland Campus]
 Swan TAFE
 PO BOX 1336, Midland WA 6936

 Phone: (08) 9267 
 eMail: [EMAIL PROTECTED]
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---