Arquivos do Grupo
será que alguem pode informar o moderador que o cake ja ta na versao 1.1.17.5612? --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: ACL alguem sabe mais?
Encontrei estes links aqui, veja se te esclarece alguma coisa: http://bakery.cakephp.org/articles/view/user-permissions-and-cakephp-acl http://www.thinkingphp.org/2006/05/31/cakephp-and-acl-why-is-it-so-difficult/ http://www.thinkingphp.org/2006/10/03/a-lightweight-approach-to-acl-the-33-lines-of-magic/ Estes 2 últimos parecem mais simples pra entender como aplicar o acl. Nossa, é impossível entender o ACL seguindo o manual do cake. Estou bem perdido. Alguem sabe um tutorial em português ou inglês sobre Controle de Acesso no cake com o componente ACL? Tudo que eu li termina da mesma forma, apenas a teoria e exemplos pobres de como implementar. Gostaria de ver trechos de código reais. valew --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para cake-php-pt- [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~--- -~~~--~~--~--~--- __ NOD32 2502 (20070904) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: Arquivos do Grupo
Moderador aqui. Porque tenho de ser informado ? On 9/4/07, Adriano Rocha [EMAIL PROTECTED] wrote: será que alguem pode informar o moderador que o cake ja ta na versao 1.1.17.5612? -- Gustavo Carreno --- http://batxman.wordpress.com If you know Red Hat you know Red Hat, If you know Slackware you know Linux --~--~-~--~~~---~--~~ Recebeu esta mensagem porque está inscrito em Grupo Cake PHP Português do Grupos Google. Para enviar mensagens para este grupo, envie um email para cake-php-pt@googlegroups.com Para anular a inscrição neste grupo, envie um email para [EMAIL PROTECTED] Para mais opções, visite este grupo em http://groups.google.com/group/cake-php-pt?hl=pt-PT -~--~~~~--~~--~--~---
Re: An idea to improve cake's code design
On Sep 3, 7:00 pm, xephex [EMAIL PROTECTED] wrote: When reading throug CakePHP's code, an idea came to me and I wanted to share it with you. It became a bit more text than I thougt so I put it into a PDF. http://cake-php.googlegroups.com/web/The+Factory+function.pdf What do you think? Would it make sense to implement that? Kudos for the time invested. My concern is that caching and unnecessary creation of objects. (The objects have to be created even if the page is already cached). I have noticed that object creation (even for some single pages with Hello world) slows down the pages at least to some extent. -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.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: unbind and Pagination
Hm. If I comment out the unbind thing, it works fine, but with all the unnecessary data from the other associations. So I need the unbind thing. If i look at $lists, the result is exactly what I want. But if I put it in the pagination function, it fails with the SQL error messages Is there a way to use paginate($lists), that paginate does not try to do the SQL Queries (i think it uses findall or find), but only uses the arrayset in $lists? On 3 Sep., 23:34, Howard Glynn [EMAIL PROTECTED] wrote: You need to be quite generous with model name prefixes in the original model specification to resolve the ambiguity, I read this somewhere on the list as I had the same problem. So in your list of default fields to return in both the original models file and the bind specification, try adding User.id, Sender.id etc in various places and you'll probably sort things out. You need to watch the debug output quite carefully to see where the changes take effect and steer you to the right place. H On 9/3/07, cronet [EMAIL PROTECTED] wrote: Hi, i have a question concerning the pagination and unbinding associations. My Model has a bunch of hasMany and habtm Associations which i want to unbind, because for this request I need only the hasOne UserProfile Model which is already defined in the User Model. I do this: $this-User-unbindModel( array('hasMany' = array('BandRequest', 'CellRequest', 'GigRequest', 'ImageUpload', 'MusicUpload', 'MusicianRequest', 'UsedRequest', 'Sender', 'Recipient'), 'hasAndBelongsToMany' = array('Band') ) ); $this-User-recursive = 2; $lists = $this-User-findAll(); $this-set('lists', $this-paginate($lists)); It fails with an SQL error (Column: 'id' in where clause is ambiguous) ... Is there a possibility to get this working ? Regards, Alexander --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
Hi, Are you getting/using the titles in a javascript ? If it's the case try to put something like this : script type=text/javascriptcharset=utf-8 ... /script to make sure that the script is serving as utf8. let us know if it's work. regards, metasan. On Sep 4, 4:24 pm, Anna P [EMAIL PROTECTED] wrote: Hi, I meant I have the table subpages in my DB which has fields: id, title, body. In the layout I retrieve titles of subpages as a link to a subpage like Home page, Contact, About us. In the view the encoding is correct, it shows me polish letters, but in the layout it gives me question marks for polish letters. My editor codes in UTF8, and I don't know why it doesn't give me the right coding. --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
No, I don't use js (as for now). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: wrong coding in layout variables from beforeRender function
is there in layout utf8? echo $html-charset('UTF-8') ; html source: meta http-equiv=Content-Type content=text/html;charset=utf-8/ On Sep 4, 11:59 am, Anna P [EMAIL PROTECTED] wrote: No, I don't use js (as for now). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: wrong coding in layout variables from beforeRender function
Yes, there is UTF-8 in layout, DB stores data in UTF-8, encoding for connection with DB is set to UTF8, in cake there is UTF8 set for DB connections, I use UTF8 editor it's driving me crazy!:[ --~--~-~--~~~---~--~~ 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: wrong coding in layout variables from beforeRender function
is your browser configured to display utf-8? what you describe happend to me with german umlauts and back then it helped to switch the encoding in the browser (it was iso-8859-1) to utf-8 manually. i always thought the browser (firefox in my case) switches automatically but maybe a add-on or something destroyed that functionality (or it only existed in my imagination). BUT: if someone of your visitors has set a charset like iso-8859-1 he will always have ??? and i think there is no way around it ... but i certainly hope i am wrong ;-). --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Restrict access to my admin area
I create admin area with many controllers and views. Now i want to make restrict access to this pages but i don't want to repeat myself to each controller and write there a function like _checkLoggedIn() . (It's not DRY( Don't Repear Yourself)) How to make restrict access to my pages in simple way. (I'm new in cakephp). Are there any simple tutorials to this? Does anyone have any ideas? 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: Restrict access to my admin area
I'm guessing you could override the main app_controller.php file and then add something to the startup or constructor that has something like: if (isset($this-params['admin'])) { // do stuff } But I'm guessing -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On 9/4/07, Stanley [EMAIL PROTECTED] wrote: I create admin area with many controllers and views. Now i want to make restrict access to this pages but i don't want to repeat myself to each controller and write there a function like _checkLoggedIn() . (It's not DRY( Don't Repear Yourself)) How to make restrict access to my pages in simple way. (I'm new in cakephp). Are there any simple tutorials to this? Does anyone have any ideas? 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: wrong coding in layout variables from beforeRender function
Yes it is:]. In fact, in the layout I use: ?php ini_set('default_charset', 'utf-8'); header('Content-Type: text/html; charset=utf-8');? at the beggining, so the browser knows what the encoding is. --~--~-~--~~~---~--~~ 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: Restrict access to my admin area
admin area? for. 1.1.x: You can uncommnet define('CAKE_ADMIN', 'admin'); in app/config.php and prefix all admin actions with admin_ like: admin_edit() In $this-params will be 'admin', and U can check it in beforeFilter in app_controller or so. admin urls: /admin/news/edit/32 (also change urls in admin views) On Sep 4, 1:28 pm, Stanley [EMAIL PROTECTED] wrote: I create admin area with many controllers and views. Now i want to make restrict access to this pages but i don't want to repeat myself to each controller and write there a function like _checkLoggedIn() . (It's not DRY( Don't Repear Yourself)) How to make restrict access to my pages in simple way. (I'm new in cakephp). Are there any simple tutorials to this? Does anyone have any ideas? 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 -~--~~~~--~~--~--~---
Model Save bug? (CakePHP 1.2 MySQL)
In table I have two fields UNIQUE. When I set debug level = 1, after Model-save, I can see: MySQL warning I get my own warning, which show, when Model-save fail. But, when I switch into debug level = 0 . I don't see any warning and get records in my table with non unique fields! It's bug? --~--~-~--~~~---~--~~ 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: Fatal errors using bake
The problem you have is that the command line php you are using is different than the one the server is using. Make sure they are the same executables. It is more of a WAMP setup problem then the cake issue. Take a simple php script that connects to mysql and run it through command prompt, if that works then come to cake and see if it gives any error. Also, for the 'ADMIN' error you got was due to the core.php file, in there you must enable admin (uncomment the line CAKE_ADMIN) before you can use admin routing. or read the comments in the core.php file. Ketan On Sep 3, 10:37 am, mejpark [EMAIL PROTECTED] wrote: I am developing my application on Windows PC running Vista Home Basic and the XAMPP framework (xampp-win32-1.6.3a.zip). I configured bake according to this document http://bakery.cakephp.org/articles/view/ setting-up-eclipse-to-work-with-cake. I envoked bake from the PDT console, which produced: Skel Directory: C:\xampp\htdocs\cake\cake\scripts\templates\skel Will be copied to: New App Directory: C:\xampp\htdocs\cake\app --- Look okay? (y/n/q) [y] n I realised that I need to tell bake which project to work with, so I added bake.php ${project_name:myproject} variable to the external tools configuration dialogue and made a second attempt to bake a controller: Bake -app in C:\xampp\htdocs\cake\myproject (y/n) [y] y What would you like to Bake? (M/V/C) c Enter a number from the list above, or type in the name of another controller. Admins Would you like bake to build your controller interactively? Warning: Choosing no will overwrite controller if it exist. (y/n) [y] n Would you like to include some basic class methods (index(), add(), view(), edit())? (y/n) [y] y Would you like to create the methods for admin routing? (y/n) [y] n Fatal error: Class 'Admin' not found in C:\xampp\htdocs\cake\cake \scripts\bake.php on line 1328 Windows dialogue box also pops up entitled Microsoft Windows: CLI has stopped working, A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.. This person describes his solution to the problem http://web2.0entrepreneur.com/31/cli-has-stopped-working-on-windows- vista.html. I deleted C:/xampp/php directory, downloaded latest pre- compiled binary version of PHP http://uk.php.net/distributions/ php-5.2.4-Win32.zip. I renamed php.ini.recommended to php.ini uncommented mysql and mysqli extensions, and tried again: Bake -app in C:\xampp\htdocs\cake\myproject (y/n) [y] y What would you like to Bake? (M/V/C) c Fatal error: Call to undefined function mysql_connect() in C:\xampp \htdocs\cake\cake\libs\model\dbo\dbo_mysql.php on line 100 phpinfo() says that MySQL is enabled and cake can connect to the db. Everything is as sweet as pie apart from this issue and I'd appreciate any feedback to resolve this issue. Many thanks, Michael --~--~-~--~~~---~--~~ 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: Restrict access to my admin area
Lol... Yeah, that's what I meant.. Sorry, I'm a bit new to cake. -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On 9/4/07, majna [EMAIL PROTECTED] wrote: admin area? for. 1.1.x: You can uncommnet define('CAKE_ADMIN', 'admin'); in app/config.php and prefix all admin actions with admin_ like: admin_edit() In $this-params will be 'admin', and U can check it in beforeFilter in app_controller or so. admin urls: /admin/news/edit/32 (also change urls in admin views) On Sep 4, 1:28 pm, Stanley [EMAIL PROTECTED] wrote: I create admin area with many controllers and views. Now i want to make restrict access to this pages but i don't want to repeat myself to each controller and write there a function like _checkLoggedIn() . (It's not DRY( Don't Repear Yourself)) How to make restrict access to my pages in simple way. (I'm new in cakephp). Are there any simple tutorials to this? Does anyone have any ideas? 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: Index Function
This also helped me a lot: http://www.sitepoint.com/article/application-development-cakephp -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On 9/4/07, citrus [EMAIL PROTECTED] wrote: Try the tutorial in CakePHP manual and you'll know how to get started with Cake quickly. On Sep 4, 8:44 am, SpyderDriver [EMAIL PROTECTED] wrote: Hello, I am new to Cake and I keep running into little catches that I cant figure out. How do I create a default action for a controller? I thought it was to create an index function in that controller file but that didn't seem to work. I was walking through a tutorial that created a users control with a register action and a knownusers action. What happens when someone decides to use domain.com/users/ as a url. Right now it throws an error. What is needed to show a page for that directory? --~--~-~--~~~---~--~~ 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: An idea to improve cake's code design
On 9/4/07, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: Kudos for the time invested. My concern is that caching and unnecessary creation of objects. (The objects have to be created even if the page is already cached). I have noticed that object creation (even for some single pages with Hello world) slows down the pages at least to some extent. Well, I believe that it is the *output* that is being cached, not the objects themselves. And I would expect to see some benchmarks proving statements such as I have noticed that object creation slows down the pages. -- 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 -~--~~~~--~~--~--~---
Re: including one or more pages in another page
Hai, I don't want to place the code in view/elements. Assume i have pages for mails in view/mails. I don't want to keep the email.ctp in view/elements as it again modularizes the code, some pages in view/mails and some code in view/elements related to mails module. I want to keep all the pages/code in view/mails and render/include the pages like you showed me in example. Is that possible On Sep 3, 5:37 pm, Charlie van de Kerkhof [EMAIL PROTECTED] wrote: Hi Ravi, in cakePHP you can make view elements which contains pieces of PHP and HTML code. In that mail template of yours you can 'include' those elements. example: in email.ctp (or email.thtml if you still use v1.1) ?=$this-renderElement('loginbox', array(loggedin = true, 'username'='ravi'));? and in app/views/elements/loginbox.ctp (or .thtml) you have html with PHp that makes a login box/form with the two variables you passed. On Sep 3, 10:36 am, Ravi [EMAIL PROTECTED] wrote: Hai, I want to include one page into another. How can we do that with cakephp similar to php where we can use include/require. In php i am passing the variables required from main page. For example: Assume i have to display mails. For that I have three pages: PAGE 1: ( Main page1)--- Which contains logo and includes other two pages. PAGE 2: which contains info like total no of mails ,no of mails unread etc. PAGE 3: which contains latest 20 mails. My page is like !PAGE1 code starts here //PHP code starts here //$mailsCount = array(); : This parameter is handled //$mailsList = array(); include(header.php); include(page2.php); //$mailsCount array used in this page include(page3.php); //$mailsList array uses in this page PAGE3 !-/PAGE1 code ends here--- How can we do similar thing in 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: is_file returns false - while the file exists
On 9/4/07, Anna P [EMAIL PROTECTED] wrote: Hi. I have problem with web photo gallery for a store. Photos are uploaded by CMS. They are stored in webroot/img/upload and their name is like photo_file1_{item_id}, photo_file2_{item_id}, etc. The problem is when I try to display photos and first I want to check if the item of the store has a photo. ?php if(is_file($this-webroot.img/upload/photo_file1_.$item['Item'] ['id']..jpg)):? img src=?php echo $this-webroot?img/upload/photo_file1_?php echo $item['Item']['id']?.jpg / ?php endif;? It shows me nothing, but the file exists. In fact, when I remove IF it shows me photo. Anyone maybe knows how to deal with this? Well, given that is_file() is a PHP function, not a Cake-specific function, my first guess would be that the path to the file you are giving to is_file is incorrect. Remember, there is a difference between file paths and locations via URL. The fact that it shows up when you get rid of the if means that you are correctly passing in a location that the web browser can use to find the file. In all seriousness, try printing out what you are passing to is_file and try typing (if you are using UNIX) 'ls FullPathToFileYouAreUsing'. If you don't find the file there, then I think you've found the problem. Hope that helps. -- 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 -~--~~~~--~~--~--~---
I need to send signup mails from 2 controllers, so where should I put my sendSignupMail function?
Hello. I need to send signup mails from 2 controllers, so where would you recommend I put my sendSignupMail function? Regards, Jacob --~--~-~--~~~---~--~~ 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: Question about saving info in two tables from 1 model
Thanks... but what is a factory object??? Sorry for my ignorance =S... On Sep 3, 7:32 pm, Geoff Ford [EMAIL PROTECTED] wrote: I would use a factory object to load a seperate model based on the user type. See this thread for a simliar problem.http://groups.google.com/group/cake-php/browse_thread/thread/a2a14087... Geoff --http://lemoncake.wordpress.com On Sep 4, 6:08 am, nerohc [EMAIL PROTECTED] wrote: Hi everyone. I'm new in this group and with cake too. I have this problem: I have a Users table, which contains login, pass, etc. and 2 tables with user's details. I use one or other table acording to the user's group. For example if i register as a simple user, my details would be saved in 'simple_details'. If my group is advanced users, then my details would be saved in 'advanced_details'. My first thought was to make a function that selects which table should use. However i think that cake could have some way to do this. If there is any way, please let me know. This is not a trouble really, is just curiousity. 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: An idea to improve cake's code design
On Sep 4, 6:14 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: Kudos for the time invested. My concern is that caching and unnecessary creation of objects. (The objects have to be created even if the page is already cached). I have noticed that object creation (even for some single pages with Hello world) slows down the pages at least to some extent. Well, I believe that it is the *output* that is being cached, not the objects themselves. And I would expect to see some benchmarks proving statements such as I have noticed that object creation slows down the pages. The problem is that you're trying to stamp every other as an idiot. Unless you have changed your attitude, you can't read my humble comments like this. (no offense of course; read it as straight comment) -- ?php echo 'Just another PHP saint'; ? Email: rrjanbiah-at-Y!comBlog: http://rajeshanbiah.blogspot.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: An idea to improve cake's code design
On 9/4/07, R. Rajesh Jeba Anbiah [EMAIL PROTECTED] wrote: The problem is that you're trying to stamp every other as an idiot. Unless you have changed your attitude, you can't read my humble comments like this. (no offense of course; read it as straight comment) Actually, I did no such thing. I said what I believed (and Nate told me via IM that I was actually wrong in that regard, thank you Nate for correcting me), but I believe it is entirely fair to say that when someone says something like X slows down my code then I would expect to see some proof of that in the form of benchmarks. If that's making you look like an idiot, then I suspect you are reading something into the comment that is not there. It's not about making people look like an idiot, because I believe that people usually don't need any help in that department (me included). It's about making sure you are saying something that is true rather than just opinion, and stepping up and admitting when you were wrong. Which I believe I just did. -- 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 -~--~~~~--~~--~--~---
Redirect / 401
Hello, I need to redirect to another URL on some conditions (auth failed), along with a 401 http status (for seo). But http clients (according to rfc) only redirect with 3xx status, so : 1) redirect('url') sends a 302, and 2) redirect('url',401) dont redirect browser. The idea, then, would be to ~internally reroute~ request to another controller/view, along with sending the 401 http status. And I'm unable to do this (tried a lot of weird things : requestaction, setaction, custom error handler, ). Thanks for your 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: An idea to improve cake's code design
Okay, but how do you think about changing cake's architecture? --~--~-~--~~~---~--~~ 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_file returns false - while the file exists
There is a problem with this statement. if(is_file($this-webroot.img/upload/photo_file1_.$item['Item']['id']..jpg)): Chris is right, Above statement gives you the path readable by browser not the filesystem bcoz of '$this-webroot.' Ketan Anna P wrote: Hi. I have problem with web photo gallery for a store. Photos are uploaded by CMS. They are stored in webroot/img/upload and their name is like photo_file1_{item_id}, photo_file2_{item_id}, etc. The problem is when I try to display photos and first I want to check if the item of the store has a photo. ?php if(is_file($this-webroot.img/upload/photo_file1_.$item['Item'] ['id']..jpg)):? img src=?php echo $this-webroot?img/upload/photo_file1_?php echo $item['Item']['id']?.jpg / ?php endif;? It shows me nothing, but the file exists. In fact, when I remove IF it shows me photo. Anyone maybe knows how to deal with this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: An idea to improve cake's code design
On 9/4/07, xephex [EMAIL PROTECTED] wrote: Okay, but how do you think about changing cake's architecture? I'll leave the comments on your thoughts to PhpNut. What you are describing is a major fundamental change to how CakePHP currently works. However, I will say this: I don't see how changing things would make it (and I quote from your PDF) much easier to understand for all those who want to start coding in Cake. CakePHP has a set of rules in place for how to use it. Follow those rules and things usually work out just fine. -- 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 -~--~~~~--~~--~--~---
Re: Redirect / 401
Routes.php is exactly for this reason. See in your app/config dir. Also, a more explanation could help, you haven't explained your problem in more details. Give a simple example then perhaps someone could help you better. Ketan snow_raph wrote: Hello, I need to redirect to another URL on some conditions (auth failed), along with a 401 http status (for seo). But http clients (according to rfc) only redirect with 3xx status, so : 1) redirect('url') sends a 302, and 2) redirect('url',401) dont redirect browser. The idea, then, would be to ~internally reroute~ request to another controller/view, along with sending the 401 http status. And I'm unable to do this (tried a lot of weird things : requestaction, setaction, custom error handler, ). Thanks for your 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: wrong coding in layout variables from beforeRender function
Anna, Do you also have the line: echo $html-charset('UTF-8'); in your layout, as suggested above? The commands you say you have in your layout don't get parsed by the browser, whereas the meta http- equiv=Content-Type content=text/html;charset=utf-8 / tag which is inserted by $html-charset(); does. This could account for your problems, if not. Hope this helps! On Sep 4, 12:54 pm, Anna P [EMAIL PROTECTED] wrote: Yes it is:]. In fact, in the layout I use: ?php ini_set('default_charset', 'utf-8'); header('Content-Type: text/html; charset=utf-8');? at the beggining, so the browser knows what the encoding is. --~--~-~--~~~---~--~~ 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: Model Save bug? (CakePHP 1.2 MySQL)
I doubt it's a bug with Cake... if you have fields specifically set to be unique in the database, then nothing Cake can do should allow NON- unique fields. Seems very strange. I would imagine that the records that appear to be non-unique actually are unique, but probably with hidden characters or something of that sort. Do you have any more details? On Sep 4, 1:17 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In table I have two fields UNIQUE. When I set debug level = 1, after Model-save, I can see: MySQL warning I get my own warning, which show, when Model-save fail. But, when I switch into debug level = 0 . I don't see any warning and get records in my table with non unique fields! It's bug? --~--~-~--~~~---~--~~ 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: Augmenting controller actions with components
To an extent, yes, this could be solved with base / mini controllers. Of course then you have a whole other bunch of abstract controllers which have to be protected from the web. Also, you very quickly end up with very complex class hierarchies if you want to have, say some actions from one base controller, some from another, but not the ones from another etc etc. Adding actions as part of a component lets you take a more aspect oriented approach to design. 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 -~--~~~~--~~--~--~---
Re: I need to send signup mails from 2 controllers, so where should I put my sendSignupMail function?
Signup component or app_controller.php On Sep 4, 3:13 pm, webjay [EMAIL PROTECTED] wrote: Hello. I need to send signup mails from 2 controllers, so where would you recommend I put my sendSignupMail function? Regards, Jacob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: problems with midphase hosting
problems with midphase hosting... don't get me started! Ok, so they weren't CakePHP related, it was just poor, amateurish support and constant problems that sent me packing up all my websites and moving to a dedicated server (NOT with Midphase, either). It appears to me that they grew there business too fast without the proper infrastructure in place to deal with it. We always had MySQL connection issues and it wasn't until one of their shared boxes that I had an account on went belly up and they couldn't get it back up for over 2 days! C'mon, you should be able to recover from any hardware disasters in far less time. After the second day of our site being down, and them not being able to provide an E.T.A.see ya, Midphase. Then 5 months after I closed the account, I started getting daily admin email notices from cpanel. They're back. Just when I thought I was done dealing with there incompetent tech support, I had to go through another agonizing round of support communication. From if you'd like to restore your account... NO! I don't want to restore my account with you dumb *%$#'s, I just want to you cancel all traces of my account like you should have in the first place! I could go on with several more stories but I just thought I'd warn my fellow web developers webmasters about them. Interesting note for anyone on a shared hosting account: try running this tool on a shared domain: http://whois.domaintools.com/ and see how thin your hosting company is spreading there resources by looking at the Reverse IP feature to see the total number of sites hosted on the server. With Midphase, you'll typically see 1,200+ sites! Sorry to get off topic (again). NOSLOW --~--~-~--~~~---~--~~ 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: Redirect / 401
use if(user_has_no_rights()) { header('HTTP/1.1 401 Unauthorized');// - robots may need this // The following will return the rendered action of that controller to you. echo $this-requestAction('anothercontroller/action', array('return')); $this-autoRender = false; // Needed to avoid rendering of current action. $this-layout = ''; die(); } This will return the rendered view to your current controller that is been called. Hope this helps, Ketan On Sep 4, 10:24 am, snow_raph [EMAIL PROTECTED] wrote: Routes.php is exactly for this reason. See in your app/config dir. Also, a more explanation could help, you haven't explained your problem in more details. Give a simple example then perhaps someone could help you better. ok, I'm in an action of my controller, user has insufficient rights, I want to reroute the curent controller/action to another controller/ action, while returning a 401 header status. Ideally I'd like : controller if(user_has_no_rights()) { header('HTTP/1.1 401 Unauthorized');// - robots may need this stop_current_controller_stuff_and_do('/anothercontroller/action');} controller --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Complex table relationship within one model
This is my first post to this group, so I'd like to say hello first. :) This post seems long, but the question is pretty simple - not sure about the answer. My question revolves around models. I have 5 tables that represent geographic information. I want to use this to do radius searches among other things. My problem is I'm not sure how to represent this data within Cake. My tables are setup as follows: zip_codes zip_code latitude longitude dst (daylights saving - boolean) timezone cities id state_id name cities_zip_codes city_id zip_code states id country_id name countries id name I would like to be able to access this data through one object that is locked down. There will be no reason for my application to ever add or delete from these tables. I was hoping that I could create something sort of like a Component is to a controller or a helper is to a view for a model. Nothing like this seems to exist, however. If I were to use Cake's built in ORM, it would be as follows: zip_code has and belongs to many city city has and belongs to many zip_code, city belongs to state state has many city, state belongs to country country has many state Using it this way, which model would I then use? How do I keep coders from using these models to edit the tables? Isn't this a LOT of queries everytime I instantiate one of these models? And scaffolding totally blows up (spikes my Apache process to 100% and doesn't let go) when I attempt to use this type of ORM. I need a way to have an object talk to these tables and provide me with the few functions I need (distance between two zip codes, radius searching, etc.) without providing full ORM. I also need to be able to access this object from within any controller and it needs to use the DB connection that Cake sets up. What is the best way to accomplish this while staying within the constraints and guidelines of the Cake system? Any suggestions are GREATLY appreciated! Thanks, Jason --~--~-~--~~~---~--~~ 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_file returns false - while the file exists
OK so how to use it? When I try if(is_file(../img/upload/photo_file1_.$item['Item'] ['id']..jpg)): (the path, which img src just gives me the right image) it doesn't work as well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: is_file returns false - while the file exists
On 9/4/07, Anna P [EMAIL PROTECTED] wrote: OK so how to use it? When I try if(is_file(../img/upload/photo_file1_.$item['Item'] ['id']..jpg)): (the path, which img src just gives me the right image) it doesn't work as well. I think you will have to experiment with figuring out what the right path is. Of the top of my head I don't know what it is. -- 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 -~--~~~~--~~--~--~---
Re: Redirect / 401
Routes.php is exactly for this reason. See in your app/config dir. Also, a more explanation could help, you haven't explained your problem in more details. Give a simple example then perhaps someone could help you better. ok, I'm in an action of my controller, user has insufficient rights, I want to reroute the curent controller/action to another controller/ action, while returning a 401 header status. Ideally I'd like : controller if(user_has_no_rights()) { header('HTTP/1.1 401 Unauthorized');// - robots may need this stop_current_controller_stuff_and_do('/anothercontroller/action'); } controller --~--~-~--~~~---~--~~ 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: Security issue with Model-save() when adding data (Cake 1.2)
On 9/4/07, J. Eckert [EMAIL PROTECTED] wrote: Hi there, There seems to be a security issue with the Model-save() function in Cake 1.2 if you are adding data through a form. I don't know if you already checked it out, but there is a Security component that I think might help alleviate some of your fears about the exact type of attack you are talking about: http://manual.cakephp.org/chapter/security There have also been a few threads on this mailing list about it as well, so I also suggest searching those out via the Google Groups interface. Hope that helps. -- 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 -~--~~~~--~~--~--~---
Strange URL's
Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http:// www.server.com/pages/magasin/Leers-Nord) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Redirect / 401
use if(user_has_no_rights()) { header('HTTP/1.1 401 Unauthorized');// - robots may need this // The following will return the rendered action of that controller to you. echo $this-requestAction('anothercontroller/action', array('return')); $this-autoRender = false; // Needed to avoid rendering of current action. $this-layout = ''; die(); } Thank you very much Ketan ! Now what if I want my requestAction to be rendered within its own layout ? (you now understand why the subject of this post contains redirect) --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
This is very helpful, but only solves half of my problem. The problem is that my input data has duplicates. For instance: --- function getFooId( $name ) { $conditions = `dbFoo.name` LIKE '%$name%'; $fooId = $this-Foo-field( 'id', $conditions ); if( !isset($fooId) || $fooId == false ) { $fooId = 0; } return $fooId; } function addFooToDb( $name, $text ) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId = 0 ) { $newFoo['id'] = $fooId; $newFoo['name'] = $name; $newFoo['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $fooId; if( $fooId == 0 ) { $retVal = $this-Foo-getLastInsertId(); } } } return $retVal; } --- Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. I'm trying to keep this as data independent as possible here, and caching the name-to-id mappings in a hash of my own seems like an unnecessary duplication of data, especially for a large data set. Ideas? -Packgrog On Aug 31, 9:55 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 8/31/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Well, the query definitely runs, as the data exists in the table after the script completes. The problem is that I'm trying to access the new row in the table during the same run of the script immediately after running Model::save(), under the assumption that this command would immediately save the result in the database. Maybe it's just that the model itself is caching the data and I need a better way of forcing a read? There is no caching of data when it saves, and there is no command to force reads. Whenever I've wanted the id of a record I've just saved, I've done the following: // assume $this-data has stuff in it if ($this-Foo-save($this-data)) { $fooId = $this-Foo-getLastInsertId(); } Then you go on your merry way doing whatever other work you wanted to do, happy in the knowledge that $fooId contains the id of the record you just created in the table associated with the Foo model. Hope that helps. -- 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 -~--~~~~--~~--~--~---
Fatal error: Cannot redeclare class DboSource
I am working with two databases, when my controller wich use two tables form distinct databases crash and show me this error: Fatal error: Cannot redeclare class DboSource Alvaro Thanks P.D. search web doesn't help me so I post it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: renderElement not working in Ajax Updated div
Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
one to many and many to one ???.
aHi I have a people file and an events file zI wan to show the one person and show all events with add , delete view activity. code= ?php class Person extends AppModel { var $name = Person; var $hasMany = array('events' = array('className' = 'Event', // 'conditions'= 'Comment.moderated = 1', // 'order' = 'Comment.created id', // 'limit' = '100', 'foreignKey'= 'person_id', // 'dependent' = true, // 'exclusive' = false, 'finderQuery' = '' ) ); } ? -- ?php class PeopleController extends AppController { var $name = People; var $scaffold; } ? ?php class EventsController extends AppController { var $name = Events; var $scaffold; } ? -- When I run the events I get the events but not the person related to the events. How does scaffolding work Jim --~--~-~--~~~---~--~~ 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: Fatal error: Cannot redeclare class DboSource
Solved. Upgrade last version On Tuesday 04 September 2007 13:20, Alvaro wrote: I am working with two databases, when my controller wich use two tables form distinct databases crash and show me this error: Fatal error: Cannot redeclare class DboSource Alvaro Thanks P.D. search web doesn't help me so I post it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Redirect / 401
This will return the rendered view to your current controller that is been called. Hope this helps, Thank you very much Ketan ! Now what if I want my requestAction contents to be rendered in its own layout ? (you now understand why the subject of my post contains redirect') --~--~-~--~~~---~--~~ 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: Model Save bug? (CakePHP 1.2 MySQL)
On Sep 4, 5:16 pm, MrTufty [EMAIL PROTECTED] wrote: I doubt it's a bug with Cake... if you have fields specifically set to be unique in the database, then nothing Cake can do should allow NON- unique fields. Seems very strange. I would imagine that the records that appear to be non-unique actually are unique, but probably with hidden characters or something of that sort. Do you have any more details? Hm. What's more? When debug set in 1. I see MySQL warning about key Warning (512): SQL Error: 1062: Duplicate entry 'test' for key 2 [CORE \cake\libs\model\datasources\dbo_source.php, line 463 And in my controller action add in if($this-User-save($this-data)) { $this-flash('All good','/login'); $this-redirect(array('action'='index'), null, true); } else { $this-data['User']['password'] = null; $this-Session-setFlash('All bad'); } I get All bad; When I (don't change code) change debug to 0 I don't see (of couse) SQL Error And (!) don't see error - I see All good. And finaly I have two records in table with equal fields, who must be unique. Where is my error? In case it's don't Cake error? On Sep 4, 1:17 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In table I have two fields UNIQUE. When I set debug level = 1, after Model-save, I can see: MySQL warning I get my own warning, which show, when Model-save fail. But, when I switch into debug level = 0 . I don't see any warning and get records in my table with non unique fields! It's bug? --~--~-~--~~~---~--~~ 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: Strange URL's
Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: renderElement not working in Ajax Updated div
I had a similar problem once, caused by many blanks and also some trailing space after the ? into the element. Have you tried to simplify the element (for example just h1Hello/ h1) ? On Sep 4, 7:09 pm, Richard [EMAIL PROTECTED] wrote: Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- 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 -~--~~~~--~~--~--~---
Re: Strange URL's
Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange URL's
Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange URL's
Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Redirect / 401
Well, that is the reason why I told to set autoRender to false in current controller but not in the requestAction controller, set the layout explicitly in the requested controller and see what it gives, I haven't tried it but let me know what you get. Ketan snow_raph wrote: This will return the rendered view to your current controller that is been called. Hope this helps, Thank you very much Ketan ! Now what if I want my requestAction contents to be rendered in its own layout ? (you now understand why the subject of my post contains redirect') --~--~-~--~~~---~--~~ 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: Strange URL's
Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Security issue with Model-save() when adding data (Cake 1.2)
You could also hash your id in an hidden field, and when receiving the form, hash again the id and compare with the hidden hashed field. To trick you would have to find the hash string also ..a bit harder. That with the Security should cover your needs. Hope this helps On Sep 4, 7:00 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, J. Eckert [EMAIL PROTECTED] wrote: Hi there, There seems to be a security issue with the Model-save() function in Cake 1.2 if you are adding data through a form. I don't know if you already checked it out, but there is a Security component that I think might help alleviate some of your fears about the exact type of attack you are talking about: http://manual.cakephp.org/chapter/security There have also been a few threads on this mailing list about it as well, so I also suggest searching those out via the Google Groups interface. Hope that helps. -- 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 -~--~~~~--~~--~--~---
start cakephp project help
Hi, I wanna start a new project in cake. it basically shopping cart and CMS. front end and admin both are available in that project . How can i start in cake php . Is there any sample cake php project available? i am step the cake php and database configuration. now wait for start how can i start. any one help me please. -- Lalit Kumar Netsolutions 09888711687 --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
Yep, sorry Chris, next time I will read more carefully the post. The name of the function does match the opposite of the functionality :-) On Sep 4, 8:32 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, francky06l [EMAIL PROTECTED] wrote: Maybe just before the save do : $this-Foo-create(); Well, $this-Foo-create() will do exactly that: create a new record. I think the object here is to update an existing record if it already exists. -- 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 -~--~~~~--~~--~--~---
Re: Security issue with Model-save() when adding data (Cake 1.2)
My proposed fix in the trac ticket is that if there is a fieldList parameter, 'id' has to be in that list otherwise it won't be set. I think this is really important as a default behaviour for cake. It's rather confusing that you have a whitelist but 'id' gets thru. It's dangerous. Just to make shure you understand what happens: You have an add method in your controller: function add() { $this-Model-create(); $this-Model-save($this-data, true, array('field1,'field2')); } So if someone adds an 'id' field in your add form your add method overwrite existing record, despite you used create() and a whitelist. Don't get me wrong the above sample is just very simplified. Cheers, Timo On 9/4/07, francky06l [EMAIL PROTECTED] wrote: You could also hash your id in an hidden field, and when receiving the form, hash again the id and compare with the hidden hashed field. To trick you would have to find the hash string also ..a bit harder. That with the Security should cover your needs. Hope this helps On Sep 4, 7:00 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, J. Eckert [EMAIL PROTECTED] wrote: Hi there, There seems to be a security issue with the Model-save() function in Cake 1.2 if you are adding data through a form. I don't know if you already checked it out, but there is a Security component that I think might help alleviate some of your fears about the exact type of attack you are talking about: http://manual.cakephp.org/chapter/security There have also been a few threads on this mailing list about it as well, so I also suggest searching those out via the Google Groups interface. Hope that helps. -- 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 -- Timo Derstappen http://teemow.com mailto:[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: is_file returns false - while the file exists
if(file_exists(IMAGES. 'upload' . DS . 'filename')) hope this helps On Sep 4, 8:31 pm, Ketan Patel [EMAIL PROTECTED] wrote: look in cake/config/paths.php, it has most of the general path constants that one would need. I think WEBROOT_DIR is what you need, however, look in that file for more info. Ketan Anna P wrote: OK so how to use it? When I try if(is_file(../img/upload/photo_file1_.$item['Item'] ['id']..jpg)): (the path, which img src just gives me the right image) it doesn't work as well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Strange URL's
I have this problem for all my URL's, the images cannot be found ( url searched: http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place of http://www.server.com/img/image.ext ), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
PHPBB3 and Cake
Hello, im new to the group. I'm starting my first proper project with cake and need a bit of advice. Has anyone tried to integrate with phpBB3 yet? I have come up to a problem already. I have cake in my root, well what will be root when i put it on the server. Inside the folder i have all the cake ones plus forum this is where phpBB lives, obviously typing in host.com/forum/ isnt going to work as it looks for a controller named forum. How can i make it go to the forum index? I imagine this has something to do with routes. Any help will be appreciated Cheers! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: start cakephp project help
Check in the cakeForge. Some CMS projects there. On Sep 4, 8:46 pm, lalit kumar [EMAIL PROTECTED] wrote: Hi, I wanna start a new project in cake. it basically shopping cart and CMS. front end and admin both are available in that project . How can i start in cake php . Is there any sample cake php project available? i am step the cake php and database configuration. now wait for start how can i start. any one help me please. -- Lalit Kumar Netsolutions 09888711687 --~--~-~--~~~---~--~~ 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: Strange URL's
Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot retrieve new records after saving them
Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. I should reiterate something with my example: The first time I run it with the sample data, if there are no entries in the database table, getFooId() will ALWAYS return 0, even if the entry has already been successfully saved. After the script has been run, if I run it again with the exact same data, it will always find the id for the first record that was created. Is that clearer at all? -Packgrog On Sep 4, 2:11 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- 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 -~--~~~~--~~--~--~---
Re: renderElement not working in Ajax Updated div
I've tried just about everything :-/ ...well and truly stumped. On Sep 4, 10:03 pm, francky06l [EMAIL PROTECTED] wrote: I had a similar problem once, caused by many blanks and also some trailing space after the ? into the element. Have you tried to simplify the element (for example just h1Hello/ h1) ? On Sep 4, 7:09 pm, Richard [EMAIL PROTECTED] wrote: Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: one to many and many to one ???.
It's not a scaffolding problem, it's a model relation problem (you did not show the Event model). You can't get the person by querying the Events if there is no relation from events to person. Either you make the events belongsTo person or you query your Events from the Person model. On Sep 4, 7:38 pm, SIXS [EMAIL PROTECTED] wrote: aHi I have a people file and an events file zI wan to show the one person and show all events with add , delete view activity. code= ?php class Person extends AppModel { var $name = Person; var $hasMany = array('events' = array('className' = 'Event', // 'conditions'= 'Comment.moderated = 1', // 'order' = 'Comment.created id', // 'limit' = '100', 'foreignKey'= 'person_id', // 'dependent' = true, // 'exclusive' = false, 'finderQuery' = '' ) ); } ? -- ?php class PeopleController extends AppController { var $name = People; var $scaffold;} ? ?php class EventsController extends AppController { var $name = Events; var $scaffold;} ? -- When I run the events I get the events but not the person related to the events. How does scaffolding work Jim --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. Well, that's what the example you had was doing anyway. :) Here's a tweaked version. function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else { $this-Foo-create(); } $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } return $retVal; } That *should* create a new record if getFooId() returns zero, and update an existing record otherwise. -- 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 -~--~~~~--~~--~--~---
Re: Cannot retrieve new records after saving them
I think with all the posts you get the answer, should look like : if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else $this-Foo-create(); $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) $retVal = ($foold ? $this-Foo-field('id') : $this-Foo-getLastInsertID()); } } return $retVal; On Sep 4, 9:03 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. I should reiterate something with my example: The first time I run it with the sample data, if there are no entries in the database table, getFooId() will ALWAYS return 0, even if the entry has already been successfully saved. After the script has been run, if I run it again with the exact same data, it will always find the id for the first record that was created. Is that clearer at all? -Packgrog On Sep 4, 2:11 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- 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 -~--~~~~--~~--~--~---
Re: Strange URL's
Index.php ( I deleted the comments ): ?php if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if (!defined('ROOT')) define('ROOT', dirname(dirname(dirname(__FILE__; if (!defined('APP_DIR')) define('APP_DIR', basename(dirname(dirname(__FILE__; if (!defined('CAKE_CORE_INCLUDE_PATH')) define('CAKE_CORE_INCLUDE_PATH', ROOT); if (!defined('WEBROOT_DIR')) define('WEBROOT_DIR', basename(dirname(__FILE__))); if (!defined('WWW_ROOT')) define('WWW_ROOT', dirname(__FILE__) . DS); if (!defined('CORE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } } if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) trigger_error(Can't find CakePHP core. Check the value of CAKE_CORE_INCLUDE_PATH in app/webroot/index.php. It should point to the directory containing your . DS . cake core directory and your . DS . vendors root directory., E_USER_ERROR); if (isset($_GET['url']) $_GET['url'] === 'favicon.ico') { return; } else { $Dispatcher = new Dispatcher(); $Dispatcher-dispatch($url); } if (Configure::read() 0) echo !-- . round(getMicrotime() - $TIME_START, 4) . s --; ? /.htaccess: IfModule mod_rewrite.c RewriteEngine on RewriteRule^private/$ private/index.php [L] # private section, used to redirect http://www.maryphoto.be/private to http://www.maryphoto.be/maryphoto/webroot/private/index.php RewriteRule^$ maryphoto/webroot/accueil.php [L] # I am upgrading my website to cakePHP, so I redirect visitors to accueil.php to see the old one. RewriteRule(.*) maryphoto/webroot/$1 [L] /IfModule SetEnv PHP_VER 5 # Used on OVH to activate PHP5 /maryphoto/.htaccess: IfModule mod_rewrite.c RewriteEngine on RewriteRule^$webroot/[L] RewriteRule(.*) webroot/$1[L] /IfModule /maryphoto/webroot/.htaccess: IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule Hope it will help, Fabian Pijcke. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi
Re: Strange URL's
hummm ..some of the rules are messing the rewrite (not sure). Try keep only the one in webroot. An other trick, I have an OVH domain and I needed to add rewriteBase in order it to work. My webroot is alpha under the www (but my application and the cake directory are not under www). I added rewriteBase /alpha in the .htaccess of the webroot (ie : alpha for instance). Another problem I had with OVH, I needed to disable the gzip in htaccess in order to make it work with PHP 5 (maybe the corrected that bug since). On Sep 4, 9:17 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Index.php ( I deleted the comments ): ?php if (!defined('DS')) define('DS', DIRECTORY_SEPARATOR); if (!defined('ROOT')) define('ROOT', dirname(dirname(dirname(__FILE__; if (!defined('APP_DIR')) define('APP_DIR', basename(dirname(dirname(__FILE__; if (!defined('CAKE_CORE_INCLUDE_PATH')) define('CAKE_CORE_INCLUDE_PATH', ROOT); if (!defined('WEBROOT_DIR')) define('WEBROOT_DIR', basename(dirname(__FILE__))); if (!defined('WWW_ROOT')) define('WWW_ROOT', dirname(__FILE__) . DS); if (!defined('CORE_PATH')) { if (function_exists('ini_set')) { ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path')); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); }} if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) trigger_error(Can't find CakePHP core. Check the value of CAKE_CORE_INCLUDE_PATH in app/webroot/index.php. It should point to the directory containing your . DS . cake core directory and your . DS . vendors root directory., E_USER_ERROR); if (isset($_GET['url']) $_GET['url'] === 'favicon.ico') { return;} else { $Dispatcher = new Dispatcher(); $Dispatcher-dispatch($url);} if (Configure::read() 0) echo !-- . round(getMicrotime() - $TIME_START, 4) . s --; ? /.htaccess: IfModule mod_rewrite.c RewriteEngine on RewriteRule^private/$ private/index.php [L] # private section, used to redirecthttp://www.maryphoto.be/privatetohttp://www.maryphoto.be/maryphoto/webroot/private/index.php RewriteRule^$ maryphoto/webroot/accueil.php [L] # I am upgrading my website to cakePHP, so I redirect visitors to accueil.php to see the old one. RewriteRule(.*) maryphoto/webroot/$1 [L] /IfModule SetEnv PHP_VER 5 # Used on OVH to activate PHP5 /maryphoto/.htaccess: IfModule mod_rewrite.c RewriteEngine on RewriteRule^$webroot/[L] RewriteRule(.*) webroot/$1[L] /IfModule /maryphoto/webroot/.htaccess: IfModule mod_rewrite.c RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] /IfModule Hope it will help, Fabian Pijcke. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners
Re: Strange URL's
Oh, and I'm under Linux with Apache 1.3.37 and PHP 5.2.3. I don't know the distrib but uname -r returns 2.6.18.1-grsec-mutu-grs- ipv4-32. (MySQL 5.0) My CakePHP version is the last nightbuild. VERSION.txt said 1.2.0.5427alpha. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: renderElement not working in Ajax Updated div
can you past some code in the bin or by mail ? On Sep 4, 9:05 pm, Richard [EMAIL PROTECTED] wrote: I've tried just about everything :-/ ...well and truly stumped. On Sep 4, 10:03 pm, francky06l [EMAIL PROTECTED] wrote: I had a similar problem once, caused by many blanks and also some trailing space after the ? into the element. Have you tried to simplify the element (for example just h1Hello/ h1) ? On Sep 4, 7:09 pm, Richard [EMAIL PROTECTED] wrote: Hi, thanks for your reply. The confirmation page is a seperate file and the thank you message is updated within the start and end divs. However renderElement does not work -- if I use PHPs native include the data is added but causes additional problems. On Sep 4, 9:37 am, francky06l [EMAIL PROTECTED] wrote: Well your ajax submit updates the contact_form, but your element is outside thediv/ divEnd. Try moving the divEnd after therenderElement. On Sep 4, 6:18 am, Richard [EMAIL PROTECTED] wrote: Hi, No I amnotusing requestAction. Here is the code: Any help would be gratefully appreciated. // FORM ?php e($ajax-div('contact_form')); ? form method=post action=?php e($html-url('/properties/ contact_us'));? onsubmit=return false; table cellpadding=10 cellspacing=0 tr td align=rightName: /td td ?php e($html-input('Enquire/name'));? /td /tr tr td align=rightEmail: /td td ?php e($html-input('Enquire/email'));? /td /tr tr td align=rightPhone (including country code): /td td ?php e($html-input('Enquire/phone')); ? /td /tr tr td align=rightMessage: /td td ?php echo $html-textarea('Enquire/message', array('cols'='60', 'rows'='10')); ? /td /tr tr td/td td /td /tr /table ?php echo $ajax-submit('Submit', array('url' = '/properties/ contact_us', 'update' = 'contact_form'));? /form ?php e($ajax-divEnd('contact_form')); ? // CONTROLLER SCRIPT $this-redirect('/confirmations/contact_us/'.$this-data['Enquire'] ['name'].'/'.$this-data['Enquire']['email']); // CONFIRMATION PAGE e('trtdh1Thank you for your email. You will be contacted shortly./h1/td/tr'); $this-renderElement('newsletter_prompt'); // -- this code isnot included into page On Sep 3, 8:14 pm, francky06l [EMAIL PROTECTED] wrote: Does your element calls a requestAction ? On Sep 3, 6:22 am, Richard [EMAIL PROTECTED] wrote: Hi, I have an Ajax form that posts some data and theupdateddivsection (confirmation page) callsrenderElement-- but for some reason does notwork. Any ideas? Many thanks, Richard --~--~-~--~~~---~--~~ 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: Strange URL's
well I can give you my tree under OVH if you are interested. OVH is quite tricky with their special version of Apache. On Sep 4, 9:21 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Oh, and I'm under Linux with Apache 1.3.37 and PHP 5.2.3. I don't know the distrib but uname -r returns 2.6.18.1-grsec-mutu-grs- ipv4-32. (MySQL 5.0) My CakePHP version is the last nightbuild. VERSION.txt said 1.2.0.5427alpha. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ... Can someone help me ? Sorry for my bad english ... :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot retrieve new records after saving them
I guess I'm being too vague here. My original code is fine for doing both inserts and updates. Let me illustrate the problem with more code: addFooToDb( 'Bob Jones', '04/05/2007 12:00:00' ); addFooToDb( 'Sam Smith', '04/05/2007 12:01:24' ); addFooToDb( 'Bob Jones', '04/05/2007 01:38:02' ); - CASE 1: There is already a record in the Foo table where name = Bob Jones, but nothing else. In this case, the final contents of Foo will be something like this: id nametext 1 'Bob Jones' '04/05/2007 01:38:02' 2 'Sam Smith' '04/05/2007 12:01:24' This is the behavior I'm expecting. Sadly, this isn't always the case... - CASE 2: Table Foo is empty during first run of the script. In this case, the contents of Foo should look exactly the same as above. Instead, I'm seeing this: id nametext 1 'Bob Jones' '04/05/2007 12:00:00' 2 'Sam Smith' '04/05/2007 12:01:24' 3 'Bob Jones' '04/05/2007 01:38:02' This is entire due to the fact that even after a successful save for the first record, getFooId( 'Bob Jones' ) will STILL RETURN '0', rather than '1' as it should. Again, getLastInsertId() isn't immediately helpful in this case because we insert a 'Sam Smith' record between the two 'Bob Jones' instances. Does that clarify the problem? -Packgrog On Sep 4, 3:12 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. Well, that's what the example you had was doing anyway. :) Here's a tweaked version. function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else { $this-Foo-create(); } $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } return $retVal; } That *should* create a new record if getFooId() returns zero, and update an existing record otherwise. -- 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 -~--~~~~--~~--~--~---
Re: Cannot retrieve new records after saving them
This is actually just a reiteration of the same code I already posted. Setting $newFoo['Foo']['id'] = 0; will have the same effect as create(); as it will simply create a new row. -Packgrog On Sep 4, 3:15 pm, francky06l [EMAIL PROTECTED] wrote: I think with all the posts you get the answer, should look like : if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else $this-Foo-create(); $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) $retVal = ($foold ? $this-Foo-field('id') : $this-Foo-getLastInsertID()); } } return $retVal; On Sep 4, 9:03 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. I should reiterate something with my example: The first time I run it with the sample data, if there are no entries in the database table, getFooId() will ALWAYS return 0, even if the entry has already been successfully saved. After the script has been run, if I run it again with the exact same data, it will always find the id for the first record that was created. Is that clearer at all? -Packgrog On Sep 4, 2:11 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- 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 -~--~~~~--~~--~--~---
Re: Strange URL's
Hi, thanks for the tips, I tried to do all this, here's my new .htaccess: mod_gzip_on No IfModule mod_rewrite.c RewriteEngine on RewriteBase /maryphoto/webroot # RewriteRule ^private/$ private/index.php [L] # RewriteRule ^$ maryphoto/webroot/accueil.php [L] RewriteRule (.*) $1 [L] /IfModule SetEnv PHP_VER 5 I have the same problem, the url's are different at all :( Perhaps would I try to set all the constants in index.php manually ? Can't you give me the dump of your get_defined_constants(true) ['user'] so I could have an example please ? Thank you a lot for all your help ! Fabian Pijcke On Sep 4, 9:21 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Oh, and I'm under Linux with Apache 1.3.37 and PHP 5.2.3. I don't know the distrib but uname -r returns 2.6.18.1-grsec-mutu-grs- ipv4-32. (MySQL 5.0) My CakePHP version is the last nightbuild. VERSION.txt said 1.2.0.5427alpha. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a href=?php echo $html-url('/pages/magasin/Mouscron'); ? Mouscron/abr / you could use echo $html-link('Mouscron', '/pages/magasin/'); What is the name of your controller ? Pages is a reserved name for static pages in cakePhp. On Sep 4, 6:18 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi there, I'm new to cakePHP and trying to create a simple application, but I have a problem with the html helper and also I think the Router class ... So I just created a controller with no model associated and 2 views named index.thtml and magasin.thtml. These pages are accessible via http://www.server.com/pages/index; and (http://www.server.com/pages/magasin/Mouscron; or http://www.server.com/pages/magasin/Leers-Nord;) ( the controller attributes different variables according to the parameter ). In index.thtml, I wrote: a href=?php echo $html-url('/pages/magasin/Mouscron'); ?Mouscron/abr / a href=?php echo $html-url('/pages/magasin/Leers-Nord'); ?Leers- Nord/a And the resultant HTML code is: a href=/home/maryphot/www/maryphoto/pages/magasin/ MouscronMouscron/abr / a href=/home/maryphot/www/maryphoto/pages/magasin/Leers-NordLeers- Nord/a The part /home/maryphot/www/maryphoto is overdue, and I don't know how to remove it, I checked /cake/libs/view/helpers/html.php and I found that the url() function was a member of the Router class, then I saw at it but don't know how to fix that problem ...
Select only a few fields
Hi, I have a model 'posts'. 'Post' has and belongs to many 'Comment'. 'Comments' belongs to 'Author'. 'Author' comes from my model 'users'. Everything is working fine. I can access the post, the comments and the author information. The only problem I have is the fact, that every single field from the 'users' model is accessible, including salt and hash of the login password. I only want selected fields, like nickname and id. Is this possible? I tried thinks like 'Comment.Author.id' or 'Post.Comment.Author.id' and several other things. Nothing worked. How to select only a few fields? This is an excerpt of the data I receive when I use $post-find(...). Maybe this helps. Array ( [Post] = Array ( [id] = 14 [title] = TEST title [content] = TEST content [status] = draft [created] = 2007-08-24 23:03:35 [modified] = 2007-08-24 23:09:31 ) [Comment] = Array ( [0] = Array ( [id] = 1 [user_id] = 1 [content] = The first test [created] = 2007-09-04 21:46:23 [modified] = 2007-09-04 21:46:23 [Author] = Array ( [id] = 1 [nickname] = Braindead [hash] = ***this is the hash*** [salt] = ***this is the salt*** [realname] = Markus [description] = Test description [created] = 2007-07-29 00:00:00 [modified] = 2007-08-18 12:15:48 ) ) ) ) Regards, Markus --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
THAT'S IT! cacheQueries = false was exactly the detail I was missing! Phew!!! :) Thanks very much everyone! Much appreciated! -Packgrog On Sep 4, 4:04 pm, francky06l [EMAIL PROTECTED] wrote: I think you misunderstand, having !$foold will avoid setting the id, so it will call create and make a new record. If record exists, the create is not called and your id is set... it will update. Unless I am completely wrong concerning your problem, I think this code will update as well as create new record if needed. Now that you mention a loop, using $this-Foo-cacheQueries = false might help. On Sep 4, 9:50 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is actually just a reiteration of the same code I already posted. Setting $newFoo['Foo']['id'] = 0; will have the same effect as create(); as it will simply create a new row. -Packgrog On Sep 4, 3:15 pm, francky06l [EMAIL PROTECTED] wrote: I think with all the posts you get the answer, should look like : if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else $this-Foo-create(); $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) $retVal = ($foold ? $this-Foo-field('id') : $this-Foo-getLastInsertID()); } } return $retVal; On Sep 4, 9:03 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. I should reiterate something with my example: The first time I run it with the sample data, if there are no entries in the database table, getFooId() will ALWAYS return 0, even if the entry has already been successfully saved. After the script has been run, if I run it again with the exact same data, it will always find the id for the first record that was created. Is that clearer at all? -Packgrog On Sep 4, 2:11 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- 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
Re: Select only a few fields
On 9/4/07, Braindead [EMAIL PROTECTED] wrote: Hi, I have a model 'posts'. 'Post' has and belongs to many 'Comment'. 'Comments' belongs to 'Author'. 'Author' comes from my model 'users'. Everything is working fine. I can access the post, the comments and the author information. You could do the following: $conditions = array('Author' = 'GrumpyCanuck'); $posts = $this-Post-find($conditions, array('Post.title', 'Post.status')); That should only pull back the Post.title and Post.status instead of all the fields in the Post table. Fields to return is the second parameter in a find() statement. -- 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 -~--~~~~--~~--~--~---
Re: Strange URL's
I have set another application (gumiz) on OVH, basically the webroot resides on the www directory : www/gumiz - index.php + js + img + css I have set the application and cake into the home directory : foo. Cake is in foo/cake, gumiz my application is in foo/gumiz. /home.8/l/o/a/loanlnk/foo + apps + gumiz + cake - app_controller.php + views + models //etc ... A look to the index.php (the differences from the distribution file) in webroot (ie : /gumiz): if (!defined('ROOT')) { //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR'); //You should also use the DS define to separate your directories define('ROOT', '/home.8/l/o/a/loanlnk/foo/apps'); } if (!defined('APP_DIR')) { //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION'); define('APP_DIR', 'gumiz'); } /** * This only needs to be changed if the cake installed libs are located * outside of the distributed directory structure. */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', 'FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR'); //You should also use the DS define to separate your directories define('CAKE_CORE_INCLUDE_PATH', '/home.8/l/o/a/loanlnk/foo'); // htacess of the www/gumiz (webroot) RewriteEngine On RewriteBase /gumiz RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] That's about it. I did not need to tweak the .htaccess of the www because I use this mainly for development. So I use to call my application by www.loanlnk.fr/gumiz. I suggest you could do the same and after, maybe tweak to the www/.htaccess according to your needs hope this helps On Sep 4, 9:57 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It would be very nice, thank you !! On Sep 4, 9:38 pm, francky06l [EMAIL PROTECTED] wrote: well I can give you my tree under OVH if you are interested. OVH is quite tricky with their special version of Apache. On Sep 4, 9:21 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Oh, and I'm under Linux with Apache 1.3.37 and PHP 5.2.3. I don't know the distrib but uname -r returns 2.6.18.1-grsec-mutu-grs- ipv4-32. (MySQL 5.0) My CakePHP version is the last nightbuild. VERSION.txt said 1.2.0.5427alpha. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help anyway ! On 4 sep, 20:23, francky06l [EMAIL PROTECTED] wrote: Pages is reserved, try with a new name and let know about the results. On Sep 4, 8:11 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, thanks for your answer :) Yes, mod_rewrite is installed on my server ... I'll use $html-link instead of my beginners technic ^^ My controller's named PagesController, I'll change for SpagesController ( Static pages ) Thank you again, have somebody idea's for my url's issue ? On 4 sep, 19:58, francky06l [EMAIL PROTECTED] wrote: Strange, have you got mod-rewrite set up ? By the way instead of : a
Re: Select only a few fields
If you want a permanent solution to restricting the fields returned, define a fields array in your model ( i.e. when defining hasMany/belongsTo associations ) Hint: Look under Section 4 Associations at http://manual.cakephp.org/chapter/models In conjunction, review your recursion setting when using findAll() etc if you don't want to go that deep in the first place On 9/4/07, Braindead [EMAIL PROTECTED] wrote: Hi, I have a model 'posts'. 'Post' has and belongs to many 'Comment'. 'Comments' belongs to 'Author'. 'Author' comes from my model 'users'. Everything is working fine. I can access the post, the comments and the author information. The only problem I have is the fact, that every single field from the 'users' model is accessible, including salt and hash of the login password. I only want selected fields, like nickname and id. Is this possible? --~--~-~--~~~---~--~~ 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 retrieve new records after saving them
I realized after, when reading again, that you were talking about a loop. So the cacheQueries if affecting the getFoold. On Sep 4, 10:22 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: THAT'S IT! cacheQueries = false was exactly the detail I was missing! Phew!!! :) Thanks very much everyone! Much appreciated! -Packgrog On Sep 4, 4:04 pm, francky06l [EMAIL PROTECTED] wrote: I think you misunderstand, having !$foold will avoid setting the id, so it will call create and make a new record. If record exists, the create is not called and your id is set... it will update. Unless I am completely wrong concerning your problem, I think this code will update as well as create new record if needed. Now that you mention a loop, using $this-Foo-cacheQueries = false might help. On Sep 4, 9:50 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is actually just a reiteration of the same code I already posted. Setting $newFoo['Foo']['id'] = 0; will have the same effect as create(); as it will simply create a new row. -Packgrog On Sep 4, 3:15 pm, francky06l [EMAIL PROTECTED] wrote: I think with all the posts you get the answer, should look like : if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; } else $this-Foo-create(); $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) $retVal = ($foold ? $this-Foo-field('id') : $this-Foo-getLastInsertID()); } } return $retVal; On Sep 4, 9:03 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Almost there. I want addFooToDb() to either create a record if it doesn't exist or update an existing record. What you provided here will only update a record that's been found. I should reiterate something with my example: The first time I run it with the sample data, if there are no entries in the database table, getFooId() will ALWAYS return 0, even if the entry has already been successfully saved. After the script has been run, if I run it again with the exact same data, it will always find the id for the first record that was created. Is that clearer at all? -Packgrog On Sep 4, 2:11 pm, Chris Hartjes [EMAIL PROTECTED] wrote: On 9/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Say I have an input file that takes in data that gets parsed into $name and $text which I then pass to addFooToDb(). My uniqueness key here is $name, and say we're assuming that the file is sorted by a timestamp, and we want to overwrite existing entries with the same name with any new ones that are encountered. Say our data looks something like this: - Bob Jones, 04/05/2007 12:00:00 Sam Smith, 04/05/2007 12:01:24 Bob Jones, 04/05/2007 01:38:02 - If there was no entry for Bob Jones when the loop starts, TWO entries will be created, because each successive call to getFooId will return '0' for the id, even though the entry has been created. The getLastInsertId() method won't help here since it won't be the proper reference once we add the Sam Smith record. Aha! I think I may understand what the problem is. You don't want to create new records, you want to simply update an existing one, right? If that's the case, then what you need to do is make sure that you are adding the primary key to your $data array and then executing a save. Let me show you an example using your own function with a few tweaks... function getFooId( $name ) { $foo = $this-Foo-find(Foo.name LIKE '%$name%'); if ($foo) { return $foo['Foo']['id']; } return 0; } function addFooToDb($name, $ext) { $retVal = 0; $fooId = $this-getFooId( $name ); if( $fooId 0 ) { $newFoo['Foo']['id'] = $fooId; $newFoo['Foo']['name'] = $name; $newFoo['Foo']['text'] = $text; if( $this-Foo-save( $newFoo ) ) { $retVal = $this-Foo-field('id'); } } return $retVal; } Try that out, that might fix the problem. My apologies if I have misunderstood the problem. -- Chris
Re: Select only a few fields
Chris, thanks for the quick reply, but the problem is not to select only a few fields from 'Post'. I want to select only a few fields from 'Comment Author' like nickname and id. I don't want fields like hash and sault. Please take a look at the data I receive from the query. I think this should help to understand my problem. Array ( [Post] = Array ( [id] = 14 [title] = TEST title [content] = TEST content [status] = draft [created] = 2007-08-24 23:03:35 [modified] = 2007-08-24 23:09:31 ) [Comment] = Array ( [0] = Array ( [id] = 1 [user_id] = 1 [content] = The first test [created] = 2007-09-04 21:46:23 [modified] = 2007-09-04 21:46:23 [Author] = Array ( [id] = 1 [nickname] = Braindead [hash] = ***this is the hash*** [salt] = ***this is the salt*** [realname] = Markus [description] = Test description [created] = 2007-07-29 00:00:00 [modified] = 2007-08-18 12:15:48 ) ) ) ) Thanks, Markus --~--~-~--~~~---~--~~ 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: Select only a few fields
On 9/4/07, Braindead [EMAIL PROTECTED] wrote: Chris, thanks for the quick reply, but the problem is not to select only a few fields from 'Post'. I want to select only a few fields from 'Comment Author' like nickname and id. I don't want fields like hash and sault. Then specifiy 'Comment.Author.nickname' in your array of fields in find(). Experiment and see what you get back. My example was only an example, not the exact solution to your problem. My appologies if you were expecting that. The key here is to use that second parameter of find(). -- 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 -~--~~~~--~~--~--~---
New Collaboration App developed on CakePHP
Hi all, We just released a collaboration app built on CakePHP called Web Groups. It's a web app for groups to collaborate - kind of like Basecamp meets Sharepoint meets Facebook. It's perfect for consultants, small businesses, departments in companies (that want some real collab tools and more autonomy), NPOs, organizations... any group with distributed members. ... and it's free. Check it out at http://www.mercurygrove.com and let us know what you think (would love some links if you like it). If you want to hear more about why we love it and why it kicks, send me an email at scott.annan[at]mercurygrove.com - Scott --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
ACL Node setParent Check
I am having an issue with ACL. I have tried doing an $aro-setParent on an ARO object and I've also tried using the acl.php script that comes with CakePHP and both of them fail when setting the parent on a certain ARO. I've narrowed down where the code returns FALSE in the setParent function, but I don't know exactly why this is. The code is in the setParent function of cake/libs/controller/components/dbacl/ models/aclnode.php and is this check: ($parentId != null $newParent['lft'] = $object['lft'] $newParent['rght'] = $object['rght']) on line 178 of the current stable release. My layout is: 1[ROOT]10 2[MEMBERS]9 3[ADMINISTRATORS]8 4[PERSON1]5 6[PERSON2]7 I'm trying to set Person1 to have the parent of Members instead of Administrators and it fails during the check above. Why is this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Select only a few fields
I've got it! This is now part of my 'Comments' model. var $belongsTo = array('Author' = array('className' = 'User', 'conditions' = '', 'order' = '', 'foreignKey' = 'user_id', 'fields' = array('id', 'nickname') ) ); After specifying the 'fields' parameter everything worked as expected. Only id and nickname are selected. Is this parameter new in Cake 1.2? Markus --~--~-~--~~~---~--~~ 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: Strange URL's
Youhouh ! I finally got it :) Some changes I made in the .htaccesses did the trick, now all seems to be ok, it's great :) Thank you again for your help !! Fabian Pijcke On Sep 4, 11:35 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I tried differents configurations but can't make it work :( I'll try again tomorrow, time to sleep for me ... And a great THANK YOU for all your suggestions / comments / help ! On Sep 4, 10:32 pm, francky06l [EMAIL PROTECTED] wrote: I have set another application (gumiz) on OVH, basically the webroot resides on the www directory : www/gumiz - index.php + js + img + css I have set the application and cake into the home directory : foo. Cake is in foo/cake, gumiz my application is in foo/gumiz. /home.8/l/o/a/loanlnk/foo + apps + gumiz + cake - app_controller.php + views + models //etc ... A look to the index.php (the differences from the distribution file) in webroot (ie : /gumiz): if (!defined('ROOT')) { //define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR'); //You should also use the DS define to separate your directories define('ROOT', '/home.8/l/o/a/loanlnk/foo/apps'); } if (!defined('APP_DIR')) { //define('APP_DIR', 'DIRECTORY NAME OF APPLICATION'); define('APP_DIR', 'gumiz'); } /** * This only needs to be changed if the cake installed libs are located * outside of the distributed directory structure. */ if (!defined('CAKE_CORE_INCLUDE_PATH')) { //define ('CAKE_CORE_INCLUDE_PATH', 'FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED. DO NOT ADD A TRAILING DIRECTORY SEPARATOR'); //You should also use the DS define to separate your directories define('CAKE_CORE_INCLUDE_PATH', '/home.8/l/o/a/loanlnk/foo'); // htacess of the www/gumiz (webroot) RewriteEngine On RewriteBase /gumiz RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] That's about it. I did not need to tweak the .htaccess of the www because I use this mainly for development. So I use to call my application bywww.loanlnk.fr/gumiz. I suggest you could do the same and after, maybe tweak to the www/.htaccess according to your needs hope this helps On Sep 4, 9:57 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It would be very nice, thank you !! On Sep 4, 9:38 pm, francky06l [EMAIL PROTECTED] wrote: well I can give you my tree under OVH if you are interested. OVH is quite tricky with their special version of Apache. On Sep 4, 9:21 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Oh, and I'm under Linux with Apache 1.3.37 and PHP 5.2.3. I don't know the distrib but uname -r returns 2.6.18.1-grsec-mutu-grs- ipv4-32. (MySQL 5.0) My CakePHP version is the last nightbuild. VERSION.txt said 1.2.0.5427alpha. On Sep 4, 9:03 pm, francky06l [EMAIL PROTECTED] wrote: Well if all links are wrong, it's problem of mod-rewrite and/or index.php. What platform do you use ? Can you paste your .htaccess and webroot/index.php in the bin or by mail ? On Sep 4, 8:45 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I have this problem for all my URL's, the images cannot be found ( url searched:http://www.server.com/home/maryphot/www/maryphoto/img/image.ext in place ofhttp://www.server.com/img/image.ext), my form's actions have the same problem. My CSS cannot be found anymore. I can solve some problems by updating my app/webroot/index.php but I don't know how to alter it to get all the thing running ... Looking at the html.php helper, I think that it's its $webroot member that is altered ... die($this-webroot); === /home/maryphot/www/maryphoto (The real absolute dir on my server is: /home.10/maryphot/www/ maryphoto, I don't know if it helps ... ?) Thank you again ! Pijcke Fabian On 4 sep, 20:35, francky06l [EMAIL PROTECTED] wrote: Do you have same problems for other links ? Check also your index.php in webroot .. All this seems a configuration problem to me. On Sep 4, 8:31 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi again, I changed it to PagesController to SpagesController and nothing changed: my links are as ugly as before :( I also tried to modify my .htaccesses but the result was really disturbing so I resetted them to the officials ones ... Thank for your help
Re: To ACL or not to ACL?
Hi Howard Howard Glynn wrote: My cake1.2 intranet app has a large pool of users (employees), all of whom interact with the models (objects) through varying lifecycles, and works well. snip I can't believe I'm the only one to face this, can anyone offer any insight on which direction they have chosen? I have become a fan of ACL over a number of projects. Once you understand it, it is well worth using. Yes it's more complex, but the benefit is flexibility (as you note). For me, there is no question. I just use it on everything. I would suggest that if you are likely to build a Cake app in the future that also requires access control, then the right way to go is to invest now in learning ACL, rather than end up with two (or more!) different system to maintain in the long term. ACL is complex to get your head around, but very, very powerful and useful once you do. I think that it is worth the effort personally. Regards, Langdon --~--~-~--~~~---~--~~ 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: please comment on my design decision
In general, I agree, but here is where my break-down occurs: 1) The fields/questions are not really every used to search or find records 2) The client eventually wants a web-based tool to add/delete questions at any time Rather than building a table with 200+ fields that are not always used AND a web app that lets them run 'alter table' commands, I chose my odd method. Also, I didn't like the 2 column approach to storing the field name and answer, this is the most common way I have seen people solve the problem. I view this extra information as a document rather than fields, almost like storing a Word document they have composed that shows extra information about the profile. Brian On Sep 3, 4:14 am, RichardAtHome [EMAIL PROTECTED] wrote: You're right, your design doesn't feel eligant ;-) It breaks the rules of database normalisation. Not that that is necessarily a bad thing, sometimes you have to break normal form for the sake of performance. Basically, what you are describing is: Profile - hasMany - Questions If the same questions are used in many profiles, you have a: Profile - hasAndBelongsToMany - Questions. If you are storing answers to those questions, the answers would be stored in the HABTM join table. On Sep 1, 5:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I am completing a project using cake where the application requires user profiles with several hundred, yes several hundred, questions/ fields. However, only about 20 of these are used in searching, sorting, etc., the rest are for display purposes only. So, I basically included those 20 main fields in my profiles table, and I added a text field called non_searcable. Then I just serialize all the other fields and store them there, unserialize them for display. I have seen a design where a 2 column table is employed, field_name and field_value, and all these fields are stored in that way. It just seems like a slow, painful method, and you end up with text type fields storing a string of 4 characters, storing numbers, etc. What do you think? For some reason my design doesn't feel 'elegant', but it works, although is did require a little trickery on the edit actions and view actions, bet Set::merge was awesome! Anyway, just curious. I put a lot of pressure on myself to come up with super engineered solutions, when often times I think small apps are over designed. TIA, 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: To ACL or not to ACL?
I'm sorry, I'm just one of those guys that no matter how much you pound it into my head, I can't really get this ACL thing. That's why I used obAuth. Just search the bakery for it. It does basic group and user logins, which is all I need for right now. I just overrode the app_controller, and stuck the lock() function in the beforeFilter() if isset($this-['param']['admin']) Again, my Cake advice always comes with the grain of salt that: When I did this I needed it right then. Refreshing my PHP skills and learning Cake were already daunting enough, without ACL to muddy the waters. -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On 9/4/07, Langdon Stevenson [EMAIL PROTECTED] wrote: Hi Howard Howard Glynn wrote: My cake1.2 intranet app has a large pool of users (employees), all of whom interact with the models (objects) through varying lifecycles, and works well. snip I can't believe I'm the only one to face this, can anyone offer any insight on which direction they have chosen? I have become a fan of ACL over a number of projects. Once you understand it, it is well worth using. Yes it's more complex, but the benefit is flexibility (as you note). For me, there is no question. I just use it on everything. I would suggest that if you are likely to build a Cake app in the future that also requires access control, then the right way to go is to invest now in learning ACL, rather than end up with two (or more!) different system to maintain in the long term. ACL is complex to get your head around, but very, very powerful and useful once you do. I think that it is worth the effort personally. Regards, Langdon --~--~-~--~~~---~--~~ 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_file returns false - while the file exists
I know I'm not helping with the issue at hand, but I got a suggestion: I do something similar. Since you seem to control your filename (not a user uploaded file) then you could just set a boolean field on your controller: image. Then your if will just deal with your controller. I was just thinking that it's got to be better to control the image's existence manually through the database than to check the disk for every single file. Just my 2 cents. -- Baz L Web Development 2.0: Web Design, CakePHP, Javascript http://www.WebDevelopment2.com/ On 9/4/07, francky06l [EMAIL PROTECTED] wrote: if(file_exists(IMAGES. 'upload' . DS . 'filename')) hope this helps On Sep 4, 8:31 pm, Ketan Patel [EMAIL PROTECTED] wrote: look in cake/config/paths.php, it has most of the general path constants that one would need. I think WEBROOT_DIR is what you need, however, look in that file for more info. Ketan Anna P wrote: OK so how to use it? When I try if(is_file(../img/upload/photo_file1_.$item['Item'] ['id']..jpg)): (the path, which img src just gives me the right image) it doesn't work as well. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
people plural and person singular
Hi, I'll try again on my problem. I have included the models and controllers run firefox and get this error Fatal error: Class 'People' not found in C:\VertrigoServ\www\kake\cake\libs\model\model_php5.php on line 445 = The plural and singular are confusing I create Person.php as model and Event.php as model I then create people_controller and events_controller. I have one person who can have many events. Does cakephp honor perso and people as RAILS? Thanks for any help Jim === ?php class Person extends AppModel { var $name = Person; var $hasMany = array('Event' = array('className' = 'Event', // 'conditions'= 'Comment.moderated = 1', // 'order' = 'Comment.created id', // 'limit' = '100', 'foreignKey'= 'person_id', // 'dependent' = true, // 'exclusive' = false, 'finderQuery' = '' ) ); } ? ?php class Event extends AppModel { var $name = 'Event'; // Here's the hasOne relationship we defined earlier... var $hasOne = array('People' = array('className'= 'People', 'conditions' = '', 'order'= '', 'dependent'= true //'foreignKey' = 'person_id' ) ); } ? == ?php class PeopleController extends AppController { var $name = People; var $scaffold; } ? = ?php class EventsController extends AppController { var $name = Events; var $scaffold; } ? --~--~-~--~~~---~--~~ 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: people plural and person singular
?php class Event extends AppModel { var $name = 'Event'; // Here's the hasOne relationship we defined earlier... var $hasOne = array('Person' = array('className'= 'Person', 'conditions' = '', 'order'= '', 'dependent'= true //'foreignKey' = 'person_id' ) ); } ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Need to be corrected on my idea of hasOne
Hi, hope someone can clear this simple thing up. I have a Post model (posts table) - Pri Key: int ID varchar[100] comment int User_id ( the user who posted it of course ) and a User model (users table) - Pri Keyint ID varchar username .. other fields, too... On my Posts view thtml page, I need for my findAll (run from posts controller of course) to get all of my Posts plus the User table record that belongs to that post. But if I have a $hasOne in the Post model, the query attempts to join the Post.ID field with User.user_id which doesn't work of course. But User table doesn't have any fields relating to posts at all. I simply have a user_id in the posts table so that I know who posted what. Do I need to just use the Execute api call from the Model class to manually run this query? It looks like cakePHP is needing for the Post.ID field specifically to link up to a foreign id in User. Steve --~--~-~--~~~---~--~~ 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: Need to be corrected on my idea of hasOne
You want Post belongsTo User, User hasMany Post. On Sep 5, 3:25 pm, beetlecube [EMAIL PROTECTED] wrote: Hi, hope someone can clear this simple thing up. I have a Post model (posts table) - Pri Key: int ID varchar[100] comment int User_id ( the user who posted it of course ) and a User model (users table) - Pri Keyint ID varchar username .. other fields, too... On my Posts view thtml page, I need for my findAll (run from posts controller of course) to get all of my Posts plus the User table record that belongs to that post. But if I have a $hasOne in the Post model, the query attempts to join the Post.ID field with User.user_id which doesn't work of course. But User table doesn't have any fields relating to posts at all. I simply have a user_id in the posts table so that I know who posted what. Do I need to just use the Execute api call from the Model class to manually run this query? It looks like cakePHP is needing for the Post.ID field specifically to link up to a foreign id in User. Steve --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---