Re: dúvida com debug+layout
Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a função debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei então, essa variável deve conter as informações de debug que são impressas após o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condição (quando faço um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela variável e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean é selecionado e coloca só o que interessa dentro do DIV mas a tabela de tempos e queries continua lá (dentro do div também). Ou seja, o código acima não elmina a informação de debug. Tudo bem, era mais uma frescura minha pois no server de produção o debug estará off e não terá a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atrás da orelha, pra diabos serve aquela variável então? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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: Tutorial do cake em português
Existem tutoriais do cake em portugues no site nacional oficial. www.cakephp.com.br e no site do tulio, existem varios screencasts www.tuliofaria.net e no site do elton minetto existem arquivos PDF de apresentações dele com tutoriais www.eltonminetto.net Alguém poderia me dizer onde posso conseguir o tutorial do cake em português? --~--~-~--~~~---~--~~ 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 cake-php-pt- [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~--- -~~~--~~--~--~--- --~--~-~--~~~---~--~~ 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: dúvida com debug+layout
Olá Gustavo, Na verdade eu uso debug em 2. Mas não é um problema ficar vendo aquela tabela lá não. Só achei muito estranho ela ser renderizada mesmo quando o layout não possui espaço reservado para ela. De fato quando quero ver o produto como vai ficar mudo o debug para 0 e ai pronto, tudo some. Abraço, Benito. On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a função debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei então, essa variável deve conter as informações de debug que são impressas após o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condição (quando faço um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela variável e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean é selecionado e coloca só o que interessa dentro do DIV mas a tabela de tempos e queries continua lá (dentro do div também). Ou seja, o código acima não elmina a informação de debug. Tudo bem, era mais uma frescura minha pois no server de produção o debug estará off e não terá a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atrás da orelha, pra diabos serve aquela variável então? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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: dúvida com debug+layout
Essa variavel não é para as tabelas de queries e sim para o output da função debug do CakePHP, por isso não te faz sentido. Não é preciso usares 0, para AJAX podes bem usar 1 que não tens problemas. On Jan 7, 2008 1:53 PM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá Gustavo, Na verdade eu uso debug em 2. Mas não é um problema ficar vendo aquela tabela lá não. Só achei muito estranho ela ser renderizada mesmo quando o layout não possui espaço reservado para ela. De fato quando quero ver o produto como vai ficar mudo o debug para 0 e ai pronto, tudo some. Abraço, Benito. On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a função debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei então, essa variável deve conter as informações de debug que são impressas após o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condição (quando faço um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela variável e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean é selecionado e coloca só o que interessa dentro do DIV mas a tabela de tempos e queries continua lá (dentro do div também). Ou seja, o código acima não elmina a informação de debug. Tudo bem, era mais uma frescura minha pois no server de produção o debug estará off e não terá a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atrás da orelha, pra diabos serve aquela variável então? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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: dúvida com debug+layout
A propósito... a chamada Ajax você está usando com as classes do Cake ou de terceiros? Não lembro a fio o código, mas se não me engano, quando é ajax via Cake ele marca uma variável do controller dizendo que é via ajax. Pode ser que esta variável não permita a renderização da tabela. Se você estiver usando biblioteca de terceiros, pode ser que ele não identifique como ajax e sim como uma requisição comum. Juan Basso Gustavo Carreno escreveu: Essa variavel n�o � para as tabelas de queries e sim para o output da fun��o debug do CakePHP, por isso n�o te faz sentido. N�o � preciso usares 0, para AJAX podes bem usar 1 que n�o tens problemas. On Jan 7, 2008 1:53 PM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Ol� Gustavo, Na verdade eu uso debug em 2. Mas n�o � um problema ficar vendo aquela tabela l� n�o. S� achei muito estranho ela ser renderizada mesmo quando o layout n�o possui espa�o reservado para ela. De fato quando quero ver o produto como vai ficar mudo o debug para 0 e ai pronto, tudo some. Abra�o, Benito. On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a fun��o debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Ol� turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei ent�o, essa vari�vel deve conter as informa��es de debug que s�o impressas ap�s o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condi��o (quando fa�o um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela vari�vel e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean � selecionado e coloca s� o que interessa dentro do DIV mas a tabela de tempos e queries continua l� (dentro do div tamb�m). Ou seja, o c�digo acima n�o elmina a informa��o de debug. Tudo bem, era mais uma frescura minha pois no server de produ��o o debug estar� off e n�o ter� a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atr�s da orelha, pra diabos serve aquela vari�vel ent�o? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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: dúvida com debug+layout
Entendido Gustavo, Tks pelas dicas. Abraço, Benito On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Essa variavel não é para as tabelas de queries e sim para o output da função debug do CakePHP, por isso não te faz sentido. Não é preciso usares 0, para AJAX podes bem usar 1 que não tens problemas. On Jan 7, 2008 1:53 PM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá Gustavo, Na verdade eu uso debug em 2. Mas não é um problema ficar vendo aquela tabela lá não. Só achei muito estranho ela ser renderizada mesmo quando o layout não possui espaço reservado para ela. De fato quando quero ver o produto como vai ficar mudo o debug para 0 e ai pronto, tudo some. Abraço, Benito. On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a função debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Olá turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei então, essa variável deve conter as informações de debug que são impressas após o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condição (quando faço um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela variável e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean é selecionado e coloca só o que interessa dentro do DIV mas a tabela de tempos e queries continua lá (dentro do div também). Ou seja, o código acima não elmina a informação de debug. Tudo bem, era mais uma frescura minha pois no server de produção o debug estará off e não terá a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atrás da orelha, pra diabos serve aquela variável então? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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: dúvida com debug+layout
Olá Juan, Sim, estou usando ajax através do cake (helper Javascript). A tabela é renderizada (setando debug para =2) mesmo via Ajax e sim, o Ajax seta uma variável no $this-params do controller e você pode verificar através do método isAjax() do RequestHandler. Abraço, Benito. On 1/7/08, Juan Basso [EMAIL PROTECTED] wrote: A propósito... a chamada Ajax você está usando com as classes do Cake ou de terceiros? Não lembro a fio o código, mas se não me engano, quando é ajax via Cake ele marca uma variável do controller dizendo que é via ajax. Pode ser que esta variável não permita a renderização da tabela. Se você estiver usando biblioteca de terceiros, pode ser que ele não identifique como ajax e sim como uma requisição comum. Juan Basso Gustavo Carreno escreveu: Essa variavel n�o � para as tabelas de queries e sim para o output da fun��o debug do CakePHP, por isso n�o te faz sentido. N�o � preciso usares 0, para AJAX podes bem usar 1 que n�o tens problemas. On Jan 7, 2008 1:53 PM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Ol� Gustavo, Na verdade eu uso debug em 2. Mas n�o � um problema ficar vendo aquela tabela l� n�o. S� achei muito estranho ela ser renderizada mesmo quando o layout n�o possui espa�o reservado para ela. De fato quando quero ver o produto como vai ficar mudo o debug para 0 e ai pronto, tudo some. Abra�o, Benito. On 1/7/08, Gustavo Carreno [EMAIL PROTECTED] wrote: Rapaz, deixa de usar o nivel de debug em 3 (Testa com 1) e vai deixar de ver o debug. Em nivel 1 pode depois usar essa variavel para colocar o que quer com a fun��o debug(qq coisa ou variavel). On Jan 6, 2008 2:17 AM, Josenivaldo Benito Junior [EMAIL PROTECTED] wrote: Ol� turma, Estava examinando o layout default do cake e achei o seguinte: ?php echo $cakeDebug; ? no final do default.ctp. Pensei ent�o, essa vari�vel deve conter as informa��es de debug que s�o impressas ap�s o footer (como a tabela de tempos e queries). Como que queria justamente remover aquela tabela em uma determinada condi��o (quando fa�o um ajax para preencher um DIV usando requestAction e uma view especifica para isso) eu tentei criar um layout clean.ctp sem aquela vari�vel e no action do ajax eu seleciono aquele layout clean. Blz, o layout clean � selecionado e coloca s� o que interessa dentro do DIV mas a tabela de tempos e queries continua l� (dentro do div tamb�m). Ou seja, o c�digo acima n�o elmina a informa��o de debug. Tudo bem, era mais uma frescura minha pois no server de produ��o o debug estar� off e n�o ter� a tal tabela nem no div nem abaixo do footer. Mas fiquei com a pulga atr�s da orelha, pra diabos serve aquela vari�vel ent�o? Grato Benito -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
=?ISO-8859-1?Q?como_posso_pegar_a_sess=E3o_do_usu=E1rio_logado??=
Pessoal, estou com o seguinte problema: tenho um portal onde existem diversos sistemas e outras facilidades, porém esse portal não foi feito com o cake. Atualmente estou desenvolvendo a 1º aplicação com o cake e pretendo integra-la ao portal. aqui começa o problema!!! no portal, os usuários se logam para obter acesso aos sistemas disponíveis, e dentro de cada sistema é verificado o perfil do usuário. Como consiguo pegar a sessão criada no portal com o cake?? pois preciso verificar o perfil do usuário. se alguém puder me dar ajuda ficarei muito grato, pois o prazo esta chegando ao fim..rs 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: como posso pegar a sessão do usuário logado?
Dá uma olhada neste component do cake http://bakery.cakephp.org/articles/view/obauth-component-tutorial Ele é bem fácil de implementar, você pode criar grupos, e resgatar os dados do usuário, para perfil, como falado. Espero q te ajude Abraços Bill www.cakephp.com.br Pessoal, estou com o seguinte problema: tenho um portal onde existem diversos sistemas e outras facilidades, porém esse portal não foi feito com o cake. Atualmente estou desenvolvendo a 1º aplicação com o cake e pretendo integra-la ao portal. aqui começa o problema!!! no portal, os usuários se logam para obter acesso aos sistemas disponíveis, e dentro de cada sistema é verificado o perfil do usuário. Como consiguo pegar a sessão criada no portal com o cake?? pois preciso verificar o perfil do usuário. se alguém puder me dar ajuda ficarei muito grato, pois o prazo esta chegando ao fim..rs 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 cake-php-pt- [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~--- -~~~--~~--~--~--- --~--~-~--~~~---~--~~ 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: como posso pegar a sessão do usuário logado
vou verificar, também não sei.. mas como pegaria ela atrvés do session_id? --~--~-~--~~~---~--~~ 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: como posso pegar a sessão do usuário logado
A sessão do portal é identificada, ou seja, você usa session_id? Se utilizar, pode utilizar a classe Session e chamar o método id($id), com isso você resgata a sessão. Apenas conselho, nunca tentei nada na pratica. Juan Basso On 7 jan, 18:12, igor_rj [EMAIL PROTECTED] wrote: Pessoal, estou com o seguinte problema: tenho um portal onde existem diversos sistemas e outras facilidades, porém esse portal não foi feito com o cake. Atualmente estou desenvolvendo a 1º aplicação com o cake e pretendo integra-la ao portal. aqui começa o problema!!! no portal, os usuários se logam para obter acesso aos sistemas disponíveis, e dentro de cada sistema é verificado o perfil do usuário. Como consiguo pegar a sessão criada no portal com o cake?? pois preciso verificar o perfil do usuário. se alguém puder me dar ajuda ficarei muito grato, pois o prazo esta chegando ao fim..rs 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: start session problem in cakephp1.2 beta
Hi Everybody, It was my wrong manipulation. The actual problem is I want to get some session data in routes.php itself, because my application is more than 99% ajax based and I don't want to change the url in the address bar. So, while login I set some session variable for next action and then refresh the page, in routes.php I fetch the action from session and then set the action in a variable then if(!isset($_SESSION)) // this I need to do because unless I start the session I can not use session variable. @session_start(); $action = 'display'; if(isset(session variable)) $action = get session variable; Router::connect('/', array('controller' = 'pages', 'action' = $action, 'home')); If I use session_start(); here ( as I was using in prebeta) then after this I need to use session_start(); every where. if I don't use session_start(); here I cann't get the session variable in routes.php and if I do I session_start(); here then in other pages like in controller this creates the problem --~--~-~--~~~---~--~~ 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: start session problem in cakephp1.2 beta
I have almost the same problem as you do with regards to the Session.start. I do this in Cakephp 1.1.x when setting sessions: define('AUTO_SESSION', false); define('CAKE_SESSION_SAVE', 'database'); define('CAKE_SESSION_TABLE', 'cake_sessions'); define('CAKE_SESSION_TIMEOUT', '120'); but when I tried it in cakephp 1.2 beta with this settings: Configure::write('Session.save', 'database'); Configure::write('Session.table', 'cake_sessions'); Configure::write('Session.database', 'default'); Configure::write('Session.start', false); the same kind of error appears: Fatal error: Class 'ConnectionManager' not found in ... please tell me if I have done something wrong, or if I have forgotten something else... thanks... On Jan 7, 12:42 am, pravinda [EMAIL PROTECTED] wrote: Hi Everybody, It was my wrong manipulation. The actual problem is I want to get some session data in routes.php itself, because my application is more than 99% ajax based and I don't want to change the url in the address bar. So, while login I set some session variable for next action and then refresh the page, in routes.php I fetch the action from session and then set the action in a variable then if(!isset($_SESSION)) // this I need to do because unless I start the session I can not use session variable. @session_start(); $action = 'display'; if(isset(session variable)) $action = get session variable; Router::connect('/', array('controller' = 'pages', 'action' = $action, 'home')); If I use session_start(); here ( as I was using in prebeta) then after this I need to use session_start(); every where. if I don't use session_start(); here I cann't get the session variable in routes.php and if I do I session_start(); here then in other pages like in controller this creates the problem --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
newbie console issues
Hi all, I'm jazzed to start using CakePHP to port over a tired old PHP site. I set up a stable version of CakePHP and was doing fine getting going using bake.php. Today I installed the new Beta release and am having trouble getting the colsole to work. I watched the screencast but I am seriously hitting a wall. I can edit my .bash_profile but seem to have several of these on my linux server. I assume I am to edit the one for the /home/nnroot dir as I am logged in as root. I'm sure I mucked up the .bash_profile entry. Any ideas??? Thanks! Kman --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Tree and Acl behaviours...
Hi folks, I have a problem with my Tree and Acl behaviors. I have the model Site which acts as a Tree and Acl. Everything works fine, Acos are created and the Site is stored inside an MPTT. Yet, what is disturbing me is, that the Acos arent stored in a tree. Lets assume I have the Site tree: Root - Site A - - Site B - - Site C - - - Site E - Site D My Acos will be like that: - group.Sites - - Site A - - Site B - - Site C - - Site D - - Site E But i want and certainly need the Acos just like the Site tree ... I hope you get my point. Greetings, NilsR --~--~-~--~~~---~--~~ 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: CakePHP webroot strange core.* files
On Jan 7, 10:26 am, NRGBilly [EMAIL PROTECTED] wrote: Hi, I noticed lately that when I have enabled uploads to an application using cakephp 1.2, I get some strange files at the webroot named core. 12345, core.23464 etc of size about 40mb. Is this a normal cakephp behaviour? How can I stop this ? That isn't caused by cake, it's a dump file of what's in memory when apache crashed. Are you on dreamhost? 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 -~--~~~~--~~--~--~---
Re: Tree and Acl behaviours...
On 7 Jan., 10:29, AD7six [EMAIL PROTECTED] wrote: On Jan 7, 9:51 am, NilsR [EMAIL PROTECTED] wrote: Hi folks, I have a problem with my Tree and Acl behaviors. I have the model Site which acts as a Tree and Acl. Everything works fine, Acos are created and the Site is stored inside an MPTT. Yet, what is disturbing me is, that the Acos arent stored in a tree. Lets assume I have the Site tree: Root - Site A - - Site B - - Site C - - - Site E - Site D My Acos will be like that: - group.Sites - - Site A - - Site B - - Site C - - Site D - - Site E But i want and certainly need the Acos just like the Site tree ... I hope you get my point. Greetings, NilsR Have you defined a method named parentNode in your Site model? It isn't returning the pk value of the parent Site node. hth, AD Ref:https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/beh... Well I have defined such a method. I worked with an article in the Bakery that told me to define it this way: /** * Returns the parent Alias for current */ function parentNode() { return $this-name; } I can imagine that the solutitions lies within this function but i dont quite know how to define it. --~--~-~--~~~---~--~~ 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: Render ho/ho
I am not trying to get the $id in the view, but in the email controller. $this-set(data,$this-Property-FindbyId($id)); On Jan 4, 6:09 pm, Robby Anderson [EMAIL PROTECTED] wrote: Maybe I mistook the question, but couldn't you just do this in your controller: $this-controller-set('emailID', $id); ... and then be able to refer to $emailID in the rendered view? -r --~--~-~--~~~---~--~~ 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: bakery hates me
While we're at it, why is The Bakery under core team? Should there be a Bakery Team? If they delegate the maintenance of bakery to someone else, it would take their load off AND improve user experience of the bakery. I'm sure there are more than a few people out there (or rather - here) that would be more than willing to do that. That way, the core team could focus on what they do best! Please note that I'm really not trying to bash anyone here, it's just an idea which might or might not be worth considering. :-) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom URL format
I am trying to develop a site with user membership. In cakePHP 1.2, is it possible to set up the URL so that it is in the following format: http://localhost/username or /app/username For example, i could have http://localhost/user1 Or does it have to be strictly in this format: /app/controller/action/ username? 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 -~--~~~~--~~--~--~---
using obAuth to add ownership to created / edited records
Hi, I'm using v1.2 and would like to create a Model behavior that adds an owner_id to a record when it gets created. So if I've logged in via othAuth the owner_id of any records I create is automatically set to the current user.id. Only problem is accessing obAuth's current user data - is there anyway to access either a helper or a component from a ModelBehavior? Obviously I could do it within the controller, but it seems like it should be within a Model Behavior so that any model I want can have an Owned behavior. Thanks for any suggestions, Guy --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamic Subdomains
How do you setup a dynamic subdomain in CakePHP? Is there any modifications in Apache that I have to make? I am using Xampp. 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: Dynamic Subdomains
I think you have to create a wildcard domain entry into your hosts file, pointing to localhost. Somthing like *.myproject.com 127.0.0.1 Within Apache config you have to simply create a VirtualHost (extras folder) and point the SeverName to domainname.com and any subdomain you give should catch it.. Within CakePHP it all depends how you work with the server_name or whatever type of routing you want to achieve. Hope this helps! Best, Kjell m3nt0r Bublitz On Jan 7, 2008 12:11 PM, bob [EMAIL PROTECTED] wrote: How do you setup a dynamic subdomain in CakePHP? Is there any modifications in Apache that I have to make? I am using Xampp. 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 -~--~~~~--~~--~--~---
I would like to have a wiki on cakephp.org
Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we should be able to reach a good amount of quality! The old Wiki had no structure at all... Maybe in the beginning we should give all approved contributers from bakery write access to the wiki only. That would sort out the problem of having everybody creating pages at will. Later on we can remove this restriction after a good amount is ported/created within the new setup and we give everyone write access. Who wouldn't want the Manual Pages to be reviewed? :-) What you think? Best! Kjell m3nt0r Bublitz PS: please use mediawiki if you give it a (second) shot. The old wiki-soft was crap.. ^^ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Nested items with HABTM
Hello! I'm only just starting on the cakephp business, and so far, i'm impressed - i've run through most of the tutorials i could find on the web relating to cake, and the IBM ones too so got a fairly good understanding of what's going on... I've hit a wall though - in the thing I'm writing at the mo, there is a tree structure (of sorts) with: Issue - Section - Article So, an issue hasMany(Section). Fine. Section hasMany(Article). Still fine. Article hasAndBelongsToMany(Article) It's the last one that's causing problems - my article table structure is something along the lines of: article(id, article_id, title, body, created, modified) so i don't have a join table to join the articles on to themselves, the article just stores if it has a parent article or not. I can't get this to work with the scaffolding part I'm working on at the moment as it keeps trying to look for a articles_articles table (which i don't think (correct me if i'm wrong) i want nor need) Any help would be greatly appreciated! Thanks Seb Maynard --~--~-~--~~~---~--~~ 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 in 1.2 model validation message
The correct way to show error message is like, in view, ?php echo $form-input('username', array('error' = array('alphanumeric' = __('Username must contain alpha-numeric characters', true), 'between' = __('Username must be between 8 to 20 characters', true; ? On Jan 5, 2008 5:12 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have setup some 1.2 beta validation rules with the message key, but this throws and error. Any idea? Here is the piece from my model... public $validate = array( 'username' = array( 'alphanumeric' = array( 'rule' = 'alphaNumeric', 'message' = __('error_username', true) ), 'between' = array( 'rule' = array('between', 8, 20), 'message' = __('error_username_between', true) ), ), And here is the error... Parse error: syntax error, unexpected '(', expecting ')' in /home/ username/public_html/cake12/app/models/users.php on line 12 -- Regards, Amit http://amitrb.wordpress.com/ http://coppermine-gallery.net/ http://cheesecake-photoblog.org/ http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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 model objects in the controllers
A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be too tempting to start inserting business logic in the views if you had objects available there. Fine. I'll concede that point for now. But what about the controllers? Shouldn't I be able to use models in the controllers? If I do a Find* in a controller to retrieve some data (that I have no intention of sending to the view) , shouldn't I get model objects back and be able to use methods on those objects? Controllers are where the business logic *should* live, so there doesn't seem to be much argument against using model objects there. Yet I still have nothing but these big arrays to deal with. How does everyone else manage this? Say you *need* to run some method on a model object in one of your controllers. What is the accepted way of doing this? --~--~-~--~~~---~--~~ 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: Nested items with HABTM
If your structure is really tree-like, then a HABTM relationship is not really useful. The main question to an answer is can one article have several parents?. As in direct parents, not hierarchy. If it can, then your structure is not a tree, and HABTM should be used, and you'll have to create a join table. If, as your database structure suggests, each article has one (or zero) parents, then the structure is tree-like and HABTM is not necessary. Each article hasOne parent article and hasMany child articles: class Article extends AppModel { var $name = Article; var $belongsTo = array('Parent' = array('className' = 'Article', 'foreignKey' = 'article_id')); var $hasMany = array('Child' = array('className' = 'Article', 'foreignKey' = 'article_id')); } Depending on the complexity of your structure, it might be worth looking at the tree behavior. However, if your nestings aren't very deep then this approach should work fine. On Jan 7, 12:50 pm, Seb [EMAIL PROTECTED] wrote: Hello! I'm only just starting on the cakephp business, and so far, i'm impressed - i've run through most of the tutorials i could find on the web relating to cake, and the IBM ones too so got a fairly good understanding of what's going on... I've hit a wall though - in the thing I'm writing at the mo, there is a tree structure (of sorts) with: Issue - Section - Article So, an issue hasMany(Section). Fine. Section hasMany(Article). Still fine. Article hasAndBelongsToMany(Article) It's the last one that's causing problems - my article table structure is something along the lines of: article(id, article_id, title, body, created, modified) so i don't have a join table to join the articles on to themselves, the article just stores if it has a parent article or not. I can't get this to work with the scaffolding part I'm working on at the moment as it keeps trying to look for a articles_articles table (which i don't think (correct me if i'm wrong) i want nor need) Any help would be greatly appreciated! Thanks Seb Maynard --~--~-~--~~~---~--~~ 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: Getting Data from 2 tables
bump :) On Jan 6, 10:31 pm, Travis [EMAIL PROTECTED] wrote: Hey everyone, I'm trying to generate a list of employees and in that list I want to show the customer which that employee belongs to. In my db I have an employees table and a customers table and each employee has a customer_id field. The problem is, I want to show the customer.name field, not the customer_id. How do I run a select statement that joins these two tables on the customer_id and retrieves only the customer_name from the customers table. I need to do this from inside the employees controller. Here's my models and controller code. class EmployeeModel extends AppModel { var $name = Employee; var $belongsTo= Customer; var $recursive = 1; } class Customer extends AppModel { var $name = Customer; var $primaryKey = 'id'; var $hasMany= array('Employee','Transaction'); var $recursive = 2; } class EmployeesController extends AppController { var $name = employees; var $helpers = array('DatePicker'); var $uses =array('Employee','Customer'); var $paginate = array( 'limit' = 25, 'order' = array('Employee.id' = 'DESC') ); /* * * * */ function index(){ //retrieve all of the customers for drop down box and set the data $customerList = $this-Customer-findAll(NULL,array('id','name')); foreach ($customerList as $customer) $customers[$customer['Customer']['id']] = $customer['Customer'] ['name']; $this-set('customers', $customers); //if data is posted, retrieve all employees specific to the customer id if(!empty($this-data)){ $this-layout = 'default'; $dataSet = $this-paginate('Employee',array('customer_id' = $this-data['Employee']['customer_id'])); $this-set(compact('dataSet')); } //if no data is posted, retrieve all employees else{ $this-layout = 'default'; $dataSet = $this-paginate('Employee'); $this-set(compact('dataSet')); } } Thanks for the help. --~--~-~--~~~---~--~~ 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: Nested items with HABTM
This is interesting - I'd previously tried without using the HABTM part: class Article extends AppModel { var $name=Article; var $hasMany=array(Article); var $belongsTo=array(Article); } and let Cake deal with the automatic matching of Article names to ids etc - you've created differently named elements, then mapped them specifically to Article - i've just tried this and it seems to work! Thanks for the help - if you can offer any more explanation of why/how this works, that would be great :D Thanks Seb On Jan 7, 1:22 pm, grigri [EMAIL PROTECTED] wrote: If your structure is really tree-like, then a HABTM relationship is not really useful. The main question to an answer is can one article have several parents?. As in direct parents, not hierarchy. If it can, then your structure is not a tree, and HABTM should be used, and you'll have to create a join table. If, as your database structure suggests, each article has one (or zero) parents, then the structure is tree-like and HABTM is not necessary. Each article hasOne parent article and hasMany child articles: class Article extends AppModel { var $name = Article; var $belongsTo = array('Parent' = array('className' = 'Article', 'foreignKey' = 'article_id')); var $hasMany = array('Child' = array('className' = 'Article', 'foreignKey' = 'article_id')); } Depending on the complexity of your structure, it might be worth looking at the tree behavior. However, if your nestings aren't very deep then this approach should work fine. On Jan 7, 12:50 pm, Seb [EMAIL PROTECTED] wrote: Hello! I'm only just starting on the cakephp business, and so far, i'm impressed - i've run through most of the tutorials i could find on the web relating to cake, and the IBM ones too so got a fairly good understanding of what's going on... I've hit a wall though - in the thing I'm writing at the mo, there is a tree structure (of sorts) with: Issue - Section - Article So, an issue hasMany(Section). Fine. Section hasMany(Article). Still fine. Article hasAndBelongsToMany(Article) It's the last one that's causing problems - my article table structure is something along the lines of: article(id, article_id, title, body, created, modified) so i don't have a join table to join the articles on to themselves, the article just stores if it has a parent article or not. I can't get this to work with the scaffolding part I'm working on at the moment as it keeps trying to look for a articles_articles table (which i don't think (correct me if i'm wrong) i want nor need) Any help would be greatly appreciated! Thanks Seb Maynard --~--~-~--~~~---~--~~ 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: Nested items with HABTM
Just to clarify, what i'd done (with both just pointing to Article) didn't work and borked out with an error non-unique key Article or something similar... Seb On Jan 7, 1:28 pm, Seb [EMAIL PROTECTED] wrote: This is interesting - I'd previously tried without using the HABTM part: class Article extends AppModel { var $name=Article; var $hasMany=array(Article); var $belongsTo=array(Article); } and let Cake deal with the automatic matching of Article names to ids etc - you've created differently named elements, then mapped them specifically to Article - i've just tried this and it seems to work! Thanks for the help - if you can offer any more explanation of why/how this works, that would be great :D Thanks Seb On Jan 7, 1:22 pm, grigri [EMAIL PROTECTED] wrote: If your structure is really tree-like, then a HABTM relationship is not really useful. The main question to an answer is can one article have several parents?. As in direct parents, not hierarchy. If it can, then your structure is not a tree, and HABTM should be used, and you'll have to create a join table. If, as your database structure suggests, each article has one (or zero) parents, then the structure is tree-like and HABTM is not necessary. Each article hasOne parent article and hasMany child articles: class Article extends AppModel { var $name = Article; var $belongsTo = array('Parent' = array('className' = 'Article', 'foreignKey' = 'article_id')); var $hasMany = array('Child' = array('className' = 'Article', 'foreignKey' = 'article_id')); } Depending on the complexity of your structure, it might be worth looking at the tree behavior. However, if your nestings aren't very deep then this approach should work fine. On Jan 7, 12:50 pm, Seb [EMAIL PROTECTED] wrote: Hello! I'm only just starting on the cakephp business, and so far, i'm impressed - i've run through most of the tutorials i could find on the web relating to cake, and the IBM ones too so got a fairly good understanding of what's going on... I've hit a wall though - in the thing I'm writing at the mo, there is a tree structure (of sorts) with: Issue - Section - Article So, an issue hasMany(Section). Fine. Section hasMany(Article). Still fine. Article hasAndBelongsToMany(Article) It's the last one that's causing problems - my article table structure is something along the lines of: article(id, article_id, title, body, created, modified) so i don't have a join table to join the articles on to themselves, the article just stores if it has a parent article or not. I can't get this to work with the scaffolding part I'm working on at the moment as it keeps trying to look for a articles_articles table (which i don't think (correct me if i'm wrong) i want nor need) Any help would be greatly appreciated! Thanks Seb Maynard --~--~-~--~~~---~--~~ 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: I would like to have a wiki on cakephp.org
I haven't been here long enough to know what the old wiki was like, but I do know that wiki's have been of major use to me in the past. Wiki's are excellent IMO. I think where they fail is with reviews by main members. I personally would LOVE to see a wiki. -- Baz L On Jan 7, 2008 6:46 AM, Kjell Bublitz [EMAIL PROTECTED] wrote: Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we should be able to reach a good amount of quality! The old Wiki had no structure at all... Maybe in the beginning we should give all approved contributers from bakery write access to the wiki only. That would sort out the problem of having everybody creating pages at will. Later on we can remove this restriction after a good amount is ported/created within the new setup and we give everyone write access. Who wouldn't want the Manual Pages to be reviewed? :-) What you think? Best! Kjell m3nt0r Bublitz PS: please use mediawiki if you give it a (second) shot. The old wiki-soft was crap.. ^^ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Flash not working with redirect
Hi, I'm trying to use the session flash message with controller actions that redirect - with no luck. For example, if I have the following action defined in a controller called test: function foo() { $this-Session-setFlash(Hello world); $this-redirect('/'); } This is redirecting back to my homepage (which via the default routing goes to pages/home) if try to display the flash in the view app\views \pages\home.thtml view it never appears (I'm using $session- flash(). However if remove the redirect and let the action render it's view (app\views\test\foo.html) the flash message will appear OK in this view. What is wrong? The redirect seems to be consuming the flash message. This seems a big problem if you can't use the session flash with redirects; as I'd like to pass messages back to the user from viewless actions (such as delete) --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
Deane, I have to disagree with your opinion that the business logic belongs in the controllers. From my understanding of MVC best practices, specifically Fat models, skinny controllers - the models should be responsible for the business logic, not the controllers. The controllers are pretty much only there in order to wire together models and views. But that said, it is only my opinion, and I'd be interested to know why you think differently. On Jan 7, 12:38 pm, Deane [EMAIL PROTECTED] wrote: A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be too tempting to start inserting business logic in the views if you had objects available there. Fine. I'll concede that point for now. But what about the controllers? Shouldn't I be able to use models in the controllers? If I do a Find* in a controller to retrieve some data (that I have no intention of sending to the view) , shouldn't I get model objects back and be able to use methods on those objects? Controllers are where the business logic *should* live, so there doesn't seem to be much argument against using model objects there. Yet I still have nothing but these big arrays to deal with. How does everyone else manage this? Say you *need* to run some method on a model object in one of your controllers. What is the accepted way of doing this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
finAll with recursive associated models
Hi list and all bakers out here. First post on the list ! Well, since we are Jan. 7th, happy new year to everyone ! I'm new to Cake and I'm stuck with such a thing : I have 3 models : b2b_item, shop_item and band_data b2b_item associated 1:1 with shop_item shop_item associated 1:1 with band_data So this is a 2-depth recursion. All is running fine using a findAll with no parameters and $recursive set to 2 in the top model. But since I get in return a huge number of fields and unuseful data for this purpose, I want to restrict the fields I get to b2b_item.id, shop_item.title, band_data.name. Cake crashes telling me that the band_data table name is unknown and I cannot find any turnaround to make the top model able to know about the top-1 level associated tables. I hope all this is clear. I already did some searches on the group but did not find any answer. Anybody could help ? Many thanxxx to 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 -~--~~~~--~~--~--~---
Re: CakePHP not works on Solaris 10 (SAMP) ?
Hi ! Many thnx for your reply: - Never found the real cause of the problems. - Now i`m going fine - last night i get it work finally. - So current config is: / Cake Beta: 1.2.0.6311 / - Solaris 10 08/07 - Apache 2061 (bundled) - MySql 5045 (blastwave) - Php 525 (source compiled) - Works like a song :) Cheers --~--~-~--~~~---~--~~ 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: bakery hates me
On Jan 7, 2008 1:35 AM, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: 1. You're trying to get the acceptance of the community by slamming misinterpreting the user. While this cabal nature might help you to be popular among the cult, this won't help you in real world. If I am misinterpreting what you are saying, I would love to be corrected. I am willing to accept when I am wrong. 2. I'm/I wasn't complaining anything. I was just suggesting that open svn branch and Wiki model would help better Correct me if I'm wrong, but a common theme in your posts is that there needs to be a wiki and there needs to be a way for changes to happen faster. A wiki was an unmitigated disaster in the past, so why would anyone want to go back to that unless they were some kind of masochist. In my experience, asking for the same thing over and over again despite being told it's not going to happen is complaining. Again, show me that I'm wrong and I'll agree with you. 3. I'm not a framework critic nor a fan boy. If there is/will be any better framework, I'll be happy to adopt that. I prefer CakePHP for some of the projects and plain PHP for some other projects. I don't believe I said that you were some kind of framework critic, so I don't see how that's relevant to this discussion. You complained about how long it takes in your opinion to get 'simple' fixes done. I pointed out what the proper way to go about getting fixes done. 4. For CakePHP, I still believe that Wiki model would be really helpful as for now, majority of good information available on CakePHP are partially through self promotional blogs. A centralized Wiki would be helpful for the developers/users and for the CakePHP itself. Self promotional blogs. Like mine, perhaps? It's probably disingenious of me to try and claim that my blog is not self-promoting, but the purpose of the blog isn't to make me look smart. It's to try and share stuff that I've come across and maybe help spark some discussion. Django like credit in Wiki might help, if anyone wants to be credited for the contribution. Here's what I think about a CakePHP wiki: USELESS unless someone maintains them and makes sure that whatever being posted is accurate. I believe that there is a project coming out very shortly that combines the best of the documentation with the best of a wiki: the CakePHP cookbook. Again, others will correct me if I'm wrong. 5. Look at the recent changeset, not all commits are based on tickets. Not all commits even don't need tickets. I'm not complaining on any of my tickets I agree that not all commits need tickets, because sometimes those changes are driven by the core team itself. Again, I didn't say that all commits are based on tickets. But if someone outside the core team finds a bug, it needs to be submitted via a ticket. 6. Open svn branch would again be helpful for the developers. I'm not saying that allowing open access for all svn branches--but to allow access only for a single branch. Selective merging is really easy with diff tools. Again, I fail to see how this helps anything other than a programmer's bruised ego. What you are asking for is a complete change from the current development structure, where programmers who have been judged by their peers are given access to relevant branches. Is it arbitrary? Sure. Is it elitist? Probably? Is it unfair to frustrated programmers who want to see bugs fixed faster? Absolutely. Submit patches with your tickets to increase the chances of a bug actually being fixed. Also, don't forget that the ugly spectre of intellectual property can rear it's head as well. All contributers are asked to sign a CLA that declares you are not violating anyone's intellectual property in the code you've committed to the repository. An open svn branch would not have that restriction, and I wouldn't touch any code coming out of that with a ten foot pole. Again, it's about QUALITY, not SPEED. The quality of the open branch svn will not just be based on unit tests and perception of core team, but would also be based on real life situations/projects--which would be more helpful for the developers. One person's real life situation is another person's edge case. I totally understand where you are coming from, but what you are advocating is a kitchen sink system where everybody throws whatever features they think are critical into the framework. I think it would be far better to have the core tight, with as little functionality as needed to meet the overall goals of the framework and then provide an infrastructure to allow people to add their own things in. As I see it, this ability already exists through the helper / behaviour / component architecture that is in place. Let me ask this question, which I think is probably the most important one: If you were a developer wanting to use CakePHP, what branch would you want to use: 1) 1.1.x stable, which has fallen far behind in
Re: Who is logged in and active
@baz - I think thats the idea. The current session information isn't persistent or easily accessible. If you create a persistent session log, you can attach anything you want to it, and save and query it at will. @chessjoe - I was doing some more work on this last night and this morning. I'm thinking about making a WebLog component that encapsulates session log, user log (login/logout and any other actions you'd want to keep a transaction log of) and page logs. I want to see when the session is started compared to when components are created. Then the WebLog component could have some simple methods like newSession(), saveSessionLog(), saveUserLog(), etc. For the moment, I modified the above code somewhat, and instead of simply setting a sessionExists flag, I actually have it setting the ID of the persistent session history record attached. I have a data model called SessionLog for a table that stores a machine generated key, the cake/php-generated session string, user agent, remote address, referrer, etc. So if its a new session, it saves a new record to the SessionLog and sets the key - so that later, if I wanted to save a user log record or page log record (or anything else I wanted a transaction log tied to the session information for), I could link it to the session log record. function afterFilter() { // Check to see if the session exists if ( !$this-Session-read('Session.session_log_id') ) { loadModel('SessionLog'); $slog = new SessionLog(); // Set whatever data you want to save in the session log here ... $slog-save(); $sessionLogID = $slog-getInsertID(); $this-Session-write('Session.session_log_id', $sessionLogID); // Do other custom session operations here ... } } --~--~-~--~~~---~--~~ 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: Flash not working with redirect
It does work as you would expect - but you're obviously experiencing issues. Try this. function foo() { $this-Session-setFlash(Hello world); $this-redirect('/', null, true); } On Jan 7, 11:57 pm, Ben Coleman [EMAIL PROTECTED] wrote: Hi, I'm trying to use the session flash message with controller actions that redirect - with no luck. For example, if I have the following action defined in a controller called test: function foo() { $this-Session-setFlash(Hello world); $this-redirect('/'); } This is redirecting back to my homepage (which via the default routing goes to pages/home) if try to display the flash in the view app\views \pages\home.thtml view it never appears (I'm using $session-flash(). However if remove the redirect and let the action render it's view (app\views\test\foo.html) the flash message will appear OK in this view. What is wrong? The redirect seems to be consuming the flash message. This seems a big problem if you can't use the session flash with redirects; as I'd like to pass messages back to the user from viewless actions (such as delete) --~--~-~--~~~---~--~~ 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: I would like to have a wiki on cakephp.org
How can you recruit maintainers and editors when the current docs team can't do that? I have some great help from great people, but no one seems to have the time to commit on a regular basis. A wiki represents a much higher maintenance cost, something I doubt you can muster. The core team definitely can't swing it, from what I can tell right now. Besides, there are already 170+ pages of docs for this transition phase. The tempdocs.cakephp.org site has been publicized on this list and is linked to from the 1.2.x branch home.ctp default view. There are a low amount of active docs tickets - what exactly will a wiki bring to the table (content-wise) that we don't already have a good start on? We're also completing testing a tool right now that allows people to contribute more easily - something that can be commented, submitted to, etc. I'm moving the material from tempdocs over to this new system that already does much of what you're asking for here, without the fatal disadvantages of a wiki. There's almost no chance a wiki will receive official CakePHP support, especially from me. It didn't work, the Bakery does work, and we're 90% of the way committed with another custom home-grown tool that is really looking to fit our needs. I don't want to dull your enthusiasm, I just want to channel it into something that will work better. If you'd like to improve the documentation for CakePHP, please contact me. Stay tuned, I hope to have something to show soon. -- John On Jan 7, 2008, at 5:46 AM, Kjell Bublitz wrote: Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we should be able to reach a good amount of quality! The old Wiki had no structure at all... Maybe in the beginning we should give all approved contributers from bakery write access to the wiki only. That would sort out the problem of having everybody creating pages at will. Later on we can remove this restriction after a good amount is ported/created within the new setup and we give everyone write access. Who wouldn't want the Manual Pages to be reviewed? :-) What you think? Best! Kjell m3nt0r Bublitz PS: please use mediawiki if you give it a (second) shot. The old wiki-soft was crap.. ^^ --~--~-~--~~~---~--~~ 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: I would like to have a wiki on cakephp.org
I like the idea of only allowing published authors on bakery to modify the wiki. But then again there are the tempdocs that are under construction - who wants to maintain two separate documentation efforts? Can they be combined at all? Adam On Jan 7, 10:46 pm, Kjell Bublitz [EMAIL PROTECTED] wrote: Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we should be able to reach a good amount of quality! The old Wiki had no structure at all... Maybe in the beginning we should give all approved contributers from bakery write access to the wiki only. That would sort out the problem of having everybody creating pages at will. Later on we can remove this restriction after a good amount is ported/created within the new setup and we give everyone write access. Who wouldn't want the Manual Pages to be reviewed? :-) What you think? Best! Kjell m3nt0r Bublitz PS: please use mediawiki if you give it a (second) shot. The old wiki-soft was crap.. ^^ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
how to get html of specific view into variable ? (Ajax)
The qestion is Ajax-specific, because when first assigning html to variable then echoing it - will not work with Ajax feature. simple code example from some imaginary view (*.ctp) out: when page rendered, this example works fine: someview.ctp . .. ... echo $ajax-div('dynamic1'); echo h2span.$data1./span/h2); echo $ajax-divEnd('dynamic1'); ... .. . but if doing like this: . .. ... $a1=$ajax-div('dynamic1'); $a2=h2span.$data1./span/h2); $a3=$ajax-divEnd('dynamic1'); echo $a1; echo $a2; echo $a3; /// or $html=$a1.$a2.$a3; echo $html; ... .. . this will not work - or - it works only the first time - but after the first Ajax request, the dynamic html replacement gives blank/wrong results. do anybody knows why this happens ? because from the php perspective both examples have same functionality. --~--~-~--~~~---~--~~ 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: Custom URL format
On Jan 7, 2008 6:09 AM, bob [EMAIL PROTECTED] wrote: I am trying to develop a site with user membership. In cakePHP 1.2, is it possible to set up the URL so that it is in the following format: http://localhost/username or /app/username For example, i could have http://localhost/user1 Or does it have to be strictly in this format: /app/controller/action/ username? Thanks in advance You can use custom routes to do this. Check out the section on 'routes' at http://tempdocs.cakephp.org -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: Getting Data from 2 tables
You didn't mention what version you are running, but if you using latest 1.2 code you can use: http://bakery.cakephp.org/articles/view/bindable-behavior-control-your-model-bindings If you using earlier version the just use unbindModel and bindModel customising fields, etc, before you do your query. Also you might run into probs with bindings being reset when using paginate by default. If you're still not convinced then just write a small sql query and call it like: $data = $this-Customer-query($sql); Adam On Jan 7, 11:27 pm, Travis [EMAIL PROTECTED] wrote: bump :) On Jan 6, 10:31 pm, Travis [EMAIL PROTECTED] wrote: Hey everyone, I'm trying to generate a list of employees and in that list I want to show the customer which that employee belongs to. In my db I have an employees table and a customers table and each employee has a customer_id field. The problem is, I want to show the customer.name field, not the customer_id. How do I run a select statement that joins these two tables on the customer_id and retrieves only the customer_name from the customers table. I need to do this from inside the employees controller. Here's my models and controller code. class EmployeeModel extends AppModel { var $name = Employee; var $belongsTo= Customer; var $recursive = 1; } class Customer extends AppModel { var $name = Customer; var $primaryKey = 'id'; var $hasMany= array('Employee','Transaction'); var $recursive = 2; } class EmployeesController extends AppController { var $name = employees; var $helpers = array('DatePicker'); var $uses =array('Employee','Customer'); var $paginate = array( 'limit' = 25, 'order' = array('Employee.id' = 'DESC') ); /* * * * */ function index(){ //retrieve all of the customers for drop down box and set the data $customerList = $this-Customer-findAll(NULL,array('id','name')); foreach ($customerList as $customer) $customers[$customer['Customer']['id']] = $customer['Customer'] ['name']; $this-set('customers', $customers); //if data is posted, retrieve all employees specific to the customer id if(!empty($this-data)){ $this-layout = 'default'; $dataSet = $this-paginate('Employee',array('customer_id' = $this-data['Employee']['customer_id'])); $this-set(compact('dataSet')); } //if no data is posted, retrieve all employees else{ $this-layout = 'default'; $dataSet = $this-paginate('Employee'); $this-set(compact('dataSet')); } } Thanks for the help. --~--~-~--~~~---~--~~ 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: Getting Data from 2 tables
On Jan 6, 2008 11:31 PM, Travis [EMAIL PROTECTED] wrote: Hey everyone, I'm trying to generate a list of employees and in that list I want to show the customer which that employee belongs to. In my db I have an employees table and a customers table and each employee has a customer_id field. The problem is, I want to show the customer.name field, not the customer_id. You could do this another way by doing a find() for the data set that you are looking for, and then use Set::extract to pull out just want you want. Check out this link: http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/ Hope that points you in the right direction. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: Using model objects in the controllers
MyTufty: the models should be responsible for the business logic, not the controllers Fine, I'll concede that point and code up a ton of business logic in my models. Still, my controller needs to call the business logic at some point. The controller needs to say, Hey, model, do *this*... If I can't get clean access to model objects in my controllers, how am I to do this? Deane On Jan 7, 8:14 am, MrTufty [EMAIL PROTECTED] wrote: Deane, I have to disagree with your opinion that the business logic belongs in the controllers. From my understanding of MVC best practices, specifically Fat models, skinny controllers - the models should be responsible for the business logic, not the controllers. The controllers are pretty much only there in order to wire together models and views. But that said, it is only my opinion, and I'd be interested to know why you think differently. On Jan 7, 12:38 pm, Deane [EMAIL PROTECTED] wrote: A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be too tempting to start inserting business logic in the views if you had objects available there. Fine. I'll concede that point for now. But what about the controllers? Shouldn't I be able to use models in the controllers? If I do a Find* in a controller to retrieve some data (that I have no intention of sending to the view) , shouldn't I get model objects back and be able to use methods on those objects? Controllers are where the business logic *should* live, so there doesn't seem to be much argument against using model objects there. Yet I still have nothing but these big arrays to deal with. How does everyone else manage this? Say you *need* to run some method on a model object in one of your controllers. What is the accepted way of doing this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
scripts for layout in cake 1.2
Just needed some thoughts on how to effectively use this... I have a large javascript (maybe 30KB) files and one of things that I want the browser to execute these files last so I put the $scripts_for_layout at the bottom of my default layout. The problem I've run into is I also have custom css for certain views, now the css also prints outside of the head tag, which then causes the styles to be applied last. Is there another function or method that will put css in the header and javascript at the bottom? I could just do a iterate over the scripts_for_layout array and regex if one is css or the other is js, but that'd be redundant wouldn't it? --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
On Jan 7, 2008 10:27 AM, cmbg [EMAIL PROTECTED] wrote: I have a large javascript (maybe 30KB) files and one of things that I want the browser to execute these files last so I put the $scripts_for_layout at the bottom of my default layout. The problem I've run into is I also have custom css for certain views, now the css also prints outside of the head tag, which then causes the styles to be applied last. Why do you want the javascript to be executed last? -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: Using model objects in the controllers
On Jan 7, 2008 10:29 AM, Deane [EMAIL PROTECTED] wrote: If I can't get clean access to model objects in my controllers, how am I to do this? Deane I don't understand why it's so hard to accept that a call to a CakePHP DB model returns an array of results? I may have taken computer science at college a long time ago, but I don't remember there being a rule that a model can only return a model. In cake, you usually get results from your models in your controller like this: $results = $this-ModelName-findAllByFoo($foo); And now $results contains a nice nested array. I might not be sharing the same definition as you, but that looks like clean access to model objects to me. Perhaps if you were to give a coding example it would help us to understand the problem you are facing. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: I would like to have a wiki on cakephp.org
A comments section on the Docs pages is enough for me. Any info missing by the docs themselves can be filled in as users leave comments. I asked John about this once, he said they've got it covered. So now.. just gotta wait for the official docs system to get released. I suppose that'll be out faster than any wiki could be properly assembled in any case. On Jan 7, 8:03 am, Adam Royle [EMAIL PROTECTED] wrote: I like the idea of only allowing published authors on bakery to modify the wiki. But then again there are the tempdocs that are under construction - who wants to maintain two separate documentation efforts? Can they be combined at all? Adam On Jan 7, 10:46 pm, Kjell Bublitz [EMAIL PROTECTED] wrote: Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we should be able to reach a good amount of quality! The old Wiki had no structure at all... Maybe in the beginning we should give all approved contributers from bakery write access to the wiki only. That would sort out the problem of having everybody creating pages at will. Later on we can remove this restriction after a good amount is ported/created within the new setup and we give everyone write access. Who wouldn't want the Manual Pages to be reviewed? :-) What you think? Best! Kjell m3nt0r Bublitz PS: please use mediawiki if you give it a (second) shot. The old wiki-soft was crap.. ^^ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Did component behaviour change on 1.2 beta ?
This code was working on cake 1.2alpha. My app manages a lot of sites and have a SiteManager component that handles authentication and authorization. One of the functions lists the sites based on an ACCESS constrant passed via parameters class SiteManagerComponent extends Component { /** * Lists all sites where user has $access * * @param unknown_type $access */ function sites($access = null) { if(!$this-controller-user || !$access) return false; // here I lookup the sites based on $access and return an array } } controller-user is defined on app_controller (that's where I store the current loggedin user). The notice I'm getting on PHP5 (not PHP4) is Notice (8): Trying to get property of non-object [APP/controllers/ components/site_manager.php, line 11], which refers to the if like then accessing $this-controller... The call is $this-SiteManager-sites(16); // example access level and runs on beforeFilter(); component.php's init function sets $this-controller to the linked controller automatically, so maybe that's happening after beforeFilter(); runs ? Thanks a lot in advance gui --~--~-~--~~~---~--~~ 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 adding ACO and ARO
Hi, I've followed the tutorial at http://bakery.cakephp.org/articles/view/how-to-use-acl-in-1-2-x and ran in to some problems. Signing up a new user is working fine, both ACO and ARO are created, but when trying to add a new post I get: Warning (512): AclNode::node() - Couldn't find Aco node identified by Array ( [Aco0.model] = Post [Aco0.foreign_key] = 14 ) [CORE/cake/libs/model/db_acl.php, line 172] Warning (512): DB_ACL::allow() - Invalid node [CORE/cake/libs/ controller/components/acl.php, line 362]. The post is still added to the database though. The Post model lookes like this ?php class Post extends AppModel { var $name = 'Post'; var $actAs = array('Acl' = 'controlled'); var $belongsTo = array('User' = array('className' = 'User' ) ); function parentNode() { return $this-name; } ? and the add-action in PostsController function add() { if (!empty($this-data)) { $this-Post-data = $this-data; $id = $this-Session-read('Auth.User.id'); $this-data['Post']['user_id'] = $id; $this-Post-create(); if($this-Post-save($this-data)) { debug($this-Post); // ACL $aroNode = array('model' = 'User', 'foreign_key' = $id); $acoNode = array('model' = 'Post', 'foreign_key' = $this-Post-getLastInsertID()); $this-Acl-allow($aroNode,$acoNode,'*'); $this-flash('Success','/users/profile/'.$id); } } } All help I can get is appreciated! --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
Perhaps this bakery article will help you. http://bakery.cakephp.org/articles/view/anything_for_layout-making-html-from-the-view-available-to-the-layout --~--~-~--~~~---~--~~ 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: Did component behaviour change on 1.2 beta ?
You sure that code ever worked? Or better yet, did you post all of your code? That should not have worked on any version of cake that I am aware of. In any case.. add this method to the component, and I think you'll be ok. function initialize($controller) { $this-controller = $controller; } On Jan 7, 8:49 am, guigouz [EMAIL PROTECTED] wrote: This code was working on cake 1.2alpha. My app manages a lot of sites and have a SiteManager component that handles authentication and authorization. One of the functions lists the sites based on an ACCESS constrant passed via parameters class SiteManagerComponent extends Component { /** * Lists all sites where user has $access * * @param unknown_type $access */ function sites($access = null) { if(!$this-controller-user || !$access) return false; // here I lookup the sites based on $access and return an array } } controller-user is defined on app_controller (that's where I store the current loggedin user). The notice I'm getting on PHP5 (not PHP4) is Notice (8): Trying to get property of non-object [APP/controllers/ components/site_manager.php, line 11], which refers to the if like then accessing $this-controller... The call is $this-SiteManager-sites(16); // example access level and runs on beforeFilter(); component.php's init function sets $this-controller to the linked controller automatically, so maybe that's happening after beforeFilter(); runs ? Thanks a lot in advance gui --~--~-~--~~~---~--~~ 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: Did component behaviour change on 1.2 beta ?
Oh, I had function startup($controller); on prior versions (which worked until 1.2alpha), removed it after checking component.php's source code and the init() function. Thanks a lot On Jan 7, 1:56 pm, rtconner [EMAIL PROTECTED] wrote: You sure that code ever worked? Or better yet, did you post all of your code? That should not have worked on any version of cake that I am aware of. In any case.. add this method to the component, and I think you'll be ok. function initialize($controller) { $this-controller = $controller; } On Jan 7, 8:49 am, guigouz [EMAIL PROTECTED] wrote: This code was working on cake 1.2alpha. My app manages a lot of sites and have a SiteManager component that handles authentication and authorization. One of the functions lists the sites based on an ACCESS constrant passed via parameters class SiteManagerComponent extends Component { /** * Lists all sites where user has $access * * @param unknown_type $access */ function sites($access = null) { if(!$this-controller-user || !$access) return false; // here I lookup the sites based on $access and return an array } } controller-user is defined on app_controller (that's where I store the current loggedin user). The notice I'm getting on PHP5 (not PHP4) is Notice (8): Trying to get property of non-object [APP/controllers/ components/site_manager.php, line 11], which refers to the if like then accessing $this-controller... The call is $this-SiteManager-sites(16); // example access level and runs on beforeFilter(); component.php's init function sets $this-controller to the linked controller automatically, so maybe that's happening after beforeFilter(); runs ? Thanks a lot in advance gui --~--~-~--~~~---~--~~ 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 adding ACO and ARO
Looking at the SQL debug the failing one is SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`, `Aco`.`foreign_key`, `Aco`.`alias` FROM `acos` AS `Aco` LEFT JOIN `acos` AS `Aco0` ON (`Aco`.`lft` = `Aco0`.`lft` AND `Aco`.`rght` = `Aco0`.`rght`) WHERE `Aco0`.`model` = 'Post' AND `Aco0`.`foreign_key` = 16 ORDER BY `Aco`.`lft` DESC It seems as the Post model never creates the ACO upon saving... to quote the tutorial from the Bakery Above code, will now automatically create a new aco for every new post that is posted. The Acl behavior takes care of all details. :/ --~--~-~--~~~---~--~~ 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: Did component behaviour change on 1.2 beta ?
startup() would also work if you wanted to put that back in also. I think one is called before beforeFilter and one is called after. On Jan 7, 9:09 am, guigouz [EMAIL PROTECTED] wrote: Oh, I had function startup($controller); on prior versions (which worked until 1.2alpha), removed it after checking component.php's source code and the init() function. Thanks a lot On Jan 7, 1:56 pm, rtconner [EMAIL PROTECTED] wrote: You sure that code ever worked? Or better yet, did you post all of your code? That should not have worked on any version of cake that I am aware of. In any case.. add this method to the component, and I think you'll be ok. function initialize($controller) { $this-controller = $controller; } On Jan 7, 8:49 am, guigouz [EMAIL PROTECTED] wrote: This code was working on cake 1.2alpha. My app manages a lot of sites and have a SiteManager component that handles authentication and authorization. One of the functions lists the sites based on an ACCESS constrant passed via parameters class SiteManagerComponent extends Component { /** * Lists all sites where user has $access * * @param unknown_type $access */ function sites($access = null) { if(!$this-controller-user || !$access) return false; // here I lookup the sites based on $access and return an array } } controller-user is defined on app_controller (that's where I store the current loggedin user). The notice I'm getting on PHP5 (not PHP4) is Notice (8): Trying to get property of non-object [APP/controllers/ components/site_manager.php, line 11], which refers to the if like then accessing $this-controller... The call is $this-SiteManager-sites(16); // example access level and runs on beforeFilter(); component.php's init function sets $this-controller to the linked controller automatically, so maybe that's happening after beforeFilter(); runs ? Thanks a lot in advance gui --~--~-~--~~~---~--~~ 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 adding ACO and ARO
I'm and idiot, a simple typo was the problem, never mind this thread. About 2h wasted because I thaught it would be better to type the code by hand instead of copypaste :) Oh well... --~--~-~--~~~---~--~~ 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: Getting Data from 2 tables
Thanks Chris, but the problem is that when I do a findAll() or a pagninate() I'm not getting data from both tables even though I have set my recursive var and my associations. Any suggestions? On Jan 7, 9:13 am, Chris Hartjes [EMAIL PROTECTED] wrote: On Jan 6, 2008 11:31 PM, Travis [EMAIL PROTECTED] wrote: Hey everyone, I'm trying to generate a list of employees and in that list I want to show the customer which that employee belongs to. In my db I have an employees table and a customers table and each employee has a customer_id field. The problem is, I want to show the customer.name field, not the customer_id. You could do this another way by doing a find() for the data set that you are looking for, and then use Set::extract to pull out just want you want. Check out this link: http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-... Hope that points you in the right direction. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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 -~--~~~~--~~--~--~---
1.2 - SaveAll() Functionality Basics
I'm extremely interested in getting the saveAll() functionality working for my project (Cake 1.2), but I can't seem to get saveAll() to work properly or really at all. Does saveAll() automagically lookup valid foreign key entries when needed? For instance, if I had Business and ZipCode Models: The Business contains a hasOne relationship to ZipCode and ZipCode contains a HABTM to many businesses. If that's the case, when I do a saveAll on Business, somehow Cake needs to do a lookup on the ZipCode model to find the valid id of the matching zip code and save it in the Business Model. Is this functionality actually implemented? Also (the real struggle for me currently), what is the correct formatting of the array being passed into saveAll()? I can't get it working using a manual test form, so my goal of looping through my own flat data to create relational Cake data is nearly impossible. ANY tips or hints would be greatly appreciated! - Cake Fan --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
I'd like to have the page completely render, so it doesn't appear that the user is not arriving to the page they wanted. When I have a lot of javascript files loading in the head tag, it takes awhile before the user sees anything. As I was doing research on it, I found that putting the javascript at the bottom allieviates the problem. Most of the javascript is adding events to data grids and other interactivity depending on the page. On Jan 7, 10:43 am, Chris Hartjes [EMAIL PROTECTED] wrote: On Jan 7, 2008 10:27 AM, cmbg [EMAIL PROTECTED] wrote: I have a large javascript (maybe 30KB) files and one of things that I want the browser to execute these files last so I put the $scripts_for_layout at the bottom of my default layout. The problem I've run into is I also have custom css for certain views, now the css also prints outside of the head tag, which then causes the styles to be applied last. Why do you want the javascript to be executed last? -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: scripts for layout in cake 1.2
Why do you want the javascript to be executed last? Well, it may be to wait for all the DOM components to be loaded (it could be a way to achieve that not depending on browsers' various implementation on .onload. Moreover, it seems a good practice to load javascript last : http://developer.yahoo.com/performance/rules.html#js_bottom Guillaume On 7 jan, 16:54, rtconner [EMAIL PROTECTED] wrote: Perhaps this bakery article will help you. http://bakery.cakephp.org/articles/view/anything_for_layout-making-ht... --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
The models are available in the controller.. $results = $this-ModelName- someFunctionYouWroteToGetSomDataBackFromTheDb(); unfortunately cake returns an array of results instead of an object.. so there no doing something like.. $results-sortBy('date ASC'); On Jan 7, 7:38 am, Deane [EMAIL PROTECTED] wrote: A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be too tempting to start inserting business logic in the views if you had objects available there. Fine. I'll concede that point for now. But what about the controllers? Shouldn't I be able to use models in the controllers? If I do a Find* in a controller to retrieve some data (that I have no intention of sending to the view) , shouldn't I get model objects back and be able to use methods on those objects? Controllers are where the business logic *should* live, so there doesn't seem to be much argument against using model objects there. Yet I still have nothing but these big arrays to deal with. How does everyone else manage this? Say you *need* to run some method on a model object in one of your controllers. What is the accepted way of doing this? --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
On Jan 7, 2008 11:06 AM, Guillaume [EMAIL PROTECTED] wrote: Well, it may be to wait for all the DOM components to be loaded (it could be a way to achieve that not depending on browsers' various implementation on .onload. Moreover, it seems a good practice to load javascript last : http://developer.yahoo.com/performance/rules.html#js_bottom Cool. Thanks for the link. -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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 -~--~~~~--~~--~--~---
using bindModel to expand results
http://bin.cakephp.org/view/1541022377 It's a model function.. bindModel doesn't appear to do anything. Model::find() isn't putting any JOIN statements in the query. Any 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: i18n in 1.2 model validation message
Yes, indeed it's the correct MVC way ..However, in case of multiple views it's convenient to be able to set the messages in model (I know, it breaks a bit the MVC rules)... On Jan 7, 1:20 pm, Amit Badkas [EMAIL PROTECTED] wrote: The correct way to show error message is like, in view, ?php echo $form-input('username', array('error' = array('alphanumeric' = __('Username must contain alpha-numeric characters', true), 'between' = __('Username must be between 8 to 20 characters', true; ? On Jan 5, 2008 5:12 AM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have setup some 1.2 beta validation rules with the message key, but this throws and error. Any idea? Here is the piece from my model... public $validate = array( 'username' = array( 'alphanumeric' = array( 'rule' = 'alphaNumeric', 'message' = __('error_username', true) ), 'between' = array( 'rule' = array('between', 8, 20), 'message' = __('error_username_between', true) ), ), And here is the error... Parse error: syntax error, unexpected '(', expecting ')' in /home/ username/public_html/cake12/app/models/users.php on line 12 -- Regards, Amit http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
{n} in generateList : What does that mean ?
Hi there bakers ! I had to generate code for a select tag this afternoon and I did it with the generateList/tagSelect method. In the generateList, I had to specify key and label with the {n} thing before referencing the model fields. I do not understand what the {n} means. I cannot find any tip in the API doc. Anybody could teach me a bit ? 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: {n} in generateList : What does that mean ?
On Jan 7, 2008 12:44 PM, metalseb [EMAIL PROTECTED] wrote: Hi there bakers ! I had to generate code for a select tag this afternoon and I did it with the generateList/tagSelect method. In the generateList, I had to specify key and label with the {n} thing before referencing the model fields. I do not understand what the {n} means. I cannot find any tip in the API doc. Anybody could teach me a bit ? Try checking out this link, it might explain it better: http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/ -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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: {n} in generateList : What does that mean ?
Try checking out this link, it might explain it better: http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-for-breakfast/ Thanks for this link ! It's much more clearer for me now. --~--~-~--~~~---~--~~ 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 and Recursive
Hi I have this question. I have a model A where I change the methods findAll and find. Now I have another model B that is in hasMany association with this model. Now if in the controller I make a find operation on model A I get the right result. If I make a find operation on model B with recursive=2 I don't get the right result for model A associated with model B. How can I do to get the right result even if I use recursive? Many Thanks Marco --~--~-~--~~~---~--~~ 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: What variable can I modify so that links, css, and jss don't have index.php in them?
Thank you so much for pointing out what should have been obvious! Went into app_controller.php and modified $this-webroot and all was well! Many thanks, Sam! Sam Sherlock wrote: I have copied this from a freshly baked app default.ctp link rel=shortcut icon href=?php e($this-webroot); ?favicon.ico type=image/x-icon / when not using mod write you get link rel=shortcut icon href=/app/webroot/favicon.ico type=image/x-icon / On 04/01/2008, loki_mdog [EMAIL PROTECTED] wrote: I am look for a the file and the variable to go into so that my css and js links aren't lead off with: /index.php For example, /index.php/favicon.ico baseURL is commented out. Many thanks! -- View this message in context: http://www.nabble.com/What-variable-can-I-modify-so-that-links%2C-css%2C-and-jss-don%27t-have-index.php-in-them--tp14626892p14626892.html Sent from the CakePHP mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/What-variable-can-I-modify-so-that-links%2C-css%2C-and-jss-don%27t-have-index.php-in-them--tp14626892p14672390.html Sent from the CakePHP mailing list archive at Nabble.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: FindAll and Recursive
Sorry I have mistaked. A has belongsTo Association with B A has hasAndBelongsToMany Association with C B has hasMany Association with A I change the methods findAll and find for A where I change the field of the model C that I get normally with findAll and find. I make a findAll operation on model A with recursive 3 I get this A--| B--| A--| C The field of C is empty. Instead if I make a findAll operation on model A with recursive 0 iget A--| B | C With C that is not empty On 7 Gen, 19:24, francky06l [EMAIL PROTECTED] wrote: Sorry, a bit unclear to me : A hasMany B ? B has got which relation with A ? On Jan 7, 7:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi I have this question. I have a model A where I change the methods findAll and find. Now I have another model B that is in hasMany association with this model. Now if in the controller I make a find operation on model A I get the right result. If I make a find operation on model B with recursive=2 I don't get the right result for model A associated with model B. How can I do to get the right result even if I use recursive? Many Thanks IInstead nstead Marco --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
Thanks! This is very helpful! On Jan 7, 10:54 am, rtconner [EMAIL PROTECTED] wrote: Perhaps this bakery article will help you. http://bakery.cakephp.org/articles/view/anything_for_layout-making-ht... --~--~-~--~~~---~--~~ 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: FindAll and Recursive
On Jan 7, 7:48 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry I have mistaked. A has belongsTo Association with B A has hasAndBelongsToMany Association with C B has hasMany Association with A I change the methods findAll and find for A where I change the field of the model C that I get normally with findAll and find. You overwrote the find method, just to change the fields returned on an associated model? --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
Yep, NP. This is functionality that IMO should be in the cake core. But, what do I know? On Jan 7, 11:57 am, cmbg [EMAIL PROTECTED] wrote: Thanks! This is very helpful! On Jan 7, 10:54 am, rtconner [EMAIL PROTECTED] wrote: Perhaps this bakery article will help you. http://bakery.cakephp.org/articles/view/anything_for_layout-making-ht... --~--~-~--~~~---~--~~ 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: FindAll and Recursive
On Jan 7, 8:11 pm, AD7six [EMAIL PROTECTED] wrote: You overwrote the find method, just to change the fields returned on an associated model? Whoops I clicked send too soon. I find that a bit A given that B and and should be used to do C. Where: A = strange B = bindModel/your association definitions C = the same thing. hth, AD PS. Real names are easier to understand. --~--~-~--~~~---~--~~ 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: scripts for layout in cake 1.2
Just for the record. If your creating a website with javascript to add functionlity the approach of loading the javascript at the bottom is correct. But if your site striongly depends on javascript (the case of a webapp) the best is to load javascript as soon as you can. Regards, -- Pablo Viojo [EMAIL PROTECTED] http://pviojo.net On Jan 7, 2008 12:59 PM, cmbg [EMAIL PROTECTED] wrote: I'd like to have the page completely render, so it doesn't appear that the user is not arriving to the page they wanted. When I have a lot of javascript files loading in the head tag, it takes awhile before the user sees anything. As I was doing research on it, I found that putting the javascript at the bottom allieviates the problem. Most of the javascript is adding events to data grids and other interactivity depending on the page. On Jan 7, 10:43 am, Chris Hartjes [EMAIL PROTECTED] wrote: On Jan 7, 2008 10:27 AM, cmbg [EMAIL PROTECTED] wrote: I have a large javascript (maybe 30KB) files and one of things that I want the browser to execute these files last so I put the $scripts_for_layout at the bottom of my default layout. The problem I've run into is I also have custom css for certain views, now the css also prints outside of the head tag, which then causes the styles to be applied last. Why do you want the javascript to be executed last? -- Chris Hartjes Internet Loudmouth Motto for 2008: Moving from herding elephants to handling snakes... @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 -~--~~~~--~~--~--~---
String::uuid() is not being called in model.php
I recently downloaded the beta version of CakePHP 1.2. I am updating a Shell application so that it uses UUID's for the primary keys in my models. All PK datatypes in the database have been set to char(36). When I do a model-save() I get a PHP fatal error on String::uuid(); on line 1210 in the /cake/lib/model/model.php file. I hacked it by including the string.php file through an absolute path in a require() :( and now everything works. Although it works now, I'm curious if any body came across this same issue? I want to fix it correctly without the require because I know it's not ideal and against the CakePHP conventions. Thanks Erik --~--~-~--~~~---~--~~ 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: Getting Data from 2 tables
Hi Adam, I am running 1.2 ... I tried using bind(), but that seems to not work. The array I am getting returned contains no Customer records, which is weird. On Jan 7, 9:17 am, Adam Royle [EMAIL PROTECTED] wrote: You didn't mention what version you are running, but if you using latest 1.2 code you can use: http://bakery.cakephp.org/articles/view/bindable-behavior-control-you... If you using earlier version the just use unbindModel and bindModel customising fields, etc, before you do your query. Also you might run into probs with bindings being reset when using paginate by default. If you're still not convinced then just write a small sql query and call it like: $data = $this-Customer-query($sql); Adam On Jan 7, 11:27 pm, Travis [EMAIL PROTECTED] wrote: bump :) On Jan 6, 10:31 pm, Travis [EMAIL PROTECTED] wrote: Hey everyone, I'm trying to generate a list of employees and in that list I want to show the customer which that employee belongs to. In my db I have an employees table and a customers table and each employee has a customer_id field. The problem is, I want to show the customer.name field, not the customer_id. How do I run a select statement that joins these two tables on the customer_id and retrieves only the customer_name from the customers table. I need to do this from inside the employees controller. Here's my models and controller code. class EmployeeModel extends AppModel { var $name = Employee; var $belongsTo= Customer; var $recursive = 1; } class Customer extends AppModel { var $name = Customer; var $primaryKey = 'id'; var $hasMany= array('Employee','Transaction'); var $recursive = 2; } class EmployeesController extends AppController { var $name = employees; var $helpers = array('DatePicker'); var $uses =array('Employee','Customer'); var $paginate = array( 'limit' = 25, 'order' = array('Employee.id' = 'DESC') ); /* * * * */ function index(){ //retrieve all of the customers for drop down box and set the data $customerList = $this-Customer-findAll(NULL,array('id','name')); foreach ($customerList as $customer) $customers[$customer['Customer']['id']] = $customer['Customer'] ['name']; $this-set('customers', $customers); //if data is posted, retrieve all employees specific to the customer id if(!empty($this-data)){ $this-layout = 'default'; $dataSet = $this-paginate('Employee',array('customer_id' = $this-data['Employee']['customer_id'])); $this-set(compact('dataSet')); } //if no data is posted, retrieve all employees else{ $this-layout = 'default'; $dataSet = $this-paginate('Employee'); $this-set(compact('dataSet')); } } Thanks for the help. --~--~-~--~~~---~--~~ 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: saveAll method in cakephp 1.2
I *think* this is a bug. It always seemed to return a false failure message to me (even though the update actually ran), after some digging I made the following change to /cake/lib/model/model.php in the saveAll() function: code ... if ($options['atomic']) { $db-commit($this); return true; //All has gone well - let's actually report that! } ... /code Mine now works like a champ. I'm going to file a bug report so keep an eye open at CakePHP.org for that. On Jan 4, 9:50 pm, Robby Anderson [EMAIL PROTECTED] wrote: Heh. I'd build a dummy form with multiple records as demonstrated in the previously linked post, then just dump the results to see what the array looks like. :) -r --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
That example you gave -- is that a static method on the class? What if I want to instantiate a specific Widget object (from a specific row in the database) and run an instance method on it? On Jan 7, 10:32 am, kristofer [EMAIL PROTECTED] wrote: The models are available in the controller.. $results = $this-ModelName- someFunctionYouWroteToGetSomDataBackFromTheDb(); unfortunately cake returns an array of results instead of an object.. so there no doing something like.. $results-sortBy('date ASC'); On Jan 7, 7:38 am, Deane [EMAIL PROTECTED] wrote: A couple days ago, I lamented that Find* didn't return an array of model objects. I posted about it here, and I was told that one of the reasons for this was that it would be too tempting to start inserting business logic in the views if you had objects available there. Fine. I'll concede that point for now. But what about the controllers? Shouldn't I be able to use models in the controllers? If I do a Find* in a controller to retrieve some data (that I have no intention of sending to the view) , shouldn't I get model objects back and be able to use methods on those objects? Controllers are where the business logic *should* live, so there doesn't seem to be much argument against using model objects there. Yet I still have nothing but these big arrays to deal with. How does everyone else manage this? Say you *need* to run some method on a model object in one of your controllers. What is the accepted way of doing this? --~--~-~--~~~---~--~~ 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 in 1.2 model validation message
I might not understand fully, but couldn't you do both? Set the message key for each validation in the model, then wrap the message key in the __() function in the view. Best of both worlds. --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
On Jan 7, 9:26 pm, Deane [EMAIL PROTECTED] wrote: That example you gave -- is that a static method on the class? What if I want to instantiate a specific Widget object (from a specific row in the database) and run an instance method on it? $this-Model-read(null, $id); $this-Model-funkylogic(); in your model function funkylogic() { // refer to $this-data } 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 -~--~~~~--~~--~--~---
Re: Using model objects in the controllers
Two ways jump out at me right off the bat. First, think of the default cake Model as a data access class only, and then define a business- logic class (that doesn't extend AppModel) to encapsulate your desired model functionality. // Get results from data access model $results = $this-SomeModel-findWhatever(); // Instantiate business logic class, assigning results to it, and then slice bread $myModel = new MyModelWithBusinessLogic($results); $myModel-sliceBread(); Or just use afterFind() in a model, assigning the results to a model property, and build your business logic into the model that way. function afterFind( $results ) { $this-_results = $results; } function sliceBread() { if ( empty($this-_results) { return false; } // slice bread! } $this-SomeModel-findWhatever(); $this-SomeModel-sliceBread(); --~--~-~--~~~---~--~~ 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: String::uuid() is not being called in model.php
You might try uses('string'); I think that should include the file. Check basics.php for all the various include/require functions. On Jan 7, 1:26 pm, eschito [EMAIL PROTECTED] wrote: I recently downloaded the beta version of CakePHP 1.2. I am updating a Shell application so that it uses UUID's for the primary keys in my models. All PK datatypes in the database have been set to char(36). When I do a model-save() I get a PHP fatal error on String::uuid(); on line 1210 in the /cake/lib/model/model.php file. I hacked it by including the string.php file through an absolute path in a require() :( and now everything works. Although it works now, I'm curious if any body came across this same issue? I want to fix it correctly without the require because I know it's not ideal and against the CakePHP conventions. Thanks Erik --~--~-~--~~~---~--~~ 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: {n} in generateList : What does that mean ?
Whoa. Very cool link indeed. --~--~-~--~~~---~--~~ 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: I would like to have a wiki on cakephp.org
Seems to work well for php.net. Well I think they call it notes. On Jan 7, 2:31 pm, Kjell Bublitz [EMAIL PROTECTED] wrote: Hmmm... I have a problem with a comment-function. Comments encourage discussions - Discussions have nothing to do with documentation. If theres a comment function it is almost as good as an invitation for beginners to ask right away, rather than to read on their own. We all know that well enough :) So a comment section kinda destroys the purpose of the system. Docs shouldn't be yet another forum or chat. Asking is okay, but there should be no need to ask if the page keeps being maintained. Just take an simple blog entry for example (or bakery for that matter): Good infos scattered all over the place and no one can or wants to break it down for future reference (ie: add to the original post, keep things fresh, based on discussion outcome). But that's just natural: Why add something that has been explained somewhere in the comments? The problem is the result after some time has passsed. The page is cluttered, new visitors just keep asking for help and more details, and others don't know which snippet from all the comments now really works.. So how about this (in addition to your system): Rather than having a Comment section, we have a Contribute section below the article. - Any submission is appended (as proposal) to the page for a certain period (2 weeks) for public review (maybe with votes). - The pageowner can then approve or deny the new submission: Approval means that he adds it the original content. - Once a submission is accepted and added to the page it is removed from the contribute section below. Now how to deal with dead pages / missing owner? Some ideas: If the pageowner does not react within the 2 weeks period... A) ... an automated email notifys the siteadmin to take over. B) ... the ownership is turned over to the last contributer. C) ... the notified admin names a new pageowner Aditionally: report dead page, report spam, mark as outdated What you think? - Kjell Bublitz On Jan 7, 2008 4:01 PM, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: How can you recruit maintainers and editors when the current docs team can't do that? I have some great help from great people, but no one seems to have the time to commit on a regular basis. A wiki represents a much higher maintenance cost, something I doubt you can muster. The core team definitely can't swing it, from what I can tell right now. Besides, there are already 170+ pages of docs for this transition phase. The tempdocs.cakephp.org site has been publicized on this list and is linked to from the 1.2.x branch home.ctp default view. There are a low amount of active docs tickets - what exactly will a wiki bring to the table (content-wise) that we don't already have a good start on? We're also completing testing a tool right now that allows people to contribute more easily - something that can be commented, submitted to, etc. I'm moving the material from tempdocs over to this new system that already does much of what you're asking for here, without the fatal disadvantages of a wiki. There's almost no chance a wiki will receive official CakePHP support, especially from me. It didn't work, the Bakery does work, and we're 90% of the way committed with another custom home-grown tool that is really looking to fit our needs. I don't want to dull your enthusiasm, I just want to channel it into something that will work better. If you'd like to improve the documentation for CakePHP, please contact me. Stay tuned, I hope to have something to show soon. -- John On Jan 7, 2008, at 5:46 AM, Kjell Bublitz wrote: Hi list and maintainers! As the topictitle says, i would like to see a wiki-revival. I like the bakery, but since we are all desperate for docs, good up-to-date examples and practices it would help the community if we had a Wiki again! I am also not for a Wiki that is swarmed by newcomers asking for help on the 101 but i also dont want to explain stuff more than twice (in chats or wherever), and i myself dislike hunting for good blog entries or the right topic in the groups. Can be very frustrating at times... you gotta admit that. I know from the past that the Wiki was a mess, but thats where we need to recrute/name moderators (an open sub-team maybe). You could count me in for that. A wiki version of the docs is absolutely necessary in such a long transition phase. There are so many changes and most devs want to use and learn 1.2 already. The docteam then could adopt the writings and compile it, readers could download/export a current draft, subscribe to pages using rss, etc .. But for this to work the general structure needs to be layed out from start (bakery is a good example: version info, type). With a well categorized layout we
Re: session problems with cake 1.18 and CAKE_SECURITY=high?
Hello, did you resolve your session issues ? i saw your bug report was set to invalid, but with no explaination. i'm just following a basic tuto with login and session (Cook up Web sitesfast withCakePHP part3) and i'm stuck. the data i wrote into the session when user successfully logged in are no longer available in the next page. do you have an idea ? many 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 -~--~~~~--~~--~--~---
applying conditions to a model's children
I currently use a straight SQL statement for this but I'm wondering if there is any way to do this with $this-model-find(). I have a User model that hasMany ratings. What I want to do is select all users that have no ratings. This is how I do it now: $sql=SELECT * FROM users WHERE (SELECT COUNT(id) FROM ratings WHERE ratings.user_id=users.id)=0; $results=$this-User-query($sql); Is there a way to do this with find? how about selecting all users where user's ratings satisfy conditions: $sql=SELECT * FROM users WHERE (SELECT COUNT(id) FROM ratings WHERE ratings.user_id=users.id AND ratings.value=10)0; $results=$this-User-query($sql); just wondering if anyone knows if this is possible using find(). --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
I had similar feelings to this when I first had to get some complex data through CakePHP, thinking the results of a simple mysql_query or an object would be much easier to work with than a 5 level deep array! Yet I still have nothing but these big arrays to deal with. That's the key point, and there are other ways to deal with it apart from getting objects back from your results: -- Use generateList where you can generateList returns a simple array, and takes various params- it's surprisingly powerful. -- Filter the results of your cake queries to make the arrays simpler The set class can help return simpler arrays (see the thinkingphp blog for a good post on this), there's also a behaviour in the bakery for simpler array results, and (perhaps in response to your previous post) someone recently linked to a way to objectify the result arrays. -- run sql manually via model-query() in a method in your model, like ::getSimpleResultsForMyBigQuery(), and return the data just how you'd like. -- use SQL views: often a SQL view is a nice way to take complex queries out of your code. I hope with all those tools at your disposal, the use of results arrays won't be a 'deal breaker' for you - It wasn't for me. On Jan 7, 8:42 pm, Robby Anderson [EMAIL PROTECTED] wrote: Two ways jump out at me right off the bat. First, think of the default cake Model as a data access class only, and then define a business- logic class (that doesn't extend AppModel) to encapsulate your desired model functionality. // Get results from data access model $results = $this-SomeModel-findWhatever(); // Instantiate business logic class, assigning results to it, and then slice bread $myModel = new MyModelWithBusinessLogic($results); $myModel-sliceBread(); Or just use afterFind() in a model, assigning the results to a model property, and build your business logic into the model that way. function afterFind( $results ) { $this-_results = $results; } function sliceBread() { if ( empty($this-_results) { return false; } // slice bread! } $this-SomeModel-findWhatever(); $this-SomeModel-sliceBread(); --~--~-~--~~~---~--~~ 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: I would like to have a wiki on cakephp.org
On Jan 7, 2008 10:45 PM, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: On Jan 7, 2008, at 2:31 PM, Kjell Bublitz wrote: Hmmm... I have a problem with a comment-function. Comments encourage discussions - Discussions have nothing to do with documentation. Like rtconner said, php.net's documentation has really benefitted from comments. It allows people to suggest ways to do things, examples, relevant code snippets or notes about applicable plugins and classes. It *does* have to do with documentation. Yes, PHP.net works well with that, i have to admit, but there is also much trash and really really old examples that one should never adopt. But most of the times it is okay.. I just emphasized the comments vs. documentation-theory because there may probably be unhealthy amounts of it duz nut wurk! posts. :-) If theres a comment function it is almost as good as an invitation for beginners to ask right away, rather than to read on their own. We all know that well enough :) So a comment section kinda destroys the purpose of the system. Docs shouldn't be yet another forum or chat. Asking is okay, but there should be no need to ask if the page keeps being maintained. Comments that ask for support will probably be removed. Haven't made a decision on that yet. I don't mind people posting queries and solving gotchas in the manual though. Just take an simple blog entry for example (or bakery for that matter): Good infos scattered all over the place and no one can or wants to break it down for future reference (ie: add to the original post, keep things fresh, based on discussion outcome). I don't see how personal blogs really directly relate to the official documentation effort. We always appreciate the attention, but there's no way we can catalog or review all that content. That's really not in the scope of this project. Whoops, misunderstanding: Blogs as in static, but commentable, content. A page that is written/posted and never looked back at (and only maintainable by the owner). Like a bakery article.. you create it and if you don't edit it, it will be the way it was forever... But that's just natural: Why add something that has been explained somewhere in the comments? The problem is the result after some time has passsed. The page is cluttered, new visitors just keep asking for help and more details, and others don't know which snippet from all the comments now really works.. I disagree with how you paint this picture. It seems like an over- exaggeration to me. A separated place in the manual for comments has been well done in the past, I don't think it'll be as disorganized as you think. Hmm.. yeah.. since the pages are kept up to date by you and others this may be not that big of an issue then. So how about this (in addition to your system): Rather than having a Comment section, we have a Contribute section below the article. - Any submission is appended (as proposal) to the page for a certain period (2 weeks) for public review (maybe with votes). - The pageowner can then approve or deny the new submission: Approval means that he adds it the original content. - Once a submission is accepted and added to the page it is removed from the contribute section below. This is essentially what we already have in the works, in addition to allowing comments. All suggestions on new sections and changes to content are reviewed by myself or my team. Great Now how to deal with dead pages / missing owner? Some ideas: If the pageowner does not react within the 2 weeks period... A) ... an automated email notifys the siteadmin to take over. B) ... the ownership is turned over to the last contributer. C) ... the notified admin names a new pageowner Aditionally: report dead page, report spam, mark as outdated What you think? There won't really be any dead pages or ownerless pages. All content will be managed by myself or delegated to docs team members. Okay, got ya.. this idea above was more directed towards an Bakery-like system where everyone could create pages on their own. In that case it would be possible that a user leaves or forgets about it. Looking forward. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
1.2.0.6311 beta Session drop on redirect
I'm having a problem with the session being dropped when I redirect. Controller1: $this-Session-set('foo',$foo); $this-redirect('/controller2'); Controller2: debug($_SESSION); // returns an empty array In core.php: Configure::write('debug', 2); Configure::write('Session.timeout', '120'); Configure::write('Session.start', true); Configure::write('Session.checkAgent', false); Configure::write('Security.level', 'low'); 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: othAuth looses session - upgrading to new 1.2.0.6311 (2008)
Having the same thing here, but not solution yet. On Jan 3, 6:17 am, Klaus [EMAIL PROTECTED] wrote: Hello everyone, I can't figure out whats the matter. My problem: Running application with cake1.2pre-beta and the othAuth component went fine, but looses login-sessionsince migrated to the newest cake- beta. I made the changes to the component as somewhere supposed on the list (sorry don't remember) /tmp is writable, security setting is low,sessionhandled by either cake or php... directly after login, user-data from othauth is stored intosession, visiting any other page seems to kill allsessiondata and reinitialize it. session_id remains the same. Does anyone of you have a similar problem? can't figure out why mysessiondisappears. Any help would be greatly appreciated. Thanks in advance. ./Klaus --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
Assume this scenario: I need to retrieve 20 records, and call a method on each of them. So I do my Find, and get back an array. I then spin this, and do this: $this-Widget-read(null, $id); What has just happened from a SQL perspective? 21 separate SQL executions? (One for the loop, and 20 to hydrate the resulting objects, one-by-one...) Deane On Jan 7, 4:12 pm, the_woodsman [EMAIL PROTECTED] wrote: I had similar feelings to this when I first had to get some complex data through CakePHP, thinking the results of a simple mysql_query or an object would be much easier to work with than a 5 level deep array! Yet I still have nothing but these big arrays to deal with. That's the key point, and there are other ways to deal with it apart from getting objects back from your results: -- Use generateList where you can generateList returns a simple array, and takes various params- it's surprisingly powerful. -- Filter the results of your cake queries to make the arrays simpler The set class can help return simpler arrays (see the thinkingphp blog for a good post on this), there's also a behaviour in the bakery for simpler array results, and (perhaps in response to your previous post) someone recently linked to a way to objectify the result arrays. -- run sql manually via model-query() in a method in your model, like ::getSimpleResultsForMyBigQuery(), and return the data just how you'd like. -- use SQL views: often a SQL view is a nice way to take complex queries out of your code. I hope with all those tools at your disposal, the use of results arrays won't be a 'deal breaker' for you - It wasn't for me. On Jan 7, 8:42 pm, Robby Anderson [EMAIL PROTECTED] wrote: Two ways jump out at me right off the bat. First, think of the default cake Model as a data access class only, and then define a business- logic class (that doesn't extend AppModel) to encapsulate your desired model functionality. // Get results from data access model $results = $this-SomeModel-findWhatever(); // Instantiate business logic class, assigning results to it, and then slice bread $myModel = new MyModelWithBusinessLogic($results); $myModel-sliceBread(); Or just use afterFind() in a model, assigning the results to a model property, and build your business logic into the model that way. function afterFind( $results ) { $this-_results = $results; } function sliceBread() { if ( empty($this-_results) { return false; } // slice bread! } $this-SomeModel-findWhatever(); $this-SomeModel-sliceBread(); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
What's wrong with this one?
Ok I know it isn't done the wright way, but it should work! The pagination only gives 1 result (cake 1.1) while the var_dump gives the following string string(22) 535,587,1211,1964,2791 thx in advance for the help function filter() { $userid = $this-User-query(SELECT DISTINCT User.id FROM users as User LEFT JOIN userjobids as uj ON User.id = uj.user_id LEFT JOIN jobids as job ON job.id = uj.jobid_id WHERE job.id = '$_GET[functie]' GROUP BY User.id); foreach ($userid as $arr_user) { $ids[] = $arr_user['User']['id']; } $userid = implode(',',$ids); $criteria = array('id' = $userid); list($order,$limit,$page) = $this-Pagination- init($criteria); // Added $data = $this-User-findAll($criteria, NULL, $order, $limit, $page); // Extra parameters added $this-set('data',$data); --~--~-~--~~~---~--~~ 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: Using model objects in the controllers
On Jan 7, 11:35 pm, Deane [EMAIL PROTECTED] wrote: Assume this scenario: I need to retrieve 20 records, and call a method on each of them. So I do my Find, and get back an array. I then spin this, and do this: $this-Widget-read(null, $id); What has just happened from a SQL perspective? 21 separate SQL executions? (One for the loop, and 20 to hydrate the resulting objects, one-by-one...) Are you deliberately trying to be difficult ;). $data = $this-Widget-find('all'); foreach ($data as $results) { $this-Widget-create($result); $this-Widget-stuff(); } Total sql calls: 1 And that's unless you write stuff() to be able to batch process data. I feel it's time you either showed a real example of what you /can't/ do, or at least try things the cake way. 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 -~--~~~~--~~--~--~---
How do I add a helper to an element
Hello all! I've been doing some Cake'ing for a while and find it lots of fun to work with seeing that it's quite fast and has a lot going for it so far. I'm having a bit of a headache with elements and helpers though, I've seen some notions about it but never quite figured it out so I thought I'd give this a shot to see if anyone can help me clear things up. What I'm trying to accomplish is quite simple; I have a sidebar to the left of my page where I'd like to add/edit/delete small notices (one short caption along with a short string of text). I've managed to make the entire site working insofar that every section on the page with editing capabilites does what it should. I can add/edit/delete users, add/edit/delete quotations, and so forth. The sidebar is stationary on the leftside of the page at all times and I haven't figured out a better or nicer way of adding this sidebar's contents other than an element, but here's where the troubles start; I've been trying for a few hours to sort this thing out but I can't make one of my helpers accessible to the element. From what I've read here on the group it could be that it's not possible by design, but the answers have been a bit vague, so I'm not really sure of what to do. Here's the principle layout in wordings (I've copied the files contents to the bottom of this post); The following exists; Model - Controller - View (layout). The view uses renderElement() to invoke the element. The element contains a helper function call. The Controller has $helpers=[myHelper] defined. Problem: The helper isn't availbable in the Element. This is my file structure containing just the necessary (I think) information about my element and helper (btw, I'm not Cake-savvy in the least so there might be horrible errors or flaws, but I've also omitted alot of code to keep things a little less bloated); -[Model: notice.php]- class Notice extends AppModel { var $name = 'Notice'; } -[Controller: notices_controller.php]- class NoticesController extends AppController { var $name = 'Notices'; var $components = array('mysql'); var $helpers = array('Tools'); function index() { $notices = $this-Notice-findAll(); if(isset($this-params['requested'])) { return $notices; } $this-set('notices', $notices); } function add() { if(!empty($this-data)) { if($this-Notice-save($this-data)) { $this-flash('Notice added!', '/'); } } } function edit($id = null) { if(empty($this-data)) { $this-Notice-id = $id; $this-data = $this-Notice-read(); $this-set('notice', $this-Notice-read()); } else { if($this-Notice-save($this-data['Notice'])) { $this-flash('Notice updated!', '/'); } } } -[View: default.thtml]- ?php echo $this-renderElement('notices'); ? --[Element: notices.thtml]-- ?php $notices = $this-requestAction('notices/index'); ? ?php foreach($notices as $notice): ? div class=shortcaption?php echo $notice['Notice'] ['caption']; ?/div div class=shortmessage?php echo $notice['Notice']['text']; ? /div ?php echo $tools-getNoticesEdit($id); ? ?php endforeach; ? -[Helper: tools.php]- var $helpers = array('Html'); function getNoticesEdit($id) { {conditional statements, etc, etc} $return = somestring; return $return; } --~--~-~--~~~---~--~~ 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: How do I add a helper to an element
two things.. 1. If the view can see it, so can the element 2. if this is an element you are going to use all over the place (multiple controllers) you might as well just add the helper to app_controller class. On Jan 7, 4:22 pm, DrLaban [EMAIL PROTECTED] wrote: Hello all! I've been doing some Cake'ing for a while and find it lots of fun to work with seeing that it's quite fast and has a lot going for it so far. I'm having a bit of a headache with elements and helpers though, I've seen some notions about it but never quite figured it out so I thought I'd give this a shot to see if anyone can help me clear things up. What I'm trying to accomplish is quite simple; I have a sidebar to the left of my page where I'd like to add/edit/delete small notices (one short caption along with a short string of text). I've managed to make the entire site working insofar that every section on the page with editing capabilites does what it should. I can add/edit/delete users, add/edit/delete quotations, and so forth. The sidebar is stationary on the leftside of the page at all times and I haven't figured out a better or nicer way of adding this sidebar's contents other than an element, but here's where the troubles start; I've been trying for a few hours to sort this thing out but I can't make one of my helpers accessible to the element. From what I've read here on the group it could be that it's not possible by design, but the answers have been a bit vague, so I'm not really sure of what to do. Here's the principle layout in wordings (I've copied the files contents to the bottom of this post); The following exists; Model - Controller - View (layout). The view uses renderElement() to invoke the element. The element contains a helper function call. The Controller has $helpers=[myHelper] defined. Problem: The helper isn't availbable in the Element. This is my file structure containing just the necessary (I think) information about my element and helper (btw, I'm not Cake-savvy in the least so there might be horrible errors or flaws, but I've also omitted alot of code to keep things a little less bloated); -[Model: notice.php]- class Notice extends AppModel { var $name = 'Notice'; } -[Controller: notices_controller.php]- class NoticesController extends AppController { var $name = 'Notices'; var $components = array('mysql'); var $helpers = array('Tools'); function index() { $notices = $this-Notice-findAll(); if(isset($this-params['requested'])) { return $notices; } $this-set('notices', $notices); } function add() { if(!empty($this-data)) { if($this-Notice-save($this-data)) { $this-flash('Notice added!', '/'); } } } function edit($id = null) { if(empty($this-data)) { $this-Notice-id = $id; $this-data = $this-Notice-read(); $this-set('notice', $this-Notice-read()); } else { if($this-Notice-save($this-data['Notice'])) { $this-flash('Notice updated!', '/'); } } } -[View: default.thtml]- ?php echo $this-renderElement('notices'); ? --[Element: notices.thtml]-- ?php $notices = $this-requestAction('notices/index'); ? ?php foreach($notices as $notice): ? div class=shortcaption?php echo $notice['Notice'] ['caption']; ?/div div class=shortmessage?php echo $notice['Notice']['text']; ?/div ?php echo $tools-getNoticesEdit($id); ? ?php endforeach; ? -[Helper: tools.php]- var $helpers = array('Html'); function getNoticesEdit($id) { {conditional statements, etc, etc} $return = somestring; return $return; } --~--~-~--~~~---~--~~ 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: 1.2.0.6311 beta Session drop on redirect
Turns out I had a vendor file calling session_start(). Once I commented that out, it was fine. Downgrading the session files gave me the error. Interesting... On Jan 7, 3:17 pm, Damon [EMAIL PROTECTED] wrote: I'm having a problem with the session being dropped when I redirect. Controller1: $this-Session-set('foo',$foo); $this-redirect('/controller2'); Controller2: debug($_SESSION); // returns an empty array In core.php: Configure::write('debug', 2); Configure::write('Session.timeout', '120'); Configure::write('Session.start', true); Configure::write('Session.checkAgent', false); Configure::write('Security.level', 'low'); 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: Using model objects in the controllers
Good enough. I'll concede this one, then. Thanks, everyone, for your input. Deane On Jan 7, 5:21 pm, AD7six [EMAIL PROTECTED] wrote: On Jan 7, 11:35 pm, Deane [EMAIL PROTECTED] wrote: Assume this scenario: I need to retrieve 20 records, and call a method on each of them. So I do my Find, and get back an array. I then spin this, and do this: $this-Widget-read(null, $id); What has just happened from a SQL perspective? 21 separate SQL executions? (One for the loop, and 20 to hydrate the resulting objects, one-by-one...) Are you deliberately trying to be difficult ;). $data = $this-Widget-find('all'); foreach ($data as $results) { $this-Widget-create($result); $this-Widget-stuff(); } Total sql calls: 1 And that's unless you write stuff() to be able to batch process data. I feel it's time you either showed a real example of what you /can't/ do, or at least try things the cake way. 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 -~--~~~~--~~--~--~---