Re: funções genéricas
Acho q nesse caso era melhor vc criar um helper pra fazer isso. On 8/8/07, Rodrigo Xavier [EMAIL PROTECTED] wrote: Nope. Eu estou chamando a função dentro do index.thtml ou seja no view. A função apenas converte a data no padrão -mm-dd hh:mm:ss vinda de um campo created para dd/mm/. Tentei criar algo tipo AppView extends View (nem sei se existe) e também não deu certo. Alguma dica? On 8/8/07, Rodrigo Xavier [EMAIL PROTECTED] wrote: On 8/8/07, Maurício Pena [EMAIL PROTECTED] wrote: Como vc está chamando as funções? Nos meus controllers eu uso $this-nomeDaFuncao(); e funciona perfeitamente. Não coloquei o $this- para referenciar. Pode ser isso. On 8/8/07, Rodrigo Xavier [EMAIL PROTECTED] wrote: Pô Maurício, essa foi a primeira coisa que pensei, mas da undefined function quando chamo a função. Eu acho que só funções beforeFilter, beforeRender ou checkSession funcionam dentro do AppController Abraço, Rod On 8/8/07, Maurício Pena [EMAIL PROTECTED] wrote: Se vc quiser q elas fiquem disponiveis para todos os seus controllers coleque-as no app_controler.php On 8/8/07, Rodrigo Xavier [EMAIL PROTECTED] wrote: Gente, aonde posso colocar funções de uso geral no cake? São funções formatação de data, manipulação de strings ... coisas do tipo. Existe algum padrão? Abraços, Rod -- Rodrigo Guimarães Desenvolvedor Web -- Rodrigo Guimarães Desenvolvedor Web -- Rodrigo Guimarães Desenvolvedor Web --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Bug CAKEPHP
Olá Galera, blz? Estou rodando usando o cake pela primeira vez e esbarrei em um bug, que a princípio parece coisa simples, mas já tem 3 dias que estou agarrado com isso. É o seguinte, o code está funcionando direitinho, sem nenhum problema, so que na primeira linha do código gerado esta aparecendo um caracter especial ( aqueles quadradinhos, que fica aparecendo que n possui a fonte ) que está quebrando todo o meu layout, tipo que no mozilla funciona perfeitamente mas no IE 6 ele monta a página toda quebrada. Vocês podem ver no link abaixo o bug. http://5clicks.no-ip.org:8081/bug.jpg Esse bug parece ser alguma coisa de codificação, mas já mechi em tudo e nada resoluve. Alguem sabe como solucionar isso? Abraços, Marlos Carmo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Criptografar dados pessoais
Gostaria de criptografar os dados pessoais do usuário, como medida de segurança, sei que muita gente nem se preocupa com isso, porém, tenho interesse em faze-lo. No cakePHP eu não estou tendo muita produtividade devido estar aprendendo ainda, mas, utilizando o bake eu consigo render alguma coisa, sendo assim, vou publicar aqui um dos metodos criados para que alguém possa dar-me o exemplo de como criptografar. function add() { if(empty($this-data)) { $this-set('cidades', $this-Usuario-Cidade-generateList()); $this-render(); } else { $this-cleanUpFields(); if($this-Usuario-save($this-data)) { $this-Session-setFlash('The Usuario has been saved'); $this-redirect('/usuarios/index'); } else { $this-Session-setFlash('Please correct errors below.'); $this-set('cidades', $this-Usuario-Cidade-generateList()); } } } Gostaria de utilizar uma função em especial base64_encode(), porém a forma como o cake utiliza para salvar os dados não permite (aparentemente) que eu realize o procedimento nos campos que desejo. Neste caso preciso fazer no campo: senha Falopa! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ARO/ACO caches
Hi, I just look at the cache persistent folder and there's a aro/aco cache tables. How long does it persist there ? Can we cache per user/group data before it is being modified in database ? If so it will be great as it will decrease mysql connection overhead. Regards, Feris --~--~-~--~~~---~--~~ 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: Session Variable Returning Favicon.ico Instead of the Value I Set
Search the group, this has been answered before. It is because you have a relative link to an image file, and when your browser requests this it executes your action again. --~--~-~--~~~---~--~~ 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+SMF (again?)
For the record, I think you've gone a very much more complicated way around this than was necessary - I may be wrong, depending on exactly what you're trying to achieve, but wouldn't it have been simpler to hook into the SMF login/logout scripts from within your Cake apps? That way you would still effectively have 2 sessions, which would contain the same data (because you've written it to do that) but the 2 applications would be sharing information. I don't know what SMF's support is for doing stuff like that, I know that some of the other forum software allows it though. I'm just very confused as to what you're trying to do... Tufty On Aug 8, 8:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, It looks like I have solved the problem. SMF stores the session ID as default in the PHPSESSID cookie. Since CakePHP is checking it's own cookie for the session ID and cannot find it, it creates another cookie. So I solved the problem (I think) by changing CakePHP to simply use the PHPSESSID cookie for it's session. This way, regardless of which creates the session first (Cake or SMF), they use the same session. Is there a compelling reason that Cake was built to store it in a different cookie apart from flexibility (for example--security)? Thanks again. - Sohum. On Aug 7, 2:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I had actually tried this solution earlier but it seems that CakePHP only stores the session ID as a string in the cookie, whereas SMF seems to store other data as well. There may be a way to change SMF to have session-based data storage rather than cookie-based, which is something I will check in the SMF documentation. It also seems as if CakePHP rewrites that cookie on every pageload, because when I tried manually setting the CakePHP cookie to point to a different session ID, it got rewritten on page reload. I'll see if I can figure out also from the SMF forum what exactly is being stored in that cookie. Is it hard to completely disable the Cake Session component? It seems like it could be a lot easier just for the SMF session to be used for everything and CakePHP sessions not be created. I'll play around for a couple more hours to see if I can make any progress. - Sohum. On Aug 7, 2:52 pm, Geoff Ford [EMAIL PROTECTED] wrote: The cookies need to be the same name. They are looking for different cookies that tell what the session id is. Geoff --http://lemoncake.wordpress.com On Aug 7, 2:39 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Currently they are both using the database version of storing session data. I am confused, then, why a new session is created when one goes from one area of the site to another. For example, if I go into the Cake portion first, then a CAKEPHP cookie is created with a new session id that is added to the database. When I go to the SMF section, another session is created and another cookie is created (SMFCookie655). Is this because they have different cookie names? The SMF path is / whereas the Cake cookie path is the cake application directory. They will both be the same on the production server, though. - Sohum. On Aug 7, 3:59 am, Geoff Ford [EMAIL PROTECTED] wrote: I don't know the details of the cake session component, or sessions in general, but I believe that the sessions work by creating a cookie with a unique code. This code points to the session file (or db record) where the session data is stored. So from my understanding, as long as both smf and cakephp use the same cookie name, and that cookie has a path that is high enough in the domain path to cover both applications, then they will share the session data. If smf is using a custom session handler, such as a database or similar, you will have to replicate that session handler for the cake stuff. If they are both using the built in php file based session there should be no drama. Geoff On 8/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hmm. Maybe I should just ignore Cake sessions? Do sessions also have a path defined, and would this path have to be set to the server root or the cake root in SMF for that session data to transcend to the Cake application? I cannot see why else Cake would create a new session when there was already a session defined on that domain. - Sohum. On Aug 6, 7:38 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 8/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: How do I change the Cake session id to something of my choice? Basically, I want to put in a check on every page load to see if the forums session id has been created and if so, set the cake PHP session id to that, so that both applications use
Re: CakePHP+SMF (again?)
Yes, that is exactly what I wanted to do (use the SMF hooks using the provided SSI.php) but since SMF relies on the session data for these to work and Cake created its own session to handle this, the SSI.php file was not looking at the correct data. In all, the steps I have taken were not that complicated--it was just the intermediate experimentation that made it seem difficult. Basically what I did was: 1. Set SMF to use only global cookies. 2. Set CAKE_SESSION_COOKIE to be the default 'PHPSESSID'. 3. Modify the session handling functions in Cake to use the MySQL table used by SMF (forumprefix_sessions) I do believe it is working now on both IE6 and Firefox (more testing required, of course). Both applications use the same session so my only problem would be if the hard-coded session variables stored by Cake conflict with those stored by SMF. I'm not sure if there will be any security issue, though I do not foresee one (in my limited knowledge). Perhaps another solution would be to modify SMF's SSI.php file to set the session ID temporarily to the one used by SMF and then set it back again for the one used by Cake. I'm not sure if this would interfere in regeneration of session ID's, though, so I'm quite happy to stick to my current solution! - Sohum. On Aug 8, 12:45 pm, MrTufty [EMAIL PROTECTED] wrote: For the record, I think you've gone a very much more complicated way around this than was necessary - I may be wrong, depending on exactly what you're trying to achieve, but wouldn't it have been simpler to hook into the SMF login/logout scripts from within your Cake apps? That way you would still effectively have 2 sessions, which would contain the same data (because you've written it to do that) but the 2 applications would be sharing information. I don't know what SMF's support is for doing stuff like that, I know that some of the other forum software allows it though. I'm just very confused as to what you're trying to do... Tufty On Aug 8, 8:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, It looks like I have solved the problem. SMF stores the session ID as default in the PHPSESSID cookie. Since CakePHP is checking it's own cookie for the session ID and cannot find it, it creates another cookie. So I solved the problem (I think) by changing CakePHP to simply use the PHPSESSID cookie for it's session. This way, regardless of which creates the session first (Cake or SMF), they use the same session. Is there a compelling reason that Cake was built to store it in a different cookie apart from flexibility (for example--security)? Thanks again. - Sohum. On Aug 7, 2:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I had actually tried this solution earlier but it seems that CakePHP only stores the session ID as a string in the cookie, whereas SMF seems to store other data as well. There may be a way to change SMF to have session-based data storage rather than cookie-based, which is something I will check in the SMF documentation. It also seems as if CakePHP rewrites that cookie on every pageload, because when I tried manually setting the CakePHP cookie to point to a different session ID, it got rewritten on page reload. I'll see if I can figure out also from the SMF forum what exactly is being stored in that cookie. Is it hard to completely disable the Cake Session component? It seems like it could be a lot easier just for the SMF session to be used for everything and CakePHP sessions not be created. I'll play around for a couple more hours to see if I can make any progress. - Sohum. On Aug 7, 2:52 pm, Geoff Ford [EMAIL PROTECTED] wrote: The cookies need to be the same name. They are looking for different cookies that tell what the session id is. Geoff --http://lemoncake.wordpress.com On Aug 7, 2:39 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Currently they are both using the database version of storing session data. I am confused, then, why a new session is created when one goes from one area of the site to another. For example, if I go into the Cake portion first, then a CAKEPHP cookie is created with a new session id that is added to the database. When I go to the SMF section, another session is created and another cookie is created (SMFCookie655). Is this because they have different cookie names? The SMF path is / whereas the Cake cookie path is the cake application directory. They will both be the same on the production server, though. - Sohum. On Aug 7, 3:59 am, Geoff Ford [EMAIL PROTECTED] wrote: I don't know the details of the cake session component, or sessions in general, but I believe that the sessions work by creating a cookie with a unique code. This code points to the session file (or db record) where the session data is
Re: Append aggregate function data to the primary model
For your particlular example you could try count(Post.title) as `Post`.`count` In general this sort of thing is done in afterFind(). Just loop over the results and add the extra keys that you need. Geoff -- http://lemoncake.wordpress.com On Aug 8, 7:08 pm, mithesh [EMAIL PROTECTED] wrote: hi pls anybody can help me this is my query now i want the aggregate function data to be binded to primary model which is Post in this case . $posts=$this-Post-query(SELECT id , count(Post.title) as countFrom posts as Post Group By id); $this-set('posts', $posts); But the output is in the following way Array ( [Post] = Array ( [id] = 1 ) [0] = Array ( [count] = 1 ) ) I want the data to be like this : Array ( [Post] = Array ( [id] = 1 [count] = 1 ) ) Can anybody help me i wud be greatful --~--~-~--~~~---~--~~ 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: Browser redirection problem...!!! please help..!!!
If you have renamed the app folder you need to tell Cake where it is. Look in webroot/index.php. Same goes for the cake folder, if it is not in the standard location you need to change the define() in index.php. Geoff -- http://lemoncake.wordpress.com On Aug 8, 4:28 pm, Raul [EMAIL PROTECTED] wrote: I m working in CakePHP.I have check out a project from svn and named it as scheduler.Now the path to the webroot of scheduler is H:\www \webroot\cake\scheduler\main\jobscheduler\webroot. Then I have set my document root to /www/webroot/cake/scheduler/main/jobscheduler/ webroot. Bu t when i tryhttp://localhostinto by browser it displays nothing.I have checked out the error.log file which depricates- PHP Warning: require(cake\\bootstrap.php) [a href='function.require'function.require/a]: failed to open stream: No such file or directory in H:\\www\\webroot\\cake\\scheduler\\main\ \jobscheduler\\webroot\\index.php on line 79 PHP Fatal error: require() [a href='function.require'function.require/a]: Failed opening required 'cake\\bootstrap.php' (include_path='H:\\www\\webroot\\cake\\scheduler\ \main;H:\\www\\webroot\\cake\\scheduler\\main\\jobscheduler\\;.') in H: \\www\\webroot\\cake\\scheduler\\main\\jobscheduler\\webroot\ \index.php on line 79 also mod_deflate.c(447): [client 127.0.0.1] Zlib: Compressed 0 to 2 : URL / index.php [debug] mod_headers.c(612): headers: ap_headers_output_filter() BUT when i cut paste my application folder named as jobschedular to the path H:\www\webroot\cake set document root to /www/webroot/ cake/jobscheduler '...it works fine..no error.. My .htacces file looks like- IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule please help.. [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP+SMF (again?)
You don't need to modify cake. All you have to do is modify config/core.php: define('CAKE_SESSION_SAVE http://api.cakephp.org/1.2/app_2config_2core_8php.html#ebaae21321d4c610deade48dcd1f26ef', 'database'); // sets cake to use database sessions define('CAKE_SESSION_TABLE http://api.cakephp.org/1.2/app_2config_2core_8php.html#c65b43b580694575b3b45a1760065331', 'forumprefix_sessions'); // tells cake which table to use define('CAKE_SESSION_COOKIE http://api.cakephp.org/1.2/app_2config_2core_8php.html#daabb9dafb18df97be529130c1fc6a40', 'PHPSESSID'); // tells cake which cookie holds the session id Thats all that you should need to do. Then from within cake you can call the ssi_ functions as normal and all should be fine. Geoff On 8/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, that is exactly what I wanted to do (use the SMF hooks using the provided SSI.php) but since SMF relies on the session data for these to work and Cake created its own session to handle this, the SSI.php file was not looking at the correct data. In all, the steps I have taken were not that complicated--it was just the intermediate experimentation that made it seem difficult. Basically what I did was: 1. Set SMF to use only global cookies. 2. Set CAKE_SESSION_COOKIE to be the default 'PHPSESSID'. 3. Modify the session handling functions in Cake to use the MySQL table used by SMF (forumprefix_sessions) I do believe it is working now on both IE6 and Firefox (more testing required, of course). Both applications use the same session so my only problem would be if the hard-coded session variables stored by Cake conflict with those stored by SMF. I'm not sure if there will be any security issue, though I do not foresee one (in my limited knowledge). Perhaps another solution would be to modify SMF's SSI.php file to set the session ID temporarily to the one used by SMF and then set it back again for the one used by Cake. I'm not sure if this would interfere in regeneration of session ID's, though, so I'm quite happy to stick to my current solution! - Sohum. On Aug 8, 12:45 pm, MrTufty [EMAIL PROTECTED] wrote: For the record, I think you've gone a very much more complicated way around this than was necessary - I may be wrong, depending on exactly what you're trying to achieve, but wouldn't it have been simpler to hook into the SMF login/logout scripts from within your Cake apps? That way you would still effectively have 2 sessions, which would contain the same data (because you've written it to do that) but the 2 applications would be sharing information. I don't know what SMF's support is for doing stuff like that, I know that some of the other forum software allows it though. I'm just very confused as to what you're trying to do... Tufty On Aug 8, 8:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, It looks like I have solved the problem. SMF stores the session ID as default in the PHPSESSID cookie. Since CakePHP is checking it's own cookie for the session ID and cannot find it, it creates another cookie. So I solved the problem (I think) by changing CakePHP to simply use the PHPSESSID cookie for it's session. This way, regardless of which creates the session first (Cake or SMF), they use the same session. Is there a compelling reason that Cake was built to store it in a different cookie apart from flexibility (for example--security)? Thanks again. - Sohum. On Aug 7, 2:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I had actually tried this solution earlier but it seems that CakePHP only stores the session ID as a string in the cookie, whereas SMF seems to store other data as well. There may be a way to change SMF to have session-based data storage rather than cookie-based, which is something I will check in the SMF documentation. It also seems as if CakePHP rewrites that cookie on every pageload, because when I tried manually setting the CakePHP cookie to point to a different session ID, it got rewritten on page reload. I'll see if I can figure out also from the SMF forum what exactly is being stored in that cookie. Is it hard to completely disable the Cake Session component? It seems like it could be a lot easier just for the SMF session to be used for everything and CakePHP sessions not be created. I'll play around for a couple more hours to see if I can make any progress. - Sohum. On Aug 7, 2:52 pm, Geoff Ford [EMAIL PROTECTED] wrote: The cookies need to be the same name. They are looking for different cookies that tell what the session id is. Geoff --http://lemoncake.wordpress.com On Aug 7, 2:39 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Currently they are both using the database version of storing session data. I am confused, then, why a new session
Cake Url Alias - anyone used it before?
Has anyone had much experience on using CakeUrlAlias (http:// www.thinkingphp.org/2006/05/17/url-aliases-for-cakephp/) on a site? It's the perfect solution for my needs as I need something that catches URLs that don't match up with a controller, passes those URLs onto another controller, which then looks it up in the database. If it matches in the database it will display that content, otherwise it returns a 404 error. However I am having trouble getting it to work for two reasons:- 1. It doesn't handle admin routing, though this could be easily addressed by modifying the CakeUrlAlias_ControllerExists function. 2. When I do throw a 404 error using $this-cakeError it always crashes Apache --~--~-~--~~~---~--~~ 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+SMF (again?)
Yes, that is pretty much what I have ended up doing (albeit through a long-winded process). I did actually have to modify Cake's session functions because the SMF sessions table uses different column headings and stores some more data. Also, SMF sessions stores session id in a field session_id whereas Cake stores it in id (or maybe its the other way around). Seeing that Cake's session handling functions are in an easily accessible location and SMF's are stored away in some place I couldn't find, I went ahead and modified Cake's. - Sohum. On Aug 8, 2:55 pm, Geoff Ford [EMAIL PROTECTED] wrote: You don't need to modify cake. All you have to do is modify config/core.php: define('CAKE_SESSION_SAVE http://api.cakephp.org/1.2/app_2config_2core_8php.html#ebaae21321d4c6...', 'database'); // sets cake to use database sessions define('CAKE_SESSION_TABLE http://api.cakephp.org/1.2/app_2config_2core_8php.html#c65b43b5806945...', 'forumprefix_sessions'); // tells cake which table to use define('CAKE_SESSION_COOKIE http://api.cakephp.org/1.2/app_2config_2core_8php.html#daabb9dafb18df...', 'PHPSESSID'); // tells cake which cookie holds the session id Thats all that you should need to do. Then from within cake you can call the ssi_ functions as normal and all should be fine. Geoff On 8/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, that is exactly what I wanted to do (use the SMF hooks using the provided SSI.php) but since SMF relies on the session data for these to work and Cake created its own session to handle this, the SSI.php file was not looking at the correct data. In all, the steps I have taken were not that complicated--it was just the intermediate experimentation that made it seem difficult. Basically what I did was: 1. Set SMF to use only global cookies. 2. Set CAKE_SESSION_COOKIE to be the default 'PHPSESSID'. 3. Modify the session handling functions in Cake to use the MySQL table used by SMF (forumprefix_sessions) I do believe it is working now on both IE6 and Firefox (more testing required, of course). Both applications use the same session so my only problem would be if the hard-coded session variables stored by Cake conflict with those stored by SMF. I'm not sure if there will be any security issue, though I do not foresee one (in my limited knowledge). Perhaps another solution would be to modify SMF's SSI.php file to set the session ID temporarily to the one used by SMF and then set it back again for the one used by Cake. I'm not sure if this would interfere in regeneration of session ID's, though, so I'm quite happy to stick to my current solution! - Sohum. On Aug 8, 12:45 pm, MrTufty [EMAIL PROTECTED] wrote: For the record, I think you've gone a very much more complicated way around this than was necessary - I may be wrong, depending on exactly what you're trying to achieve, but wouldn't it have been simpler to hook into the SMF login/logout scripts from within your Cake apps? That way you would still effectively have 2 sessions, which would contain the same data (because you've written it to do that) but the 2 applications would be sharing information. I don't know what SMF's support is for doing stuff like that, I know that some of the other forum software allows it though. I'm just very confused as to what you're trying to do... Tufty On Aug 8, 8:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, It looks like I have solved the problem. SMF stores the session ID as default in the PHPSESSID cookie. Since CakePHP is checking it's own cookie for the session ID and cannot find it, it creates another cookie. So I solved the problem (I think) by changing CakePHP to simply use the PHPSESSID cookie for it's session. This way, regardless of which creates the session first (Cake or SMF), they use the same session. Is there a compelling reason that Cake was built to store it in a different cookie apart from flexibility (for example--security)? Thanks again. - Sohum. On Aug 7, 2:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I had actually tried this solution earlier but it seems that CakePHP only stores the session ID as a string in the cookie, whereas SMF seems to store other data as well. There may be a way to change SMF to have session-based data storage rather than cookie-based, which is something I will check in the SMF documentation. It also seems as if CakePHP rewrites that cookie on every pageload, because when I tried manually setting the CakePHP cookie to point to a different session ID, it got rewritten on page reload. I'll see if I can figure out also from the SMF forum what exactly is being stored in that cookie. Is it hard to completely disable the Cake Session component? It seems like it could be a lot easier just for the SMF
Re: Cake Url Alias - anyone used it before?
I'm the one who wrote that post. By now there are better solutions available to handle this problem. I'd suggest to check out the AppError class and how you can use it to catch the missingController error. You will however need to take care of recursion yourself. -- Felix -- My Blog: http://www.thinkingphp.org My Business: http://www.fg-webdesign.de Matt wrote: Has anyone had much experience on using CakeUrlAlias (http:// www.thinkingphp.org/2006/05/17/url-aliases-for-cakephp/) on a site? It's the perfect solution for my needs as I need something that catches URLs that don't match up with a controller, passes those URLs onto another controller, which then looks it up in the database. If it matches in the database it will display that content, otherwise it returns a 404 error. However I am having trouble getting it to work for two reasons:- 1. It doesn't handle admin routing, though this could be easily addressed by modifying the CakeUrlAlias_ControllerExists function. 2. When I do throw a 404 error using $this-cakeError it always crashes Apache --~--~-~--~~~---~--~~ 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 to build form with multiple records?
Hi Geoff did you have any luck with getting this feature to work? Can I also thank you for your posts in this group on multiple saves as they've been very helpful. Coincidentally I am trying to get many RoomsTasks submitted from a form at once, and I have managed to loop through POSTed data and successfuly save it, from a form with inputs in form - data[RoomsTask][213][quantity_of_unit] data[RoomsTask][218][quantity_of_unit] data[RoomsTask][224][quantity_of_unit] etc(where I use the 224 to specify the task_id and I manipulate this in the controller before saving: foreach($this-data['RoomsTask'] as $taskIdNow = $roomsTask){ // only if user checked the task, obviously: if ($roomsTask['task_id'] == 1) { // perform save code $this-RoomsTask-create(); // assign all the fields with correct names // Todo: taken from a hidden field - take from session? $roomsTask['room_id'] = $this-data['Meta']['room_id']; $roomsTask['task_id'] = $taskIdNow; // we need to swap this value over, as it's a unique task we are adding! // priority? $this-RoomsTask-set($roomsTask); // this adds the quantity_of_unit also. //pr($this-RoomsTask-data); // Validation - tricky as need to remember the values too :/ // if (!$this-RoomsTask-validates()) { // if it is Quantity - we must inform user of error, otherwise, we just don't Save it as a checkbox/hidden should validate! if (isset($this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit'])) { $this-RoomsTask-invalidFields['RoomsTask'][$taskIdNow] ['quantity_of_unit'] = $this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit']; unset($this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit']); } } else { $this-RoomsTask-save(); $flashMsg .= 'saved '; //pr($this-RoomsTask-data); } } But I cannot get the validation and re-display of values working, since setting the $this-RoomsTask-invalidFields['RoomsTask'] [$taskIdNow]['quantity_of_unit'] doesnt work. any ideas on how to re-display in the view values and error messages for appropriate fields? many thanks Luke On Jul 26, 12:27 am, Geoff Ford [EMAIL PROTECTED] wrote: Hmm.. Very interesting. I had not seen that before. I might have a play later on and see if I can get it to work. I'll let you know how I go. Geoff --http://lemoncake.wordpress.com On Jul 26, 8:49 am, chewie124 [EMAIL PROTECTED] wrote: Ahhh... ok. Thanks for the input. I was grepping thru the helpers.php library in the cake core, and it looks like in the setFormTag function , if there's a 3rd level branch,ie FormerEmployer. 2.name, the '2' will get parsed and tagged as the 'modelId'. Seems like though, the propigation hasn't made it back to the form helper, that can use the modelId to generate the input tags as you described above. Thanks for the input! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake Url Alias - anyone used it before?
Thanks for the pointer Felix. Based on what you are saying the best solution would be something along these lines: http://cakebaker.wordpress.com/2006/06/15/writing-a-custom-error-handler/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Between Join producing invalid SQL
Hi All. I'm fairly new to coding in Cake and can't find any resource to help me solve this problem. I appear to be doing the same as all the code snippets I have seen, but I must be missing something. The following code $conditions['AND']['Target.month'] = BETWEEN $startMonth and $endMonth; $targets = $this-Target-findAll($conditions); produces this SQL SELECT `Target`.`id`, `Target`.`month`, `Target`.`income-type`, `Target`.`target`, `Target`.`actual` FROM `targets` AS `Target` WHERE `Target`.`month` BETWEEN '200707 and 200710' but this isn't valid. What I was hoping for was SELECT `Target`.`id`, `Target`.`month`, `Target`.`income-type`, `Target`.`target`, `Target`.`actual` FROM `targets` AS `Target` WHERE `Target`.`month` BETWEEN '200707' and '200710' Note the extra 2 quotes after the first date and before the second date. After giving up on this I tried to solve it by changing the code to target.month = '200707' and target.month = '200710' but I couldn't work out how to do this either. I could obviously do either by using a custom sql statement, but that feels like cheating and isn't going to help me learn whats going on! Your help is greatly 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 -~--~~~~--~~--~--~---
Undefined index: Language in filtr_lang.thtml
Hello I want to filter my view by passing a language_id in the view. ( Subcategory can have many categories , category can have many languages ) Does anyone know why i getting this error? --- ERROR: Notice: Undefined index: Language in C:\wamp\www\inz_cake\app\views \subcategories\filtr_lang.thtml on line 19 - Controler class SubcategoriesController extends AppController { var $name = 'Subcategories'; var $uses = array('Subcategory' , 'Category' , 'Language' , 'Menu'); function filtr_lang($id = null) { $this-set('filtr_langs', $this-Subcategory- findAll(array('Category.language_id' =$id ))); } } filtr_lang.thtml ?php foreach ($filtr_langs as $filtr_lang): ? ?php echo $filtr_lang['Language']['jezyk']; ? ?php endforeach; ? -- MODEL CATEGORY class Category extends AppModel { var $belongsTo = array( 'Menu' = array( 'className' = 'Menu', 'foreignKey' = 'menu_id' ), 'Language' = array( 'className' = 'Language', 'foreignKey' = 'language_id' ) ); var $hasMany = array( 'Subcategory' = array( 'className' = 'Subcategory', 'foreignKey' = 'category_id' ) ); } - MODEL SUBCATEGORY class Subcategory extends AppModel { var $belongsTo = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'category_id' ) ); --- MODEL LANGUAGE class Language extends AppModel { var $hasMany = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'language_id' ) ); -- Please help Stanley --~--~-~--~~~---~--~~ 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 to build form with multiple records?
sorry I was calling invalidFields wrong way there - think I have fixed it! On Aug 8, 12:45 pm, luke BAKING barker [EMAIL PROTECTED] wrote: Hi Geoff did you have any luck with getting this feature to work? Can I also thank you for your posts in this group on multiple saves as they've been very helpful. Coincidentally I am trying to get many RoomsTasks submitted from a form at once, and I have managed to loop through POSTed data and successfuly save it, from a form with inputs in form - data[RoomsTask][213][quantity_of_unit] data[RoomsTask][218][quantity_of_unit] data[RoomsTask][224][quantity_of_unit] etc(where I use the 224 to specify the task_id and I manipulate this in the controller before saving: foreach($this-data['RoomsTask'] as $taskIdNow = $roomsTask){ // only if user checked the task, obviously: if ($roomsTask['task_id'] == 1) { // perform save code $this-RoomsTask-create(); // assign all the fields with correct names // Todo: taken from a hidden field - take from session? $roomsTask['room_id'] = $this-data['Meta']['room_id']; $roomsTask['task_id'] = $taskIdNow; // we need to swap this value over, as it's a unique task we are adding! // priority? $this-RoomsTask-set($roomsTask); // this adds the quantity_of_unit also. //pr($this-RoomsTask-data); // Validation - tricky as need to remember the values too :/ // if (!$this-RoomsTask-validates()) { // if it is Quantity - we must inform user of error, otherwise, we just don't Save it as a checkbox/hidden should validate! if (isset($this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit'])) { $this-RoomsTask-invalidFields['RoomsTask'][$taskIdNow] ['quantity_of_unit'] = $this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit']; unset($this-RoomsTask-invalidFields['RoomsTask'] ['quantity_of_unit']); } } else { $this-RoomsTask-save(); $flashMsg .= 'saved '; //pr($this-RoomsTask-data); } } But I cannot get the validation and re-display of values working, since setting the $this-RoomsTask-invalidFields['RoomsTask'] [$taskIdNow]['quantity_of_unit'] doesnt work. any ideas on how to re-display in the view values and error messages for appropriate fields? many thanks Luke On Jul 26, 12:27 am, Geoff Ford [EMAIL PROTECTED] wrote: Hmm.. Very interesting. I had not seen that before. I might have a play later on and see if I can get it to work. I'll let you know how I go. Geoff --http://lemoncake.wordpress.com On Jul 26, 8:49 am, chewie124 [EMAIL PROTECTED] wrote: Ahhh... ok. Thanks for the input. I was grepping thru the helpers.php library in the cake core, and it looks like in the setFormTag function , if there's a 3rd level branch,ie FormerEmployer. 2.name, the '2' will get parsed and tagged as the 'modelId'. Seems like though, the propigation hasn't made it back to the form helper, that can use the modelId to generate the input tags as you described above. Thanks for the input! --~--~-~--~~~---~--~~ 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: RequestHandler-isAjax not returning expected data
Jim, thanks for the tip. Although that is not a concern in this scenario, that is definitely good to know. Samuel, I'm just using a little self-written ajax...no libraries. That's probably my issue. Thanks to you both 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: Bug Found?
This is a problem with the overridding function in dbdesigner2cake.php. I just found the uses function in the core and it does use strtolower so no bug with cake. Thanks Grant Brian On Aug 8, 2:21 am, Grant Cox [EMAIL PROTECTED] wrote: If it's still happens in the latest 1.1.x SVN then it is a bug, and should be reported onhttps://trac.cakephp.org/ However, in 1.2.x the uses() function in basics.php specifically calls strtolower to avoid this problem. So maybe it's just been fixed since 1.1.16 On Aug 8, 1:21 pm, supercake [EMAIL PROTECTED] wrote: Hello All, I am working with cake 1.1.16.5421 and dbdesigner2cake and was getting a strange error message about not being able to find Set. Upon inspection there is an overriding function in dbdesigner2cake called uses. I'm still new to cakephp but in the inflector.php line 36 is uses('Set');. Anyways it is trying to look for a file named set.php, and since the S is upper case it is not found. I changed inflector.php to a lower case s and everything is working just fine now. I'm not sure if this is a bug or not or if Ijust messed up my development site. Thanks, Brian --~--~-~--~~~---~--~~ 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: Undefined index: Language in filtr_lang.thtml
Try using var recursive=3 in your model.. On 8/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello I want to filter my view by passing a language_id in the view. ( Subcategory can have many categories , category can have many languages ) Does anyone know why i getting this error? --- ERROR: Notice: Undefined index: Language in C:\wamp\www\inz_cake\app\views \subcategories\filtr_lang.thtml on line 19 - Controler class SubcategoriesController extends AppController { var $name = 'Subcategories'; var $uses = array('Subcategory' , 'Category' , 'Language' , 'Menu'); function filtr_lang($id = null) { $this-set('filtr_langs', $this-Subcategory- findAll(array('Category.language_id' =$id ))); } } filtr_lang.thtml ?php foreach ($filtr_langs as $filtr_lang): ? ?php echo $filtr_lang['Language']['jezyk']; ? ?php endforeach; ? -- MODEL CATEGORY class Category extends AppModel { var $belongsTo = array( 'Menu' = array( 'className' = 'Menu', 'foreignKey' = 'menu_id' ), 'Language' = array( 'className' = 'Language', 'foreignKey' = 'language_id' ) ); var $hasMany = array( 'Subcategory' = array( 'className' = 'Subcategory', 'foreignKey' = 'category_id' ) ); } - MODEL SUBCATEGORY class Subcategory extends AppModel { var $belongsTo = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'category_id' ) ); --- MODEL LANGUAGE class Language extends AppModel { var $hasMany = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'language_id' ) ); -- Please help Stanley --~--~-~--~~~---~--~~ 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: Undefined index: Language in filtr_lang.thtml
Thank you for your answer. Try using var $recursive=3 in your model.. Categories Model ? or in each Model ? Regards Stanley --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
cookies ajax
to login I use ajax form and I am trying to setcookie on action and it just does not set the cookie in this action . When I redirect the page to different controller , action and set cookies there its working. Why cookie does not work on action with ajax form ? did that setcookie(remember_me, '3', time()+3600); and that $_COOKIES['remember_me'] = '3'; thanks for 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: cookies ajax
On Aug 8, 2007, at 9:51 AM, Michael Augustyniak wrote: to login I use ajax form and I am trying to setcookie on action and it just does not set the cookie in this action . When I redirect the page to different controller , action and set cookies there its working. Why cookie does not work on action with ajax form ? did that setcookie(remember_me, '3', time()+3600); and that $_COOKIES['remember_me'] = '3'; Is there any reason you're not just creating the cookies with JavaScript? -- John --~--~-~--~~~---~--~~ 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 to build form with multiple records?
On Jul 25, 6:27 pm, Geoff Ford [EMAIL PROTECTED] wrote: Hmm.. Very interesting. I had not seen that before. I might have a play later on and see if I can get it to work. I'll let you know how I go. Geoff --http://lemoncake.wordpress.com I've also been interested in seeing what it would mean to have the core support for fields in such a format: data[Model][?= $i; ?][id] I don't think it's trivial. I wonder if the devs consider this too edge case, it would surely be slick. -- Travis --~--~-~--~~~---~--~~ 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: Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?
Hi! I've come across the same problem, using hasOne associations, but with an extra problem. in ModelA: $hasOne = array('ModelB' = array('foreign_key' = 'model_b', 'conditions' = array('ModelA.some_field' = 'some_value'))); With this association, if recursive is larger than 1, Cake will try to select from ModelB and will fail because it aplies the condition ModelA.some_field = 'some_value' and ModelA isn't included in this query. With $recursive = 1 (or 0) everything works fine since only the LEFT JOIN query is executed. Best regards. Gonçalo. On Jul 16, 3:55 pm, Nick [EMAIL PROTECTED] wrote: No private emails please. The bulk of your question is answered in the first result of that search: Sorry, it was actually intended for the group. And thanks for the link. I think it was one that I'd seen already, but doesn't have an explanation other than a vague comment that the limitation is required for Cake's Models to do their associative data mapping magic. Having multiple queries where there would be repeated data is certainly fair enough, but an algorithm to combine one to one mappings into a near optimal singlequeryshould be possible, particularly in the trivial case described. If it turned out to be to hard to get right in some cases when some other associations are involved for example, then provided that a schema can be determined to be simple or hairy, an appropriate algorithm could be selected as necessary. So it is a weakness, but not the end of the world as one can always use a handbuiltquerywithout too much effort. --~--~-~--~~~---~--~~ 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: Link to a location on the same page
I changed the name to be #Verbs but when I click it I get redirected to the URL: /top_tiers/index#Verbs. This page displays exactly like / top_tiers/index would. I don't know how I'd implement $html-link() because it asks for a URL and an array but I want the same array. Has anyone got any ideas or an example for the problem? Dave On Aug 7, 11:55 pm, Geoff Ford [EMAIL PROTECTED] wrote: Bookmarks use #bookmarkName last time I checked. Geoff --http://lemoncake.wordpress.com On Aug 8, 11:50 am, Chris Hartjes [EMAIL PROTECTED] wrote: On 8/7/07, mussond [EMAIL PROTECTED] wrote: Hey all, I trying to create a bookmark link on my page. I couldn't find anything in api that would let me do this, so I've tried to do it using HTML but when I click the link I get a page saying I have a missing controller, $Verbs. Below is part of my HTML code. I can see how the $Verbs controller comes about as its the name of my bookmark. How do I get it follow the HTML and not Cake? Why can't you use $html-link() ? -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: Just build it, damnit! @TheBallpark -http://www.littlehart.net/attheballpark @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 -~--~~~~--~~--~--~---
How to use recursive option in Model or in controller?
I want filter my subcategories by language_id ( this is a foreign key in categories table and primary key in languages table). I use recursive option ( $this-Subcategory-recursive = 3; ) in my controller but i'm still getting this error. Which value should i use ? 3 or 2 ? Error in my view: Notice: Undefined index: Language subcategories_controller $this-set('filtr_langs', $this-Subcategory- findAll(array('Category.language_id' =$id))); view: foreach ($filtr_langs as $filtr_lang): echo $filtr_lang['Subcategory']['id']; echo $filtr_lang['Subcategory']['link']; echo $filtr_lang['Category']['kategoria']; echo $filtr_lang['Language']['jezyk']; echo $filtr_lang['Subcategory']['podkategoria']; php endforeach; ? models: -- MODEL CATEGORY class Category extends AppModel { var $belongsTo = array( 'Menu' = array( 'className' = 'Menu', 'foreignKey' = 'menu_id' ), 'Language' = array( 'className' = 'Language', 'foreignKey' = 'language_id' ) ); var $hasMany = array( 'Subcategory' = array( 'className' = 'Subcategory', 'foreignKey' = 'category_id' ) ); } MODEL SUBCATEGORY class Subcategory extends AppModel { var $belongsTo = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'category_id' ) ); --- MODEL LANGUAGE class Language extends AppModel { var $hasMany = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'language_id' ) ); -- ANY IDEAS? Stanley --~--~-~--~~~---~--~~ 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: cookies ajax
John David Anderson (_psychic_) wrote: On Aug 8, 2007, at 9:51 AM, Michael Augustyniak wrote: to login I use ajax form and I am trying to setcookie on action and it just does not set the cookie in this action . When I redirect the page to different controller , action and set cookies there its working. Why cookie does not work on action with ajax form ? did that setcookie(remember_me, '3', time()+3600); and that $_COOKIES['remember_me'] = '3'; Is there any reason you're not just creating the cookies with JavaScript? not but it extra code which I do not need, but probably it's the only way --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cannot instantiate non-existent class
Hello all! I'm stumped, can anyone take a moment and help me figure out why I'm getting these errors? Warning: overload() was unable to locate class 'sarossarg' in \cake \cake\basics.php on line 233 Fatal error: Cannot instantiate non-existent class: sarossarg in \cake \cake\libs\model\model_php4.php on line 452 Basically, my tables look like this (where - and - mean one-to-many) sargs - sargs_saros - saros Here are my models for the three tables: class Saros_Sarg extends AppModel { var $name = 'SarosSarg'; var $validate = array( 'saro_id' = VALID_NOT_EMPTY, 'sarg_id' = VALID_NOT_EMPTY ); var $belongsTo = array('Saro', 'Sarg'); } class Saro extends AppModel { var $name = 'Saro'; var $displayField = 'name'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } class Sarg extends AppModel { var $name = 'Sarg'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } Here is the join table definition: CREATE TABLE `saros_sargs` ( `id` int(11) NOT NULL auto_increment, `saro_id` int(11) NOT NULL default '0', `sarg_id` int(11) NOT NULL default '0', `status` char(1) NOT NULL default 'A', `created` datetime NOT NULL default '-00-00 00:00:00', `modified` datetime default NULL, PRIMARY KEY (`id`) ) My controllers are just vanilla right now; all they do is give the name and define $scaffold. Thanks for any help you can give! Shawn --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session empty in Ajax call
Hi, I'm making an Ajax call from the index page of my application to a simple controller called attachments, to a function named add(). I have a session variable called User which I can print on the index page, but which is empty in the attachments controller. If I do a pr($_SESSION) in attachments/add() all I get is the attributes 'useragent', 'time' and 'random', where I should be getting a whole host of other stuff I've stored in the session. Any idea why? It is a JavaScript + Flash widget called SWFUpload making the Ajax call, so my only thought is that it does something funny to the request that prevents Cake from initialising the session properly, but that sounds pretty far fetched. The session is definitely initialised, as a session_start() will generate an error in the log. I've looked in the $_SERVER variable and the logs but didn't find anything funny. Not sure where else to look. Any help very much appreciated! Simon --~--~-~--~~~---~--~~ 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 pagination url
hello. i defined for some parts of my new project some custom-made urls in the routes definition, they look like this: Router::connect('/groups/:group_url/:action/*',array('controller' = 'groups', 'action' = 'show')); Example: http://mywebsite.com/groups/the-name-of-a-group/topic/10/ $this-params['action'] = topic $this-params['controller'] = groups $this-params['group_url'] = the-name-of-a-group in the groups controller: // show messages that belong to topic public function topic($id) { $this-paginate = array( 'limit' = 15, 'page' = 1, 'order' = array('GroupMessage.created' = 'asc') ); $this-set('messages', $this-paginate('GroupMessage', array('GroupMessage.group_topic_id' = $id))); } Everything works fine at the first page, 15 rows and the pagination- numbers are displayed in the view ... but the generated urls look like this: http://mywebsite.com/groups/topic/page:2 How can i force the pagination to show a custom url. I played with the $this-paginate[url] ... but it without success. 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: Session empty in Ajax call
On Aug 8, 2007, at 10:26 AM, simon wrote: Hi, I'm making an Ajax call from the index page of my application to a simple controller called attachments, to a function named add(). I have a session variable called User which I can print on the index page, but which is empty in the attachments controller. If I do a pr($_SESSION) in attachments/add() all I get is the attributes 'useragent', 'time' and 'random', where I should be getting a whole host of other stuff I've stored in the session. Any idea why? It is a JavaScript + Flash widget called SWFUpload making the Ajax call, so my only thought is that it does something funny to the request that prevents Cake from initialising the session properly, but that sounds pretty far fetched. The session is definitely initialised, as a session_start() will generate an error in the log. I've looked in the $_SERVER variable and the logs but didn't find anything funny. Not sure where else to look. Most likely your session is getting nixed because another user-agent is trying to access the data (i.e. the Flash object). Are your session IDs changing between requests? -- John --~--~-~--~~~---~--~~ 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: Cannot instantiate non-existent class
class SarosSarg extends AppModel On 8/8/07, starkey [EMAIL PROTECTED] wrote: Hello all! I'm stumped, can anyone take a moment and help me figure out why I'm getting these errors? Warning: overload() was unable to locate class 'sarossarg' in \cake \cake\basics.php on line 233 Fatal error: Cannot instantiate non-existent class: sarossarg in \cake \cake\libs\model\model_php4.php on line 452 Basically, my tables look like this (where - and - mean one-to-many) sargs - sargs_saros - saros Here are my models for the three tables: class Saros_Sarg extends AppModel { var $name = 'SarosSarg'; var $validate = array( 'saro_id' = VALID_NOT_EMPTY, 'sarg_id' = VALID_NOT_EMPTY ); var $belongsTo = array('Saro', 'Sarg'); } class Saro extends AppModel { var $name = 'Saro'; var $displayField = 'name'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } class Sarg extends AppModel { var $name = 'Sarg'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } Here is the join table definition: CREATE TABLE `saros_sargs` ( `id` int(11) NOT NULL auto_increment, `saro_id` int(11) NOT NULL default '0', `sarg_id` int(11) NOT NULL default '0', `status` char(1) NOT NULL default 'A', `created` datetime NOT NULL default '-00-00 00:00:00', `modified` datetime default NULL, PRIMARY KEY (`id`) ) My controllers are just vanilla right now; all they do is give the name and define $scaffold. Thanks for any help you can give! Shawn -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot instantiate non-existent class
Thank you for looking after this noobie. Shawn On Aug 8, 12:58 pm, Samuel DeVore [EMAIL PROTECTED] wrote: class SarosSarg extends AppModel On 8/8/07, starkey [EMAIL PROTECTED] wrote: Hello all! I'm stumped, can anyone take a moment and help me figure out why I'm getting these errors? Warning: overload() was unable to locate class 'sarossarg' in \cake \cake\basics.php on line 233 Fatal error: Cannot instantiate non-existent class: sarossarg in \cake \cake\libs\model\model_php4.php on line 452 Basically, my tables look like this (where - and - mean one-to-many) sargs - sargs_saros - saros Here are my models for the three tables: class Saros_Sarg extends AppModel { var $name = 'SarosSarg'; var $validate = array( 'saro_id' = VALID_NOT_EMPTY, 'sarg_id' = VALID_NOT_EMPTY ); var $belongsTo = array('Saro', 'Sarg'); } class Saro extends AppModel { var $name = 'Saro'; var $displayField = 'name'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } class Sarg extends AppModel { var $name = 'Sarg'; var $validate = array( 'name' = VALID_NOT_EMPTY ); var $hasMany = array('SarosSarg'); } Here is the join table definition: CREATE TABLE `saros_sargs` ( `id` int(11) NOT NULL auto_increment, `saro_id` int(11) NOT NULL default '0', `sarg_id` int(11) NOT NULL default '0', `status` char(1) NOT NULL default 'A', `created` datetime NOT NULL default '-00-00 00:00:00', `modified` datetime default NULL, PRIMARY KEY (`id`) ) My controllers are just vanilla right now; all they do is give the name and define $scaffold. Thanks for any help you can give! Shawn -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot instantiate non-existent class
So did it work, if so you might spend some time learning to love and live the conventions. http://manual.cakephp.org/appendix/conventions in many ways it is the MOST important part of the manual, if you can live the conventions your life will be so much better (well your life with cakephp) anytime you stray (and people do stray) you should expect pain and heart aches Sam On 8/8/07, starkey [EMAIL PROTECTED] wrote: Thank you for looking after this noobie. On Aug 8, 12:58 pm, Samuel DeVore [EMAIL PROTECTED] wrote: class SarosSarg extends AppModel On 8/8/07, starkey [EMAIL PROTECTED] wrote: I'm stumped, can anyone take a moment and help me figure out why I'm getting these errors? Warning: overload() was unable to locate class 'sarossarg' in \cake \cake\basics.php on line 233 -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session empty in Ajax call
Not sure... where is the session id located? S On Aug 8, 5:56 pm, John David Anderson (_psychic_) [EMAIL PROTECTED] wrote: On Aug 8, 2007, at 10:26 AM, simon wrote: Hi, I'm making an Ajax call from the index page of my application to a simple controller called attachments, to a function named add(). I have a session variable called User which I can print on the index page, but which is empty in the attachments controller. If I do a pr($_SESSION) in attachments/add() all I get is the attributes 'useragent', 'time' and 'random', where I should be getting a whole host of other stuff I've stored in the session. Any idea why? It is a JavaScript + Flash widget called SWFUpload making the Ajax call, so my only thought is that it does something funny to the request that prevents Cake from initialising the session properly, but that sounds pretty far fetched. The session is definitely initialised, as a session_start() will generate an error in the log. I've looked in the $_SERVER variable and the logs but didn't find anything funny. Not sure where else to look. Most likely your session is getting nixed because another user-agent is trying to access the data (i.e. the Flash object). Are your session IDs changing between requests? -- John --~--~-~--~~~---~--~~ 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: Session empty in Ajax call
On Aug 8, 2007, at 11:19 AM, simon wrote: Not sure... where is the session id located? In your cookies - you can also get it by calling session_id(). -- John --~--~-~--~~~---~--~~ 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: Session empty in Ajax call
On Aug 8, 2007, at 11:25 AM, John David Anderson (_psychic_) wrote: On Aug 8, 2007, at 11:19 AM, simon wrote: Not sure... where is the session id located? In your cookies - you can also get it by calling session_id(). I should mention that if CAKE_SECURITY is set to 'high' the ID will always change between requests. Set it to 'medium' while you're working on this issue. If the ID changes when you're on 'medium' its because the session got nuked somehow. -- John --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
saving HABTM problems
Hi all, as a nwbie to CakePHP, I experience problems understanding how the whole HABTM mechanism work. So here is the point, I got 2 tables publishers and places related by a HABTM condition. First, I save the publisher data and then the place data and then I try to add the record to the HABTM table. I'm using this method: http://bakery.cakephp.org/articles/view/add-delete-habtm-behavior but can't understand something. How can you save something in ths join table if you don't have saved it before in both tables? So, let's recap, I save the data from publisher I save the data from place and then try to use the habtmAdd function used in the link given. The data I got at this point is: Array ( [Publisher] = Array ( [id] = 40 [company_id] = 153 [first_name] = Martin [last_name] = Ratinaud [created] = 2007-08-08 18:51:21 [modified] = 2007-08-08 18:51:21 ) [Place] = Array ( [Place] = Array ( [0] = 13 ) ) ) but I don't manage to have anything in my join table. Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is it reasonably easy to do this sort of inline editing with CakePHP
Inline editing has more to do with the client-side scripting than the backend framework (of course they have to work together). I really like the editing capabilities of the ExtJS library http://extjs.com/deploy/ext/examples/grid/edit-grid.html I have had little difficulty integrating it into Cake. On Aug 5, 3:52 pm, walterbyrd [EMAIL PROTECTED] wrote: I'm still framework shopping. One thing I like about Qcodo is this inline editing feature: http://examples.qcodo.com/examples/dynamic/inline_editing.php Is that sort of thing easy to do with CakePHP? --~--~-~--~~~---~--~~ 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: Cannot instantiate non-existent class
Yes, your suggestion did correct the problem. I just had a total brain dump and didn't see the problem. Thank a lot, again! Shawn On Aug 8, 1:12 pm, Samuel DeVore [EMAIL PROTECTED] wrote: So did it work, if so you might spend some time learning to love and live the conventions. http://manual.cakephp.org/appendix/conventions in many ways it is the MOST important part of the manual, if you can live the conventions your life will be so much better (well your life with cakephp) anytime you stray (and people do stray) you should expect pain and heart aches Sam On 8/8/07, starkey [EMAIL PROTECTED] wrote: Thank you for looking after this noobie. On Aug 8, 12:58 pm, Samuel DeVore [EMAIL PROTECTED] wrote: class SarosSarg extends AppModel On 8/8/07, starkey [EMAIL PROTECTED] wrote: I'm stumped, can anyone take a moment and help me figure out why I'm getting these errors? Warning: overload() was unable to locate class 'sarossarg' in \cake \cake\basics.php on line 233 -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: custom pagination url
a hint from felix fixed my problem: in the view: ?php $paginator-options['url']['action'] = '-whatever'; ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple field values in select box?
Form::select is 1.2 only, no? I'm using 1.1 On Aug 8, 3:05 am, Geoff Ford [EMAIL PROTECTED] wrote: Forget generateList(). Create the array yourself to pass to Form::select() using a custom query if necessary. Sometimes when you are doing something that is a little bit out of the ordinary it can be too hard to make it Cakeish and it is easier and simpler to do the old php way. :) Geoff --http://lemoncake.wordpress.com On Aug 8, 4:37 pm, Beertigger [EMAIL PROTECTED] wrote: I must be far more retarded than the average bear, b/c this is something I just can't get working in Cake. I can get the results I want with a basic sql query: SELECT CONCAT(team, ' - ', sport) AS teamsport FROM `teams` , `sports` WHERE `teams`.`sport_id` = `sports`.`id` when I run it on the db. But I can't for the life of me suss out how to frost this up. Should I put the query in the model, or the controller. How do I set things up to use generateList with a findBySql or query? I've searched high and low and high again and can't find any clear-cut code examples for this. If you've got the patience to help me out, I will at the least owe you a virtual pint! Slainte! On Aug 1, 9:51 pm, Beertigger [EMAIL PROTECTED] wrote: Anyone? I'm pulling my hair out here. This is something that should be basic, shouldn't it? I'll freely admit I'm an idiot, but I'm just not understanding this ; ( Thanks to anyone willing to point me in the right direction. On Aug 1, 9:38 am,Beertigger[EMAIL PROTECTED] wrote: Multiple model fields in generatelist... ? Moving this one along a bit I've tried every which way to get this one to work, and I'm stumped. Using afterFind on info from one table works just fine; putting this in the Player model: function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Player']['fullname'] = $val['Player']['fname'] . ' ' . $val['Player']['lname']; } return $results; } lets me use 'fullname' in controllers easily enough. How do I get something from another table to concat nicely. Code like function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Team']['teamsport'] = $val['Team']['team'] . ' ' . $val['Sport']['sport']; } return $results; } only gets me the field from the Team table when it's in the Team model, and throws a Notice: Undefined index: Sport in...blahblahblah error. Team belongsto Sport, Sport hasmany Team What kinda hoops do I need to jump threw to get this info in a Cake-y manner? I need to generate a select in another controller. If somebody'd hold my hand on this one, it'd be greatly appreciated... Thanks! On Jul 28, 8:35 am, cauld [EMAIL PROTECTED] wrote: Not exactly a cake solution, but in the past I've created a database view an concatenated the two columns I want in the SQL (ex) concat(last_name, ', ', first_name) and then passed the view results to generateList(). Perhpas you could do the same with query() and pass those results to generateList(), but I've not tried that method so can't say it would work, just thinking out loud. Hope that is helpful. On Jul 27, 11:17 pm,Beertigger[EMAIL PROTECTED] wrote: Is there any way to get values from multiple fields into a select box? After much searching, I've come to the conclusion I'm not going to find the answer without appealing to those far wiser than myself... Here's an old thread for reference, which discusses, w/o resolution, exactly what I'm looking for: * Is it possible to use multiple fields to make up the value of the select box? Such that it would come out looking something like option value='field1value'field2value - field3value/option http://groups.google.com/group/cake-php/browse_thread/thread/50a2ecaf... So, just wondering if anyone ever made any progress on this. Saw the code in trac, but it seems to be for 1.2 (?). Couldn't get it to work, anyway. I'd find this functionality very valuable Thanks to anyone for any 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: Multiple field values in select box?
Isn't form::select for 1.2? I'm using 1.1 on this project... On Aug 8, 3:05 am, Geoff Ford [EMAIL PROTECTED] wrote: Forget generateList(). Create the array yourself to pass to Form::select() using a custom query if necessary. Sometimes when you are doing something that is a little bit out of the ordinary it can be too hard to make it Cakeish and it is easier and simpler to do the old php way. :) Geoff --http://lemoncake.wordpress.com On Aug 8, 4:37 pm, Beertigger [EMAIL PROTECTED] wrote: I must be far more retarded than the average bear, b/c this is something I just can't get working in Cake. I can get the results I want with a basic sql query: SELECT CONCAT(team, ' - ', sport) AS teamsport FROM `teams` , `sports` WHERE `teams`.`sport_id` = `sports`.`id` when I run it on the db. But I can't for the life of me suss out how to frost this up. Should I put the query in the model, or the controller. How do I set things up to use generateList with a findBySql or query? I've searched high and low and high again and can't find any clear-cut code examples for this. If you've got the patience to help me out, I will at the least owe you a virtual pint! Slainte! On Aug 1, 9:51 pm, Beertigger [EMAIL PROTECTED] wrote: Anyone? I'm pulling my hair out here. This is something that should be basic, shouldn't it? I'll freely admit I'm an idiot, but I'm just not understanding this ; ( Thanks to anyone willing to point me in the right direction. On Aug 1, 9:38 am,Beertigger[EMAIL PROTECTED] wrote: Multiple model fields in generatelist... ? Moving this one along a bit I've tried every which way to get this one to work, and I'm stumped. Using afterFind on info from one table works just fine; putting this in the Player model: function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Player']['fullname'] = $val['Player']['fname'] . ' ' . $val['Player']['lname']; } return $results; } lets me use 'fullname' in controllers easily enough. How do I get something from another table to concat nicely. Code like function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Team']['teamsport'] = $val['Team']['team'] . ' ' . $val['Sport']['sport']; } return $results; } only gets me the field from the Team table when it's in the Team model, and throws a Notice: Undefined index: Sport in...blahblahblah error. Team belongsto Sport, Sport hasmany Team What kinda hoops do I need to jump threw to get this info in a Cake-y manner? I need to generate a select in another controller. If somebody'd hold my hand on this one, it'd be greatly appreciated... Thanks! On Jul 28, 8:35 am, cauld [EMAIL PROTECTED] wrote: Not exactly a cake solution, but in the past I've created a database view an concatenated the two columns I want in the SQL (ex) concat(last_name, ', ', first_name) and then passed the view results to generateList(). Perhpas you could do the same with query() and pass those results to generateList(), but I've not tried that method so can't say it would work, just thinking out loud. Hope that is helpful. On Jul 27, 11:17 pm,Beertigger[EMAIL PROTECTED] wrote: Is there any way to get values from multiple fields into a select box? After much searching, I've come to the conclusion I'm not going to find the answer without appealing to those far wiser than myself... Here's an old thread for reference, which discusses, w/o resolution, exactly what I'm looking for: * Is it possible to use multiple fields to make up the value of the select box? Such that it would come out looking something like option value='field1value'field2value - field3value/option http://groups.google.com/group/cake-php/browse_thread/thread/50a2ecaf... So, just wondering if anyone ever made any progress on this. Saw the code in trac, but it seems to be for 1.2 (?). Couldn't get it to work, anyway. I'd find this functionality very valuable Thanks to anyone for any 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 -~--~~~~--~~--~--~---
Create a form in 1.1.16.5421
I must be totally confused... I'm trying to create a form using Cake's view helpers. So I go to the HtmlHelper::formTag function and it says to use FormHelper::create() instead. Problem is I can't find FormHelper::create() as it is not in Form.php or helper.php. http://api.cakephp.org/class_form_helper.html http://api.cakephp.org/class_helper.html What am I missing? How does one create a form using Cake's helpers in 1.1? Thanks! Shawn --~--~-~--~~~---~--~~ 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: Create a form in 1.1.16.5421
Before I get jumped on... I see stuff like this: form action=?php echo $html-url('/blog/add')? method=post I'm just looking for the create() method. Thanks! Shawn On Aug 8, 4:31 pm, starkey [EMAIL PROTECTED] wrote: I must be totally confused... I'm trying to create a form using Cake's view helpers. So I go to the HtmlHelper::formTag function and it says to use FormHelper::create() instead. Problem is I can't find FormHelper::create() as it is not in Form.php or helper.php.http://api.cakephp.org/class_form_helper.htmlhttp://api.cakephp.org/class_helper.html What am I missing? How does one create a form using Cake's helpers in 1.1? Thanks! Shawn --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
generatelist and Formhelper::Select
Hi all, I'm new to cake but have been playing with php for a while. I am using Ajax to create a set of select boxes that will create a simple search. When you select the value in one it will decrease the number of options to select from in the following boxes until it finally displays the narrow list. I am wondering if there is a way for me to use Generatelist to return only unique values. I have a table of available items and when I populate the Brand I don't want to have duplicates. Do I need to do this manually with a custom query? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Cake validation not working
I am new to cake. I have two tables, customers, and balances. balances belongsTo customers, and customers hasMany balances. customer_id is a foreign key in the balances table. I baked the models, and then the controller with scaffolding. Everything worked as expected so far. Next I baked the controller without scaffolding and with the regular functions, index, create, etc. Then I baked the views (saying yes to the scaffolding option). When I have a customer present in the database, and I go to create a new balance for that customer, everything works as expected, and there is a drop down menu listing the customer id's in the create new balance form. When I do not have any customers, and I go to create a new balance, it shows me the labelTag Customer, but no dropdown menu, not even an empty one, and the selectTag IS present in the add.thtml view. It's not even showing an empty list. That is problem #1. Problem #2 is, it will let me create a new balance without supplying a customer_id. This is problem because I perform validation on the customer_id field in the balances model. 'customer_id' = VALID_NUMBER, Obviously there is a data integrity issue, but, shouldn't the save fail because customer_id is required, despite the fact that the drop down isn't showing up (which I am also curious about). Thank you. --~--~-~--~~~---~--~~ 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: edit skipping to add if no id is sent.
uhmm, ok On 8/7/07, phpjoy [EMAIL PROTECTED] wrote: it's just one row in a table, i don't need an increase.. it's always id=1. the problem i had was that cakephp wanted an id, and wouldn't send to edit. if no id is found, it sends to the add method automatically, so i bypassed it by changing the table. -- yossi On Aug 7, 3:47 pm, Pablo Viojo [EMAIL PROTECTED] wrote: Dear phpjoy, What do you mean with id=1? better use an autoincrement field. And please sign your messages (at least a nickname) -- Pablo Viojo [EMAIL PROTECTED]://pviojo.net On 8/7/07, phpjoy [EMAIL PROTECTED] wrote: well, figuring out how it works, i decided to say.. fuck it, i'll just add an id=1 to the table. by the way, where does it happen, this redirection? it didn't even get to the method, as if a before filter exists or something else in the core of cakephp. On Aug 7, 11:21 am, Geoff Ford [EMAIL PROTECTED] wrote: Put an id in - cake needs it to write the update statement. It doesn't have to be 'id', just use var $primaryKey = 'some field'; Geoff --http://lemoncake.wordpress.com On Aug 7, 12:21 am, phpjoy [EMAIL PROTECTED] wrote: i also wonder, where does this redirect happen in cake? dispatcher? before? class/method would be great :) On Aug 7, 8:51 am, phpjoy [EMAIL PROTECTED] wrote: i have a table in my database that doesn't need an id, it's only 1 row stored in the DB. i want to edit that row, and whenever i try to edit it - i get thrown to add.http://localhost/admin/config/edit redirects tohttp://localhost/admin/config/add and gives me this error: Missing Method in ConfigController You are seeing this error because the action admin_add is not defined in controller ConfigController how can i bypass this? it doesn't even reach the edit method at the second time, it tries to search even before it got to the function. do you guys have other good techniques out there? -- Pablo Viojo [EMAIL PROTECTED] http://pviojo.net --~--~-~--~~~---~--~~ 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+SMF (again?)
Ok - didn't think about the different column names. Maybe you could extend the SessionComponent as SmfSessionComponent to make it a bit cleaner and more portable and put that in Cake snippets or the bakery or somewhere for other people who want to integrate SMF and Cake. SMF seems to be gaining a bit of a following so I am sure other bakers will appreciate something like this. Geoff On 8/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, that is pretty much what I have ended up doing (albeit through a long-winded process). I did actually have to modify Cake's session functions because the SMF sessions table uses different column headings and stores some more data. Also, SMF sessions stores session id in a field session_id whereas Cake stores it in id (or maybe its the other way around). Seeing that Cake's session handling functions are in an easily accessible location and SMF's are stored away in some place I couldn't find, I went ahead and modified Cake's. - Sohum. On Aug 8, 2:55 pm, Geoff Ford [EMAIL PROTECTED] wrote: You don't need to modify cake. All you have to do is modify config/core.php: define('CAKE_SESSION_SAVE http://api.cakephp.org/1.2/app_2config_2core_8php.html#ebaae21321d4c6... ', 'database'); // sets cake to use database sessions define('CAKE_SESSION_TABLE http://api.cakephp.org/1.2/app_2config_2core_8php.html#c65b43b5806945... ', 'forumprefix_sessions'); // tells cake which table to use define('CAKE_SESSION_COOKIE http://api.cakephp.org/1.2/app_2config_2core_8php.html#daabb9dafb18df... ', 'PHPSESSID'); // tells cake which cookie holds the session id Thats all that you should need to do. Then from within cake you can call the ssi_ functions as normal and all should be fine. Geoff On 8/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, that is exactly what I wanted to do (use the SMF hooks using the provided SSI.php) but since SMF relies on the session data for these to work and Cake created its own session to handle this, the SSI.php file was not looking at the correct data. In all, the steps I have taken were not that complicated--it was just the intermediate experimentation that made it seem difficult. Basically what I did was: 1. Set SMF to use only global cookies. 2. Set CAKE_SESSION_COOKIE to be the default 'PHPSESSID'. 3. Modify the session handling functions in Cake to use the MySQL table used by SMF (forumprefix_sessions) I do believe it is working now on both IE6 and Firefox (more testing required, of course). Both applications use the same session so my only problem would be if the hard-coded session variables stored by Cake conflict with those stored by SMF. I'm not sure if there will be any security issue, though I do not foresee one (in my limited knowledge). Perhaps another solution would be to modify SMF's SSI.php file to set the session ID temporarily to the one used by SMF and then set it back again for the one used by Cake. I'm not sure if this would interfere in regeneration of session ID's, though, so I'm quite happy to stick to my current solution! - Sohum. On Aug 8, 12:45 pm, MrTufty [EMAIL PROTECTED] wrote: For the record, I think you've gone a very much more complicated way around this than was necessary - I may be wrong, depending on exactly what you're trying to achieve, but wouldn't it have been simpler to hook into the SMF login/logout scripts from within your Cake apps? That way you would still effectively have 2 sessions, which would contain the same data (because you've written it to do that) but the 2 applications would be sharing information. I don't know what SMF's support is for doing stuff like that, I know that some of the other forum software allows it though. I'm just very confused as to what you're trying to do... Tufty On Aug 8, 8:06 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, It looks like I have solved the problem. SMF stores the session ID as default in the PHPSESSID cookie. Since CakePHP is checking it's own cookie for the session ID and cannot find it, it creates another cookie. So I solved the problem (I think) by changing CakePHP to simply use the PHPSESSID cookie for it's session. This way, regardless of which creates the session first (Cake or SMF), they use the same session. Is there a compelling reason that Cake was built to store it in a different cookie apart from flexibility (for example--security)? Thanks again. - Sohum. On Aug 7, 2:58 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I had actually tried this solution earlier but it seems that CakePHP only stores the session ID as a string in the cookie, whereas SMF seems to store other data as well. There may be a way to change SMF to
Re: How to build form with multiple records?
Luke, I did find what you described but could not get it to work for the input name, only the input value. I recently posted a blog entry on multi-record forms, including redisplaying the errors, although it sounds like you got it sorted, using a similar approach to what I have used in my blog post. Travis, this seems to be coming up again and again on the mailing list and I think it would be a great addition to the core FormHelper. As FormHelper already supports this format for the input value, it would seem that it is doable for the input name and id. When I get time I will try to do this and submit it as an enhancement to the trac. Geoff On 8/9/07, Travis Cline [EMAIL PROTECTED] wrote: On Jul 25, 6:27 pm, Geoff Ford [EMAIL PROTECTED] wrote: Hmm.. Very interesting. I had not seen that before. I might have a play later on and see if I can get it to work. I'll let you know how I go. Geoff --http://lemoncake.wordpress.com I've also been interested in seeing what it would mean to have the core support for fields in such a format: data[Model][?= $i; ?][id] I don't think it's trivial. I wonder if the devs consider this too edge case, it would surely be slick. -- Travis -- http://lemoncake.wordpress.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: Link to a location on the same page
Links to the same page do not require the full url so why not use straight html? a name=Verb/ This is where I want to go a href=#VerbSend me there/a Plain and simple. Geoff On 8/9/07, mussond [EMAIL PROTECTED] wrote: I changed the name to be #Verbs but when I click it I get redirected to the URL: /top_tiers/index#Verbs. This page displays exactly like / top_tiers/index would. I don't know how I'd implement $html-link() because it asks for a URL and an array but I want the same array. Has anyone got any ideas or an example for the problem? Dave On Aug 7, 11:55 pm, Geoff Ford [EMAIL PROTECTED] wrote: Bookmarks use #bookmarkName last time I checked. Geoff --http://lemoncake.wordpress.com On Aug 8, 11:50 am, Chris Hartjes [EMAIL PROTECTED] wrote: On 8/7/07, mussond [EMAIL PROTECTED] wrote: Hey all, I trying to create a bookmark link on my page. I couldn't find anything in api that would let me do this, so I've tried to do it using HTML but when I click the link I get a page saying I have a missing controller, $Verbs. Below is part of my HTML code. I can see how the $Verbs controller comes about as its the name of my bookmark. How do I get it follow the HTML and not Cake? Why can't you use $html-link() ? -- Chris Hartjes Senior Developer Cake Development Corporation My motto for 2007: Just build it, damnit! @TheBallpark -http://www.littlehart.net/attheballpark @TheKeyboard -http://www.littlehart.net/atthekeyboard -- http://lemoncake.wordpress.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: Building Facebook app on CakePHP
Yeah, I'm struggling with the same issue. It isn't clear as to the best method for integrating CakePHP and the Facebook API. This is as far as I've gotten, and I don't think it is the best way because it gives you access to the $facebook variable in the view and not the other controller methods. Since I'm building a Facebook app with no need for a www version, I'd like access to the $facebook variable everywhere. Any ideas?... vendor('facebook/facebook'); class ContentController extends AppController { // NAME var $name = 'Content'; // VALIDATE var $validate = array( 'title' = 'VALID_NOT_EMPTY', 'body' = 'VALID_NOT_EMPTY' ); function beforeFilter() { // FACEBOOK $GLOBALS['facebook_config']['debug'] = NULL; $api_key = xxx; $secret = xxx; $facebook = new Facebook($api_key, $secret); $this-set('facebook', $facebook); } ... } On Aug 3, 10:40 am, thequietlab [EMAIL PROTECTED] wrote: Hi, I'm curious if there exists anything similar to rfacebook (http:// rfacebook.rubyforge.org/) for cakephp ? I'm starting to build facebook port for my cake application, does anyone have any experience with making this combination work ? I found this little article :http://www.zenperfect.com/2007/07/24/facebook-api-with-cakephp/ but nothing more. Best, Andrzej --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple field values in select box?
OK so use HtmlHelper::select() or selectTag() - I can't remember of the top of my head which one it is. My solutions is still the same - creat the array that you want to display in the listbox manually. Again not sure of the exact array format but something like $data = $this-Model-getListData(); // a function in your model that does the custom query to pull the three fields you wnat to use $mylist = array(); foreach ($data as $item){ $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' . $data['Model']['field3]; } $this-set(mylist, $mylist); Then in your view something like (again double check the format) $html-select(SelectName, $mylist, $selectedItems); I hope this helps :) Geoff On 8/9/07, Beertigger [EMAIL PROTECTED] wrote: Isn't form::select for 1.2? I'm using 1.1 on this project... On Aug 8, 3:05 am, Geoff Ford [EMAIL PROTECTED] wrote: Forget generateList(). Create the array yourself to pass to Form::select() using a custom query if necessary. Sometimes when you are doing something that is a little bit out of the ordinary it can be too hard to make it Cakeish and it is easier and simpler to do the old php way. :) Geoff --http://lemoncake.wordpress.com On Aug 8, 4:37 pm, Beertigger [EMAIL PROTECTED] wrote: I must be far more retarded than the average bear, b/c this is something I just can't get working in Cake. I can get the results I want with a basic sql query: SELECT CONCAT(team, ' - ', sport) AS teamsport FROM `teams` , `sports` WHERE `teams`.`sport_id` = `sports`.`id` when I run it on the db. But I can't for the life of me suss out how to frost this up. Should I put the query in the model, or the controller. How do I set things up to use generateList with a findBySql or query? I've searched high and low and high again and can't find any clear-cut code examples for this. If you've got the patience to help me out, I will at the least owe you a virtual pint! Slainte! On Aug 1, 9:51 pm, Beertigger [EMAIL PROTECTED] wrote: Anyone? I'm pulling my hair out here. This is something that should be basic, shouldn't it? I'll freely admit I'm an idiot, but I'm just not understanding this ; ( Thanks to anyone willing to point me in the right direction. On Aug 1, 9:38 am,Beertigger[EMAIL PROTECTED] wrote: Multiple model fields in generatelist... ? Moving this one along a bit I've tried every which way to get this one to work, and I'm stumped. Using afterFind on info from one table works just fine; putting this in the Player model: function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Player']['fullname'] = $val['Player']['fname'] . ' ' . $val['Player']['lname']; } return $results; } lets me use 'fullname' in controllers easily enough. How do I get something from another table to concat nicely. Code like function afterFind($results) { foreach ($results as $key = $val) { $results[$key]['Team']['teamsport'] = $val['Team']['team'] . ' ' . $val['Sport']['sport']; } return $results; } only gets me the field from the Team table when it's in the Team model, and throws a Notice: Undefined index: Sport in...blahblahblah error. Team belongsto Sport, Sport hasmany Team What kinda hoops do I need to jump threw to get this info in a Cake-y manner? I need to generate a select in another controller. If somebody'd hold my hand on this one, it'd be greatly appreciated... Thanks! On Jul 28, 8:35 am, cauld [EMAIL PROTECTED] wrote: Not exactly a cake solution, but in the past I've created a database view an concatenated the two columns I want in the SQL (ex) concat(last_name, ', ', first_name) and then passed the view results to generateList(). Perhpas you could do the same with query() and pass those results to generateList(), but I've not tried that method so can't say it would work, just thinking out loud. Hope that is helpful. On Jul 27, 11:17 pm,Beertigger[EMAIL PROTECTED] wrote: Is there any way to get values from multiple fields into a select box? After much searching, I've come to the conclusion I'm not going to find the answer without appealing to those far wiser than myself... Here's an old thread for reference, which discusses, w/o resolution, exactly what I'm looking for: * Is it possible to use multiple fields to make up the value of the select box? Such that it would come out looking something like option value='field1value'field2value - field3value/option http://groups.google.com/group/cake-php/browse_thread/thread/50a2ecaf... So, just
Re: Ridiculous User Management Head Melt
Hi Sonic, Glad I could help - see my comments below. Geoff On 8/9/07, Sonic Baker [EMAIL PROTECTED] wrote: Hey Geoff, Thanks for second the reply dude, and thanks even more for your level of detail with your thoughts. The profile stuff is clear to me now and I'll be adapting my current Models to use an abstract factory on asap. The only thing I'm having trouble with now is how to know which account a user belongs to when they log in. (please see below) On 8/8/07, Geoff Ford [EMAIL PROTECTED] wrote: Customer hasMany Accounts - a customer is a User with a CustomerProfile Yep, that's what I have. Account belongsTo AccountAdmin(admin), AccountManager(manager_id), BillingContact(billing_contact_id) (which are users) Aha, we're on the same page here too. I would keep the accounts table the way you have it now as I think the above associations is more correct than User belongsTo Account. Ok, see this is where the trouble comes in. If I just leave the 'billing_contact_id' and 'account_manager_id' in the `accounts` table and don't have an 'account_id' in the User's `external_profiles` table, then how will I know what Account a BillingContact is trying to access when they log in? I'll have to search through the Account's for one who's 'billing_contact_id' is the same as the 'user_id' who logs on. That seems like a bit of a waste when an association could take care of it. Have I picked you up wrongly on this point? Here is where Cake is really flexible - you can create the association in Profile like ExternalProfile hasOne Account and then specify the foreign key as billing_contact_id. If you are using the same profile model for all three account user types you will have to look into Model::bind() and Model::unbind() to create this association as needed, and adapt the foreign key to the user type. Man I love complex data models and associations. There are so many different ways you can model them and everyone has a different idea as to waht is correct. I love it too. Unfortunately, I don't have many people who are also into it and who I can run my thoughts by. It can get a bit messy inside one head :) I know what you mean :) It can get lonely in your own head sometimes - especially when you can't quite get it the way you want it :) Feel free to say that eveything I just wrote is crap and wont work in your situation. :) I think most of it'll be perfect. I just hope I haven't thrown a spanner in the works on the logging in thing. What do you think? Cheers, Sonic -- http://lemoncake.wordpress.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 -~--~~~~--~~--~--~---
View this page Cake Apps/Sites In The Wild
Added tierranatal.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: How to use recursive option in Model or in controller?
You should use recursive = 2 (0 = just the subcategory, 1 = the category associaton, 2 = the category's language association). You will want to access the language in your view through: echo $filtr_lang['Subcategory']['link']; echo $filtr_lang['Category']['kategoria']; echo $filtr_lang['Category']['Language']['jezyk']; as it is associated through the Category, not directly to the Subcategory. [EMAIL PROTECTED] wrote: I want filter my subcategories by language_id ( this is a foreign key in categories table and primary key in languages table). I use recursive option ( $this-Subcategory-recursive = 3; ) in my controller but i'm still getting this error. Which value should i use ? 3 or 2 ? Error in my view: Notice: Undefined index: Language subcategories_controller $this-set('filtr_langs', $this-Subcategory- findAll(array('Category.language_id' =$id))); view: foreach ($filtr_langs as $filtr_lang): echo $filtr_lang['Subcategory']['id']; echo $filtr_lang['Subcategory']['link']; echo $filtr_lang['Category']['kategoria']; echo $filtr_lang['Language']['jezyk']; echo $filtr_lang['Subcategory']['podkategoria']; php endforeach; ? models: -- MODEL CATEGORY class Category extends AppModel { var $belongsTo = array( 'Menu' = array( 'className' = 'Menu', 'foreignKey' = 'menu_id' ), 'Language' = array( 'className' = 'Language', 'foreignKey' = 'language_id' ) ); var $hasMany = array( 'Subcategory' = array( 'className' = 'Subcategory', 'foreignKey' = 'category_id' ) ); } MODEL SUBCATEGORY class Subcategory extends AppModel { var $belongsTo = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'category_id' ) ); --- MODEL LANGUAGE class Language extends AppModel { var $hasMany = array( 'Category' = array( 'className' = 'Category', 'foreignKey' = 'language_id' ) ); -- ANY IDEAS? Stanley --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
View question
I'm using 1.2 and I'm wondering how to fix a minor issue I have. I have a form with a date field and after the input box I'm displaying a calendar image that when clicked displays a date picker. This all works, but if I leave the field blank and hit submit I get the This field cannot be left blank message, which the DIV the message is in pushes the calendar image down to the next line. In searching this group I couldn't find any options to have the calendar image stay in place when there's an error message. How are people getting around this? Here's most of my view: ?php echo $form-create(array('action'='create','name'='form')); ? fieldset dl ... dtlabelProject Start Datespan*/span:/label/dtdd? php echo $form-input('Project.proj_start', array('div'=false,'id'='ProjectProjStart','label'=false,'size'=15,'type'='text')); ? ?php echo $form- submitImage('calendar.gif',array('id'='projstartdt')); ? (mm/dd/ yy)/dd ... /dl p?php echo $form-submit('Save') ?/p /fieldset /form --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help With $ajax-link. Can I Slide instead of Hide?
I have a few questions involving ajax. This is what I have so far: ?php echo $ajax-link('Ajax', '/contact/', array('update' = 'changediv', 'indicator' = 'loaddiv')); ? My problem is that it uses Element.show. I've seen a slide used on a CakePHP site before. The output was something like this: new Ajax.Updater('changediv','/contact/', {asynchronous:true, evalScripts:true, onLoading:function(request) { showById('loading'); hideById('changediv');}, onComplete:function(request) {slideDown('changediv'); hideById('loading');}, requestHeaders:['X-Update', 'changediv']}) }, false); So my question is. How did they implement the slideDown/showById, hideById, etc.? At first I thought maybe it was done manually, but after closer scrutiny I realized it was Cake. Any ideas? ThanX in advance. -- Baz L Day In The Life of Baz http://www.LifeOfBaz.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: Multiple field values in select box?
Somehow, this seems on the right track, but I couldn't get things to work. Played around with a lot of different variations, but *something* is not quite kosher, yet. Thanks much for the guidance thus far. Should the entire $data = $this-Model-getListData(); // a function in your model that does the custom query to pull the three fields you wnat to use $mylist = array(); foreach ($data as $item){ $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' . $data['Model']['field3]; } be in the Model? And the this-set in the controller? Sorry for my blatant stupidity. Wrapping what I know of php up with Cake is proving to be troublesome, at best. The masterbake script provides such a sweet basic framework that a bit of pain getting things 'just right' is worth it, but this one thing is really killing me... ; ) On Aug 8, 3:48 pm, Geoff Ford [EMAIL PROTECTED] wrote: OK so use HtmlHelper::select() or selectTag() - I can't remember of the top of my head which one it is. My solutions is still the same - creat the array that you want to display in the listbox manually. Again not sure of the exact array format but something like $data = $this-Model-getListData(); // a function in your model that does the custom query to pull the three fields you wnat to use $mylist = array(); foreach ($data as $item){ $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' . $data['Model']['field3]; } $this-set(mylist, $mylist); Then in your view something like (again double check the format) $html-select(SelectName, $mylist, $selectedItems); I hope this helps :) Geoff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple field values in select box?
All the code I outlined would be in the controller. You could put the loop in the getListData() function in the model if you like to keep the controller cleaner. The controller would then just be $this-set('listdata', $this-Model-getListData()); Geoff On 8/9/07, Beertigger [EMAIL PROTECTED] wrote: Somehow, this seems on the right track, but I couldn't get things to work. Played around with a lot of different variations, but *something* is not quite kosher, yet. Thanks much for the guidance thus far. Should the entire $data = $this-Model-getListData(); // a function in your model that does the custom query to pull the three fields you wnat to use $mylist = array(); foreach ($data as $item){ $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' . $data['Model']['field3]; } be in the Model? And the this-set in the controller? Sorry for my blatant stupidity. Wrapping what I know of php up with Cake is proving to be troublesome, at best. The masterbake script provides such a sweet basic framework that a bit of pain getting things 'just right' is worth it, but this one thing is really killing me... ; ) On Aug 8, 3:48 pm, Geoff Ford [EMAIL PROTECTED] wrote: OK so use HtmlHelper::select() or selectTag() - I can't remember of the top of my head which one it is. My solutions is still the same - creat the array that you want to display in the listbox manually. Again not sure of the exact array format but something like $data = $this-Model-getListData(); // a function in your model that does the custom query to pull the three fields you wnat to use $mylist = array(); foreach ($data as $item){ $mylist[$data['Model']['field1]] = $data['Model']['field2] . '-' . $data['Model']['field3]; } $this-set(mylist, $mylist); Then in your view something like (again double check the format) $html-select(SelectName, $mylist, $selectedItems); I hope this helps :) Geoff -- http://lemoncake.wordpress.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 -~--~~~~--~~--~--~---
Connect to multiple databases
Hi all, How difficult would it be to connect to two databases? They're both on the same server/instance of MySQL, however due to the nature of the application I'd like to deploy using Cake, I need to be able to query two different databases. Oldschool way would be to just write queries with: db1.tbl_name db2.tbl_name Thanks for any insight! - sf --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
RequestHandler not found?
I am getting the following error You are seeing this error because the component class RequestHandlerComponent you have set in SalesController can't be found or doesn't exist. I feel like I have to be making a huge mistake somewhere because I can't find anyone else that has this problem. This happens to any controller that I add the var $components = array('RequestHandler'); Anybody got an idea? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Loop with select and insert not working as expected
I am running CakePHP v 0.2.9, Revision: 4409 and PHP 5 I have a function in a controller whose intent is to read a CSV file and put the fields from each record into the appropriate database. Several of the records can have the same Household information, so I want to only create a new record if that Household is NOT already in the database. If it is in the database, I need to get the Household.id to put into some of the other tables as a foreign key (household_id). If I run the function process_csv_file() (copied below) with a file that already contains some of the Households (identified by Household.userid) -- but not all of the Households, the code seems to stop issuing the following line. (Actually the first 2 records already exist followed by several records for a new household. The new record is created (INSERT) but the subsequent records for that same household don't find their match and try to INSERT that household again.) $household_id = $this-Household-field(id, $match_userid); - actually it seems to know that this is the same Household and doesn't bother to issue the SELECT statement - that leaves $household_id empty and then the code tries to insert the Household information again - which is wrong. Here is the SQL dump output: 7 SELECT `Household`.`id` FROM `households` AS `Household` WHERE `Household`.`userid` = '115603' LIMIT 1 8 SELECT `Household`.`id` FROM `households` AS `Household` WHERE `Household`.`userid` = '126448' LIMIT 1 9 SELECT `Household`.`id` FROM `households` AS `Household` WHERE `Household`.`userid` = '136285' LIMIT 1 10 INSERT households SET last_name = 'Bradford', HHID = '21550', userid = '136285', email = '[EMAIL PROTECTED]', address_1 = '1 Anystreet Ave', address_2 = '', city = 'Tucson', state = 'AZ', zipcode = '85730' 11 INSERT households SET last_name = 'Bradford', HHID = '21550', userid = '136285', email = '[EMAIL PROTECTED]', address_1 = '1 Anystreet Ave', address_2 = '', city = 'Tucson', state = 'AZ', zipcode = '85730' 1062: Duplicate entry '21550' for key 2 1 12 INSERT households SET last_name = 'Bradford', HHID = '21550', userid = '136285', email = '[EMAIL PROTECTED]', address_1 = '1 Anystreet Ave', address_2 = '', city = 'Tucson', state = 'AZ', zipcode = '85730' 1062: Duplicate entry '21550' for key 2 1 13 INSERT households SET last_name = 'Bradford', HHID = '21550', userid = '136285', email = '[EMAIL PROTECTED]', address_1 = '1 Anystreet Ave', address_2 = '', city = 'Tucson', state = 'AZ', zipcode = '85730' 1062: Duplicate entry '21550' for key 2 The controller: class OrdersController extends AppController { var $name = 'Orders'; var $uses = array('Order','OrderItem', 'Household', 'Student', 'Product'); function process_csv_file() { $this-pageTitle = 'Process CSV File'; $checkFileFields = Array ( id, Item, Qty, Household, HHID, FirstName, LastName, UserID, Processed, SchoolLocation, HouseholdEmail, Address1, Address2, City, State, Zip, REFERENCE#2 ); if (!empty($this-params['form'])) { $file_handle = fopen($this-params['form']['File'] ['tmp_name'],r); $label_fields = fgetcsv ($file_handle); $last_household_id = null; if ($checkFileFields == $label_fields) { $last_processed_student = null; $current_order_id = null; while (!feof($file_handle)) { $csv_fields = fgetcsv ($file_handle); /* Remember who we are processing - one order per student */ $first_name = $csv_fields[5]; $last_name = $csv_fields[6]; $check_name = $first_name . ' ' . $last_name; /* Process the households db part. */ $this_userid = $csv_fields[7]; $match_userid = Household.userid = ' . $this_userid . '; $household_id = $this-Household-field(id, $match_userid); if ($household_id) { /* We have the household.id now, that's all we need. */ print_r($household_id); } else { $this-Household-createRecord( $last_name, $csv_fields[4], $this_userid, $csv_fields[10], $csv_fields[11], $csv_fields[12], $csv_fields[13], $csv_fields[14], $csv_fields[15]); $household_id = $this-Household-getLastInsertID();
Re: Help With $ajax-link. Can I Slide instead of Hide?
?php echo $ajax-link('Ajax', '/contact/', array('update'='changediv', 'indicator'='loaddiv', 'loading'=showById('loading'); hideById('changediv');, 'complete'=slidedown I believe that's how you do it. I can't remember if you need to add the function() { to it, but I don't have enough time to test it out. Go take a look at the ajax helper in the manual, especially at the $options keys section. http://manual.cakephp.org/chapter/helpers On Aug 8, 6:47 pm, Baz [EMAIL PROTECTED] wrote: I have a few questions involving ajax. This is what I have so far: ?php echo $ajax-link('Ajax', '/contact/', array('update' = 'changediv', 'indicator' = 'loaddiv')); ? My problem is that it uses Element.show. I've seen a slide used on a CakePHP site before. The output was something like this: new Ajax.Updater('changediv','/contact/', {asynchronous:true, evalScripts:true, onLoading:function(request) { showById('loading'); hideById('changediv');}, onComplete:function(request) {slideDown('changediv'); hideById('loading');}, requestHeaders:['X-Update', 'changediv']}) }, false); So my question is. How did they implement the slideDown/showById, hideById, etc.? At first I thought maybe it was done manually, but after closer scrutiny I realized it was Cake. Any ideas? ThanX in advance. -- Baz L Day In The Life of Bazhttp://www.LifeOfBaz.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 -~--~~~~--~~--~--~---
Simple interaction with my Model class using ajax with jQuery library
I want to send data with ajax with jQuery. this data is to be stored inside my ratings table. how should i send the data to my Rating 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 -~--~~~~--~~--~--~---
ajax redirect
how do I redirect inside of an ajax request? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Error Handling for big sites.
Let's say I have a big site application, should I do these kind of error checking after component/model loading: loadComponent('AdminSiteTree'); if(!class_exists('AdminSiteTreeComponent')) $this-cakeError('internalError', null); What do you say? What do you do in your projects? --~--~-~--~~~---~--~~ 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: Connect to multiple databases
See $useDbConfig (model) in documentation. On Aug 9, 3:42 am, Steve Finkelstein [EMAIL PROTECTED] wrote: Hi all, How difficult would it be to connect to two databases? They're both on the same server/instance of MySQL, however due to the nature of the application I'd like to deploy using Cake, I need to be able to query two different databases. Oldschool way would be to just write queries with: db1.tbl_name db2.tbl_name Thanks for any insight! - sf --~--~-~--~~~---~--~~ 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: Simple interaction with my Model class using ajax with jQuery library
You need a serious look to the manual (cakeForge.org). The Controller should handled your posted form (View) and passed to the Model that is in charge of the storage. It's an MVC framework, please check the manual for the basics. Using jQuery or not does not change the way the controller / model is operating. ayampanggang wrote: I want to send data with ajax with jQuery. this data is to be stored inside my ratings table. how should i send the data to my Rating 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 -~--~~~~--~~--~--~---
constants issue
Hello Friends, do anyone has list of Contants in Cakephp. i have seen in the manul but they will not do me good in my task. What i need is :- Suppose we have a URL such as http://mysite.com/insidecake/events/view/28/12/2016 i want to extract URL upto http://mysite.com/insidecake/events; how can i achieve this. I have used FULL_BASE_URL but i have got only http://mysite.com; other constants are not working such as $this-webroot, WWW_ROOT etc. Pls help. 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 -~--~~~~--~~--~--~---