Re: saveField
Mistério, coloquei o create e continua a mesma coisa... Em 12/12/07, Lucas Ferreira [EMAIL PROTECTED] escreveu: tenta por um create() antes... //Atualiza o número de visualizações da páginas $this-Pagina-create(); $this-Pagina-id = $id; $hits = intval($pagina['Pagina']['hits']) + 1; echo 'Atualizar hits para: ' . $hits; $this-Pagina-saveField('hits', $hits); On Dec 12, 2007 7:11 PM, Bill [EMAIL PROTECTED] wrote: Tive este problema quando tentava atualizar algum registro em meu cadastro. Resolvi colocando um campo hidden com o id do registro, e deu certo. Estou tentando atualizar o campo hits de pagina qdo esta é visualizada, o problema é que está incluindo alguns registros quando faço o saveField, não estou achando o erro. No debug não aparece nenhuma inclusão, somente o update (UPDATE `paginas` SET `hits` = 8,`modified` = '2007-12-12 19:07:02' WHERE `id` IN (5)) function view($id = null) { if (!$id) { $this-Session-setFlash('Você acessou uma página de maneira incorreta.'); $this-redirect('/'); } $pagina = $this-Pagina-read(null,$id); $this-set('pagina', $pagina); //Atualiza o número de visualizações da páginas $this-Pagina-id = $id; $hits = $pagina['Pagina']['hits'] + 1; echo 'Atualizar hits para: ' . $hits; $this-Pagina-saveField('hits',$hits); } -- Lucas Ferreira Burn web.studio: http://www.burnweb.com.br/ Pessoal: http://www.lucasferreira.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: Setting path to cake core windows xp
Comida411, I'm sorry you don't like my answers, you'll find on reflection (maybe) that they are very relavent to whatever problem it is you have that you are not explaining clearly (in each case). I don't really see any ambiguity here: https://trac.cakephp.org/browser/branches/1.1.x.x/app/webroot/index.php#L35 Did you notice the difference? Why are /your/ constants prefixed with __? Cake doesn't expect and wont use them defined like that which is probably why you are getting a lot of error messages at a guess (the only way to try and understand whatever problem you are truely looking at). Good luck. AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: loadModel function
This is interesting indeed... As far as I could establish, I was not requesting the file to be loaded twice. What is further interesting though is even if I did run loadModel twice with the same instruction, the class_exists function call within loadModel should have prevented this anyway. Any ideas on this then? Dr. Tarique Sani wrote: On 12/12/07, lordG [EMAIL PROTECTED] wrote: Then, with the 1.2 branch release, does anyone know why in the loadmodel function, they use require and not require_once? I've hit a snack with this one, and change the require to require_once int he code manually. Well, ideally require_once should never be needed if your program flow is correct ;) besides that require_once has a higher overhead than require. Still further you can always check if a given model is already available before calling loadmodel() Hope that helps Tarique -- = Cheesecake-Photoblog: http://cheesecake-photoblog.org PHP for E-Biz: http://sanisoft.com = --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple OR Likes
On Dec 13, 12:20 am, Mr-Yellow [EMAIL PROTECTED] wrote: Was this typed right? array( 'Foo.Cat' = 'LIKE a%', array( 'Foo.Cat' = 'LIKE b%' ), array( 'Foo.Cat' = 'LIKE c%' ) ); They have to be nested like that or did you mean. array( array( 'Foo.Cat' = 'LIKE a%' ), array( 'Foo.Cat' = 'LIKE b%' ), array( 'Foo.Cat' = 'LIKE c%' ), ) ? -Ben Either. A nested array simply adds brackets to the sql, so has no functional impact - but prevents you overwriting array keys in php (as you pointed out). You can nest them as much or as little as you want/need. I wouldn't agree that array constraints are not intuitive, the problem comes ofter (IMO) from considering sql as a sentance and trying to write a flat array to match. Some basics to bear in mind: 1) whatever the 'type' of array (AND, OR, NOT, OR NOT) is what is used to implode each array element 2) AND is the default array type 3) ORs need more than 1 array element otherwise, or what? 4) theres more than one way to prevent overwriting an array key, as theres more than 1 way to write any constraint. e.g. consider, find all unpublished posts by me, you or bob. only bobs post from last week. this makes no sense, even if you correct the overwritten keys: array( 'Post.owner' = 'me', 'OR' = 'Post.owner' = 'you', 'OR' = 'Post.owner' = 'bob', 'AND' = 'Post.created' = ' ' . lastweek, 'NOT' = 'Post.published' = true ) The problem is that the sql statement would need brackets to be defined unambiguously and sql brackets = an array. array( 'OR' = array( 'Post.owner' = 'me', array('Post.owner' = 'you'), array( 'Post.owner' = 'bob', 'Post.created' = ' ' . lastweek ) ), 'NOT' = 'Post.published' = true ) Is unambiguous as a php array, and the sql would be also. Anyway, hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple N to Distinct N Model
Santa, First I am using 1.2 so there might be some differences some where with the way generateList / scaffold work. However, I guess the key functionality and the end result should be the same. So why would I need a completely new model for each section? By defining the Letter model as you / I proposed, virtually (to cake) we have set up 3 models with different names (Opening, Middle and Ending), yet using the same class (LetterContent). This is confirmed by looking at the SQL statements created by generateList (when debug is on). See below. While reviewing the Scaffold, I can see that it is purely vanilla. If you reference a model, it will pull that model without conditions or variation. So I can see why the conditions get bypassed when using scaffolding, the scaffolding ignores them. :( But I still do not understand why the model can't handle that situation Like you, I had thought the conditions we set for the model should be taken into account. I had expected generateList follow findAll pattern of being 'controlled' by the condition set for the model. However, it is how it functions, so... just accept it for now and make it work by manually giving correct conditions for generateList. If it works for openings it should work for other sections... Try turning on debug and make sure the SQL statements for other sections are 'the same' as for openings (mine are, and they look as follows). SELECT `LetterContent`.`id` FROM `letter_contents` AS `LetterContent` WHERE `letter_section` = 'Opening' SELECT `LetterContent`.`id` FROM `letter_contents` AS `LetterContent` WHERE `letter_section` = 'Middle' SELECT `LetterContent`.`id` FROM `letter_contents` AS `LetterContent` WHERE `letter_section` = 'Ending' If you like I can forward to you the complete code I used for testing out this case. Good luck, Zonium On Dec 12, 9:59 pm, Santa [EMAIL PROTECTED] wrote: AD7six said: OR consider scaffolding what it is (a development tool), bake/write some code and add the conditions to the generateList call as you would need to do for any polymorphic model definition. if you use 3 models opperating on the same table, just edit the model's beforeFind to add a condition to only return rows with 'type' = middle (for example). I'm not sure how this would be any different than what I am trying to accomplish with the Letter and LetterContent model? I am setting up the filter using the 'condition' in the relationship $belongsTo. (see below) So why would I need a completely new model for each section? Shouldn't the condition do the filtering for me and only provide the data specified by the filter 'condition' back to the controller? or am I missing something? Unless I am misreading the code, the findAll function in the AppModel (model_php5.php) passes the condition to the beforeFind function by default so I shouldn't have to write 3 models defining the filter in a beforeFind option for each one. The condition should already cover that. While reviewing the Scaffold, I can see that it is purely vanilla. If you reference a model, it will pull that model without conditions or variation. So I can see why the conditions get bypassed when using scaffolding, the scaffolding ignores them. :( But I still do not understand why the model can't handle that situation even in a scaffold environment. The request from the controller should always filter through the model and return what the model is intending, not a vanilla flavor the scaffold selects. If I am off on this, someone please explain it to me. Even the lifecycle shows the scaffold is but a small method used to render basic controller functions / views to use with the model. (http://www.cakecollab.org/lifecycle.png) It still appears the model is responsible for the data that is returned to the controller. LETTER MODEL ?php class Letter extends AppModel { var $name = 'Letter'; var $belongsTo = array( 'Opening' = array('className' = 'LetterContent', 'conditions' = letter_contents.letter_section = 'Opening', 'order' = '', 'foreignKey' = 'opening_id' ), 'Middle' = array('className' = 'LetterContent', 'conditions' = letter_contents.letter_section = 'Middle', 'order' = '', 'foreignKey' = 'middle_id' ), 'Ending' = array('className' = 'LetterContent', 'conditions' = letter_contents.letter_section = 'Ending', 'order' = '', 'foreignKey' = 'ending_id' ), );} ?
Re: Session Sudden Expire during Ajax call
I think you are right! I have checked out the session folder and duplicated the error again. This is what I found: First Ajax Call(Dummy Data): Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535939; s:4:rand; i:3406; } userData|a:2:{ s:7:Account;a:6:{ s:10:account_id; s:1:2; s:8:username; s:5:admin; s:8:password; s:8:password; s:4:role; s:5:admin; s:10:pwd_expire; s:1:0; s:6:active; s:1:1; } s:10:Department;a:0:{}} Second Ajax Call: Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535940; s:4:rand; i:25783; } My entire user information is gone at the second request. The second request also generated another file (Or like you said, it was moving when the second ajax came in). So in order to solve this problem, I should set my security lower or implement some form of queue system right? On Dec 13, 3:55 pm, zonium [EMAIL PROTECTED] wrote: I am guessing there might be some other causes: - The user agent changed between calls (less likely in your case, though) - When first ajax call came, cake regenerated session_id (if security level set to high) The second ajax request might have taken place when session info had been moved to a new 'location' identified by the new session id (the second ajax call still attempted to use the old session id). To verify this, look into the /tmp folder (or the folder you use for session save path) to see how the session files get changed upon EACH request from browser. On Dec 12, 6:28 pm, ProFire [EMAIL PROTECTED] wrote: Ok! Maybe I should rephrase my questions. What are the causes for an Expired session? I know the standard ones are the Time Limit and the code (session_destroy()). Are there any other causes for it? Is there a code in CakePHP that causes session to expire?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Selection jump function / menu
You could set your text field as an hidden field at first. Then handling onChange in the select box, with a small javascript you would show the text box when the is other and hide it otherwise.on Something like : $js = 'if(this.value == other) $(\'inpbox\').show(); else $(\'inpbox \').hide();'; echo $form-input('knowsfrom', array('type' = 'select', 'options' = $options, 'onchange' = $js)); echo $form-input('otherfrom', array('type' = 'text', 'id' = 'inpbox')); I did write this code just straight here, so you might get some syntax errors, but that should give you a hint. hth On Dec 13, 7:32 am, rocky [EMAIL PROTECTED] wrote: Hey, I'm trying to use cakePHP to do a client's sign up form. I want to know how did our clients find us so we have a selection box for them to choose. Well, there's an option called other, When they select Other as option I want the web page throws an text field for them to fill out. If any of you could give me some hint on how to achieve this, I would really appreciate it? Blessings, Rocky --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
Hint: You can disable UA check for session. Configure::write('Session.checkAgent', false) or put this in config.php somehow... On Dec 13, 9:44 am, ProFire [EMAIL PROTECTED] wrote: I think you are right! I have checked out the session folder and duplicated the error again. This is what I found: First Ajax Call(Dummy Data): Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535939; s:4:rand; i:3406;} userData|a:2:{ s:7:Account;a:6:{ s:10:account_id; s:1:2; s:8:username; s:5:admin; s:8:password; s:8:password; s:4:role; s:5:admin; s:10:pwd_expire; s:1:0; s:6:active; s:1:1;} s:10:Department;a:0:{}} Second Ajax Call: Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535940; s:4:rand; i:25783; } My entire user information is gone at the second request. The second request also generated another file (Or like you said, it was moving when the second ajax came in). So in order to solve this problem, I should set my security lower or implement some form of queue system right? On Dec 13, 3:55 pm, zonium [EMAIL PROTECTED] wrote: I am guessing there might be some other causes: - The user agent changed between calls (less likely in your case, though) - When first ajax call came, cake regenerated session_id (if security level set to high) The second ajax request might have taken place when session info had been moved to a new 'location' identified by the new session id (the second ajax call still attempted to use the old session id). To verify this, look into the /tmp folder (or the folder you use for session save path) to see how the session files get changed upon EACH request from browser. On Dec 12, 6:28 pm, ProFire [EMAIL PROTECTED] wrote: Ok! Maybe I should rephrase my questions. What are the causes for an Expired session? I know the standard ones are the Time Limit and the code (session_destroy()). Are there any other causes for it? Is there a code in CakePHP that causes session to expire?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
Hi ProFire, Just popped in. You're spot on there with reducing the security level on your sessions. I have the exact same problem happening with me, even posted a ticket with the cake guys, as I thought it was a bug, yet it was just what was intended to happen when the security is set to high. G --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
What I've figured with ver. 1.2 pre-beta is that if the session is set to HIGH (I use db-session mode) then for each and every request I can observe in the SQL-dump that my session is deleted and a new one is created. I consider that a bug but since I do not have any restrictions on the session expiration period I set the level to MEDIUM and it works OK, now SQL-dump shows what I expect it to. That's what you should do, probably. Another thing that is obvious to check with ajax calls is that your cookie that identifies the session comes along with the request. Later. On Dec 13, 11:44 am, ProFire [EMAIL PROTECTED] wrote: I think you are right! I have checked out the session folder and duplicated the error again. This is what I found: First Ajax Call(Dummy Data): Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535939; s:4:rand; i:3406;} userData|a:2:{ s:7:Account;a:6:{ s:10:account_id; s:1:2; s:8:username; s:5:admin; s:8:password; s:8:password; s:4:role; s:5:admin; s:10:pwd_expire; s:1:0; s:6:active; s:1:1;} s:10:Department;a:0:{}} Second Ajax Call: Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535940; s:4:rand; i:25783; } My entire user information is gone at the second request. The second request also generated another file (Or like you said, it was moving when the second ajax came in). So in order to solve this problem, I should set my security lower or implement some form of queue system right? On Dec 13, 3:55 pm, zonium [EMAIL PROTECTED] wrote: I am guessing there might be some other causes: - The user agent changed between calls (less likely in your case, though) - When first ajax call came, cake regenerated session_id (if security level set to high) The second ajax request might have taken place when session info had been moved to a new 'location' identified by the new session id (the second ajax call still attempted to use the old session id). To verify this, look into the /tmp folder (or the folder you use for session save path) to see how the session files get changed upon EACH request from browser. On Dec 12, 6:28 pm, ProFire [EMAIL PROTECTED] wrote: Ok! Maybe I should rephrase my questions. What are the causes for an Expired session? I know the standard ones are the Time Limit and the code (session_destroy()). Are there any other causes for it? Is there a code in CakePHP that causes session to expire?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: findAllThreaded Returning Empty
On Dec 12, 3:08 am, AJ [EMAIL PROTECTED] wrote: I searched through the list and could not find anyone having this specific issue. I am using 1.2 (not exactly sure what version, but not pre-beta). I have a table of content pages, which includes a parent_id field. I am trying to pull a threaded array like this: $test = $this-findAllThreaded(array('Content.section_id'='1')); looking at the way findAllThreaded and __doThread are written https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/model.php#L1729 If your resultset does not contain the a node with no parent, it won't work. You can work around it be overriding the findAllThreaded method and passing the $root parent id to the doThread method OR using a findAll and passing the results through __doThread (with the id of the parent to use as a base as the 2nd param) OR writing a constriant that will not exclude the top level node. Youd be better off IMO getting familiar with and using the tree behavior though hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
Alright, the problem is solved! For those who encounter the similar problem and reading this to get the problem solved, here's what I did. My initial settings was that my cake session security is set to HIGH. What appears to me is that everytime the user browse around, a new Session ID is generated. The old Session ID is removed. During the first Ajax call, a new Session ID is generated. However, the second simultaneous Ajax call was carry the old ID. My system was assigned with the new ID but my second Ajax call was carry the old one. Therefore, PHP assumes that I have logged out of the system and generates an entire new Session ID for me. That's how I got logged out. (I'm not sure if this is how the entire Session Process is, but as far as I know, as of date, this is how it appears to me) Solution? Set the Cake Session Security to Medium. This is what I did. Afterwards, no new Session ID was generated everytime I fool around with Ajax. Did up to even 20 Ajax calls simultaneously and successfully. Just that my browser started to slow down a little. Yay! I'm not sure if the Queue System works but anybody wants to give it a try? Let me know! By theory, I believe it should work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: 2 Models 1 Layout
At a guess, I'd say that your /posts/index action isn't returning the data correctly. This is roughly what it should look like: excuse the dodgy formatting. class PostsController extends AppController { ... snipped ... function index() { $posts = $this-Post-findAll(); if(isset($this-params['requested']) { return $posts; } $this-set('posts', $posts); } } This means the posts index will work both if you go to it directly and if you use it in a requestAction. Hope that helps! Tufty On Dec 13, 5:58 am, Fabian [EMAIL PROTECTED] wrote: Hi All, I'm trying to gather data from 2 different models (2 different tables) and I want to place them on my layout. I read something about using a requestAction so I did the following: function index() { $this-set('archives', $this-Archive-findAll()); $this-set('posts', $this-requestAction('/posts/index')); } so on my layout I have ?php foreach ($archives as $archive): ? input type=textbox name=setting1 value=?php echo $archive['archive']['user']; ?/ ?php endforeach; ? ?php foreach ($posts as $post): ? input type=textbox name=setting2 value=?php echo $post['post'] ['created']; ? / ?php endforeach; ? the first one gets the archive user and that one works, but the second one , which I used the table posts created on the 15 min tutorial doesn't get the data. Can anyone tell me what I'm doing 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 -~--~~~~--~~--~--~---
Re: Has and belongs to many, with extra columns
Some info on how 'with' is used can be found here: http://www.cakephp.org/files/OCPHP.pdf Note: - using 'with' is optional, - scaffold controller methods and views built with bake wont take care of extra fields On Dec 12, 3:43 pm, Mr-Yellow [EMAIL PROTECTED] wrote: Went looking for the code I had sorted for this but can't find it right now. Cake 1.2 + the with model attribute. Involves creating a model for the join and telling it's children which table to use for the join. One problem is Cake doesn't allow you to use the combined FKs as PK. So you need an auto-number in your bridge table (e). So make sure you add another unique index to keep the bridge table data clean. -Ben On Dec 12, 10:31 am, MonkeyGirl [EMAIL PROTECTED] wrote: Hi. Thanks for your help before, everyone... This one's just a quick question. I'm pretty sure the answer's just make the new model and stop being lazy, but I'd like to make sure just in case. I've got a project with a has-and-belongs-to-many relationship, linking a products table to a features table, so that each product can have several features, and each feature can have several products. I've got a form where you tick all the features you want each product to have, and thanks to CakePHP I don't even have to write any complex code to work out which ticks are new and which have gone, it automatically works all of that out. Brilliant. Now the client wants some of these features to be key features, meaning I'll need to put in an extra boolean type column in the linking table to say if any of the ticked features are extra specially important to that particular product or not. My question is this: do I need to replace this simple HABTM relationship with two regular belongs-to/has-many relationships, and make a proper model for the linking table? Sorry to trouble you with a question that I'm pretty sure I already know the answer to, but I'd really be kicking myself if I found out HABTM relationships can handle extra information about the linking table. Thank you very much, Zoe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP and VBulletin
On Dec 13, 3:09 am, Lakshmi S [EMAIL PROTECTED] wrote: Hi All, We are trying to integrate vBulletin with a CakePHP application. [snip] As it happens, I have recently done this. I'll send an email off list for you to contact me. -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: Session Sudden Expire during Ajax call
Solution? Set the Cake Session Security to Medium. This is what I did. Yeap, that set to Medium would solve the problem. I'm not sure if this is how the entire Session Process is It's how it is designed to work. When security is set to high, session id changes each time cake is reached. This is to void session hijacking. However, your simultaneous ajax calls should not have been 'interpreted' by cake as some kind of hijacking. So IMO it'd better if cake allows to specify a passage of time (a window) within it cake will not regenerate session id. The way cake handle 'high' security seems ... too restrict. In fact, to avoid the unwanted side effects associated with 'high', 'medium' is usually used as a 'solution'. So the value of 'high' is kind of diminished / less practical and your case is a very good example. Zonium On Dec 13, 1:13 am, ProFire [EMAIL PROTECTED] wrote: Alright, the problem is solved! For those who encounter the similar problem and reading this to get the problem solved, here's what I did. My initial settings was that my cake session security is set to HIGH. What appears to me is that everytime the user browse around, a new Session ID is generated. The old Session ID is removed. During the first Ajax call, a new Session ID is generated. However, the second simultaneous Ajax call was carry the old ID. My system was assigned with the new ID but my second Ajax call was carry the old one. Therefore, PHP assumes that I have logged out of the system and generates an entire new Session ID for me. That's how I got logged out. (I'm not sure if this is how the entire Session Process is, but as far as I know, as of date, this is how it appears to me) Solution? Set the Cake Session Security to Medium. This is what I did. Afterwards, no new Session ID was generated everytime I fool around with Ajax. Did up to even 20 Ajax calls simultaneously and successfully. Just that my browser started to slow down a little. Yay! I'm not sure if the Queue System works but anybody wants to give it a try? Let me know! By theory, I believe it should work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Select Menu List
hello I am trying to do something like this, but there is no way http://blazonry.com/javascript/selmenu.php form name=form action=?php echo $html-url('/users/add'); ? method=post ?php echo $html-selectTag('User/LanguagesList', $languages, null, array('multiple' = 'multiple','size' = '6'), false); ? ?php echo $html-selectTag('Language/Language', array(), null, array('size' = '6','multiple' = 'multiple'),false); ? pinput type=button onClick=moveSelectedOptions(this.form.data[User][LanguagesList] [],this.form.data[Language][Language][]) value= /p script type=text/javascript src=/js/scripts.js/script content of scripts.js function moveSelectedOptions(from,to) { // Unselect matching options, if required if (arguments.length3) { var regex = arguments[3]; if (regex != ) { unSelectMatchingOptions(from,regex); } } // Move them over for (var i=0; ifrom.options.length; i++) { var o = from.options[i]; if (o.selected) { to.options[to.options.length] = new Option( o.text, o.value, false, false); } } // Delete them from original for (var i=(from.options.length-1); i=0; i--) { var o = from.options[i]; if (o.selected) { from.options[i] = null; } } if ((arguments.length3) || (arguments[2]==true)) { sortSelect(from); sortSelect(to); } from.selectedIndex = -1; to.selectedIndex = -1; } What am I doing wrong? THANKS --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
Solution? Set the Cake Session Security to Medium. This is what I did. Yeap, setting to Medium would solve the problem. I'm not sure if this is how the entire Session Process is It's how it is designed to work. When security is set to high, session id changes each time cake is reached. This is to void session hijacking. However, your simultaneous ajax calls should not have been 'interpreted' by cake as some kind of hijacking. So IMO it'd better if cake allows to specify a passage of time (a window) within it cake will not regenerate session id. The way cake handles 'high' security seems ... too restrict. In fact, to avoid unwanted side effects associated with 'high', 'medium' is usually used as a *solution*. So the value of 'high' some how diminishes / is less practical; and your case is a good example. Zonium On Dec 13, 1:13 am, Krovosos [EMAIL PROTECTED] wrote: What I've figured with ver. 1.2 pre-beta is that if the session is set to HIGH (I use db-session mode) then for each and every request I can observe in the SQL-dump that my session is deleted and a new one is created. I consider that a bug but since I do not have any restrictions on the session expiration period I set the level to MEDIUM and it works OK, now SQL-dump shows what I expect it to. That's what you should do, probably. Another thing that is obvious to check with ajax calls is that your cookie that identifies the session comes along with the request. Later. On Dec 13, 11:44 am, ProFire [EMAIL PROTECTED] wrote: I think you are right! I have checked out the session folder and duplicated the error again. This is what I found: First Ajax Call(Dummy Data): Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535939; s:4:rand; i:3406;} userData|a:2:{ s:7:Account;a:6:{ s:10:account_id; s:1:2; s:8:username; s:5:admin; s:8:password; s:8:password; s:4:role; s:5:admin; s:10:pwd_expire; s:1:0; s:6:active; s:1:1;} s:10:Department;a:0:{}} Second Ajax Call: Config|a:3:{ s:9:userAgent; s:32:7a98565405c4c8c1b17961f9f9edd2fd; s:4:time; i:1197535940; s:4:rand; i:25783; } My entire user information is gone at the second request. The second request also generated another file (Or like you said, it was moving when the second ajax came in). So in order to solve this problem, I should set my security lower or implement some form of queue system right? On Dec 13, 3:55 pm, zonium [EMAIL PROTECTED] wrote: I am guessing there might be some other causes: - The user agent changed between calls (less likely in your case, though) - When first ajax call came, cake regenerated session_id (if security level set to high) The second ajax request might have taken place when session info had been moved to a new 'location' identified by the new session id (the second ajax call still attempted to use the old session id). To verify this, look into the /tmp folder (or the folder you use for session save path) to see how the session files get changed upon EACH request from browser. On Dec 12, 6:28 pm, ProFire [EMAIL PROTECTED] wrote: Ok! Maybe I should rephrase my questions. What are the causes for an Expired session? I know the standard ones are the Time Limit and the code (session_destroy()). Are there any other causes for it? Is there a code in CakePHP that causes session to expire?- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
View this page Cake Apps/Sites In The Wild
Het geheugen van Nederland (The Memory of the Netherlands) is an extensive digital collection of illustrations, photographs, texts, film and audio fragments, all of Dutch making. It use Cake and Oracle database, the site is running on IIS. Click on http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild?hl=en - or copy paste it into your browser's address bar if that doesn't work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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 $session-flash() output [1.2.x]
Hi everyone, here's my problem. I've started doing a private CMS to learn Cake. Now, at first I was working with the pre-beta download of 1.2 branch, and everything was going fine until I wanted to write my first flash().. All I did was: $this-Session-setFlash('Article saved'); And in the view: echo $session-flash(); Now the fun part: my output was: Article saved1. Where the heck is that 1 coming from? I've tried everything, even searching for 1 through my code. Couple of days ago, I decided to get the latest revision from Cake repo thinking to myself that's gotta be a bug somewhere in Cake.. I've upgraded successfully but it's still the same, I still get 1 at the end of any flash message. For now I'm just using $Session-write(...) and $session-read(...), and that works perfectly normal. But if I try flashing, ..well, you get the picture. Anyone had anything like this? Any clues? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Sudden Expire during Ajax call
Solution? Set the Cake Session Security to Medium. This is what I did. Yeap, setting to Medium would solve the problem. I'm not sure if this is how the entire Session Process is It's how it is designed to work. When security is set to high, session id changes each time cake is reached. This is to void session hijacking. However, your simultaneous ajax calls should not have been 'interpreted' by cake as some kind of hijacking. So IMO it'd better if cake allows to specify a passage of time (a window) within it cake will not regenerate session id. The way cake handles 'high' security seems ... too strict. In fact, to avoid unwanted side effects associated with 'high', 'medium' is usually used as a *solution*. So the value of 'high' some how diminishes / is less practical; and your case is a good example. Zonium On Dec 13, 1:13 am, ProFire [EMAIL PROTECTED] wrote: Alright, the problem is solved! For those who encounter the similar problem and reading this to get the problem solved, here's what I did. My initial settings was that my cake session security is set to HIGH. What appears to me is that everytime the user browse around, a new Session ID is generated. The old Session ID is removed. During the first Ajax call, a new Session ID is generated. However, the second simultaneous Ajax call was carry the old ID. My system was assigned with the new ID but my second Ajax call was carry the old one. Therefore, PHP assumes that I have logged out of the system and generates an entire new Session ID for me. That's how I got logged out. (I'm not sure if this is how the entire Session Process is, but as far as I know, as of date, this is how it appears to me) Solution? Set the Cake Session Security to Medium. This is what I did. Afterwards, no new Session ID was generated everytime I fool around with Ajax. Did up to even 20 Ajax calls simultaneously and successfully. Just that my browser started to slow down a little. Yay! I'm not sure if the Queue System works but anybody wants to give it a try? Let me know! By theory, I believe it should work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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 $session-flash() output [1.2.x]
The Session Helper's flash method outputs the content, it doesn't return it. It returns true if it has something to output, false if it doesn't. Your trailing '1' is you echoing the return value of flash, which you shouldn't do - look in /libs/view/templates/layouts/default.ctp : ?php if ($session-check('Message.flash')): $session-flash(); endif; ? Anyway, just do `$session-flash()'`, not `echo $session-flash();` On Dec 13, 10:39 am, dr. Hannibal Lecter [EMAIL PROTECTED] wrote: Hi everyone, here's my problem. I've started doing a private CMS to learn Cake. Now, at first I was working with the pre-beta download of 1.2 branch, and everything was going fine until I wanted to write my first flash().. All I did was: $this-Session-setFlash('Article saved'); And in the view: echo $session-flash(); Now the fun part: my output was: Article saved1. Where the heck is that 1 coming from? I've tried everything, even searching for 1 through my code. Couple of days ago, I decided to get the latest revision from Cake repo thinking to myself that's gotta be a bug somewhere in Cake.. I've upgraded successfully but it's still the same, I still get 1 at the end of any flash message. For now I'm just using $Session-write(...) and $session-read(...), and that works perfectly normal. But if I try flashing, ..well, you get the picture. Anyone had anything like this? Any clues? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
(Cake)PHP programmer needed urgently!
Hi all, Hope you don't mind me posting a job ad here! I'm working in a small web team at work and we quite urgently need a PHP programmer. Here's what we're looking for: We are looking for a enthusiastic and experienced Web Developer for 3 months to help develop a large internal business system (in CakePHP). This will mostly consist of back end development so strong PHP and MySQL are a must, with CakePHP or RoR experience being advantageous. Good knowledge of semantic HTML, CSS and Javascript is also needed and if you know what things like Microformats, OpenID and OAuth are we'd love to hear from you! Send CVs and messages as soon as possible to [EMAIL PROTECTED] Cheers, 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: CakePHP and VBulletin
As it happens, I have recently done this. I'll send an email off list for you to contact me. -Simon Hey Simon - don't be shy - share Your solution here:) not that i'm interested but many people would find it usefull. You can also get feedback about your solution. As for the integreation i see two possibilities the one suggested by Wayne and using the vb login system. ie either integrate cb into cake or integrate cake into vb ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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 $session-flash() output [1.2.x]
Wow..I can't believe I missed that 0_o Thanks grigri! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Frustration with FileHandler snippet and saving returned value, any advice?
Hi there, I'm currently playing with the FileHandler snippet by Chris Partridge (http://cakeforge.org/snippet/detail.php?type=snippetid=52) and I've hit a problem! I can get the file to upload correctly and saved in the correct location, but I cannot for the life of me get the filename back into the the data array for storing in the database... My current code is below: Model: uses('file_handler'); class News extends AppModel { var $name = 'News'; function beforeSave() { $FileHandler = new FileHandler(); $this-params['data']['image'] = $FileHandler- save($_FILES['image']['tmp_name'], $_FILES['image']['name'], 'img/ news/', true); return true; } } Controller: function add() { if (empty($this-params['data'])) { $this-render(); } else { if ($this-News-save($this-params['data'])) { $this-flash('Your News has been saved.','/news'); } else { $this-set('data', $this-params['data']); $this-render('edit'); } } } It uploads the file aok and adds a db entry, just without any data in the image field. I'm sure it must be something I'm overlooking, but I'm stumped! Any help would be gratefully recieved, d. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP and VBulletin
I'm interested also as I am trying to do this with phpbb and may consider switching to vbulletin. Please share! Rich On Dec 13, 2007, at 6:33 AM, Marcin Domanski aka kabturek wrote: As it happens, I have recently done this. I'll send an email off list for you to contact me. -Simon Hey Simon - don't be shy - share Your solution here:) not that i'm interested but many people would find it usefull. You can also get feedback about your solution. As for the integreation i see two possibilities the one suggested by Wayne and using the vb login system. ie either integrate cb into cake or integrate cake into vb ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: (Cake)PHP programmer needed urgently!
PS Forgot to mention: we are based in London, and the person we are looking for needs to be able to come to our office and work for the vast majority of the duration of the contract. simon wrote: Hi all, Hope you don't mind me posting a job ad here! I'm working in a small web team at work and we quite urgently need a PHP programmer. Here's what we're looking for: We are looking for a enthusiastic and experienced Web Developer for 3 months to help develop a large internal business system (in CakePHP). This will mostly consist of back end development so strong PHP and MySQL are a must, with CakePHP or RoR experience being advantageous. Good knowledge of semantic HTML, CSS and Javascript is also needed and if you know what things like Microformats, OpenID and OAuth are we'd love to hear from you! Send CVs and messages as soon as possible to [EMAIL PROTECTED] Cheers, 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: findAllThreaded Returning Empty
On Dec 13, 1:46 pm, AJ [EMAIL PROTECTED] wrote: Youd be better off IMO getting familiar with and using the tree behavior though Actually, I am. Rather, that model is set up for it. I use generateTreeList other places for dropdowns, but didn't think I could have it generate an unordered list. So far I can't see how to use the tree behavior to just give me a hierarchal array like that. If that's possible, I'd certainly prefer it, but might need a couple pointers. Something to play with: http://bin.cakephp.org/view/375925194 $data would be flat findAll sorted by lft. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: findAllThreaded Returning Empty
Youd be better off IMO getting familiar with and using the tree behavior though Actually, I am. Rather, that model is set up for it. I use generateTreeList other places for dropdowns, but didn't think I could have it generate an unordered list. So far I can't see how to use the tree behavior to just give me a hierarchal array like that. If that's possible, I'd certainly prefer it, but might need a couple pointers. Thanks much, AJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake 1.2.x.x console problems
On Dec 13, 2007 2:09 AM, Adam D. [EMAIL PROTECTED] wrote: I can't run the bake command, or any of the commands from the console. I viewed the screencasts, but still, no luck. If I execute /usr/bin/php cake/console/libs/bake.php ...and I get the output from the console, with paths, etc. You don't run the console utilities that way. If you followed the screencasts and put the cake console script in your path, then you'd access bake by doing this: cake bake That's it. -- Chris Hartjes My motto for 2007: Just build it, damnit! @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake 1.2.x.x console problems
I think this is fairly upto date for Bake'n http://tempdocs.cakephp.org/#TOC108142 HTH Sam D On Dec 13, 2007 6:47 AM, Chris Hartjes [EMAIL PROTECTED] wrote: On Dec 13, 2007 2:09 AM, Adam D. [EMAIL PROTECTED] wrote: I can't run the bake command, or any of the commands from the console. I viewed the screencasts, but still, no luck. If I execute /usr/bin/php cake/console/libs/bake.php ...and I get the output from the console, with paths, etc. You don't run the console utilities that way. If you followed the screencasts and put the cake console script in your path, then you'd access bake by doing this: cake bake That's it. -- Chris Hartjes My motto for 2007: Just build it, damnit! @TheKeyboard - http://www.littlehart.net/atthekeyboard -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problem with html helper
Fatal error: Call to undefined function ife() in /*/public_html/cake/ libs/view/helpers/html.php on line 1020 I get this error. I am using PHP ver 5. Any suggestions as to what can be wrong? Thanks Wade --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: findAllThreaded Returning Empty
Something to play with:http://bin.cakephp.org/view/375925194 $data would be flat findAll sorted by lft. Thanks a ton, but I'm having some issues. Here is what's in my controller: var $helpers = array('Tree' ); $this-set('navContent', $this-Content- findAll(null,null,'Content.lft ASC')); ...and in my layout: echo $tree-generate($navContent); And I'm getting these errors: Undefined variable: node [CORE/app/views/helpers/tree.php, line 65] Undefined variable: itemReturn [CORE/app/views/helpers/tree.php, line 65] AJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: Has and belongs to many, with extra columns
Thank you very much, both of you. This is exactly what I was looking for! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP and VBulletin
DUnno if you are interested but I integrated SMF forum (http:// www.simplemachines.org/) as explained here: http://4webby.com/blog/posts/view/2/smake_smf_cakephp_integration Maybe you can use the same method to integrate vBullettin. Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: i18n: static language references with __(My lang key, true) in models and controllers
Cheers for the help francky06l ! Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Access cake data from external php script
Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How do I retrieve this model's alias?
Bah - can't upgrade as this is part of a product :( Thanks for that though. --rob On Dec 12, 10:03 am, grigri [EMAIL PROTECTED] wrote: You should upgrade more often :) This was sorted in revision 5904 :https://trac.cakephp.org/changeset/5904#file13 From then onwards, Model::alias is a string which contains its alias (surprise!) On Dec 11, 12:15 pm, [rob desbois] [EMAIL PROTECTED] wrote: Hi, I have some code looking likehttp://bin.cakephp.org/view/11696180 Basically, my Configuration model aliases an associated Mtie model to ExceptionMask. In implementing Mtie::afterFind($results) I discovered that $results uses the alias ExceptionMask instead of the model name Mtie, as would be expected. How do I find out, in Mtie, what its current alias is? I've tried $this-alias but it is the same as $this-modelToTable and only contains the model-table mappings for the Mtie model's associations. My alternative is to iterate through $results, then iterate through each contained array, and look for the required fieldname, but whilst this works it seems my job's being made pointlessly difficult :( TIA, --rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with html helper
Which version of Cake would this be? In 1.2.x branch, function aliases like ife() seem to be deprecated: http://groups.google.com/group/cake-php/browse_thread/thread/14f2b68e6dd039a/61b340f0070c66cc?lnk=gst Hope that helps, dr. H. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access cake data from external php script
if you want only to retrieve data you could use your cake application as web service returning xml for example. Now if you want to return a view or part of a view, I guess you should make an $ajax request from your external application..(take care if you have links in the returned views).. hth On Dec 13, 5:29 pm, Paolo [EMAIL PROTECTED] wrote: Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access cake data from external php script
No I just want to return data, I think the xml solution could be great! How can I tell cake not to render the page? Is there a method to create xml or should I create it by myself? Thanks On 13 Dic, 18:14, francky06l [EMAIL PROTECTED] wrote: if you want only to retrieve data you could use your cake application as web service returning xml for example. Now if you want to return a view or part of a view, I guess you should make an $ajax request from your external application..(take care if you have links in the returned views).. hth On Dec 13, 5:29 pm, Paolo [EMAIL PROTECTED] wrote: Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 2 Models 1 Layout
oh yeah I just left my post controller as it was doh! Thanks a lot!! On Dec 13, 3:23 am, MrTufty [EMAIL PROTECTED] wrote: At a guess, I'd say that your /posts/index action isn't returning thedatacorrectly. This is roughly what it should look like: excuse the dodgy formatting. class PostsController extends AppController { ... snipped ... function index() { $posts = $this-Post-findAll(); if(isset($this-params['requested']) { return $posts; } $this-set('posts', $posts); } } This means the posts index will work both if you go to it directly and if you use it in a requestAction. Hope that helps! Tufty On Dec 13, 5:58 am, Fabian [EMAIL PROTECTED] wrote: Hi All, I'm trying to gatherdatafrom2differentmodels(2different tables) and I want to place them on my layout. Ireadsomething about using a requestAction so I did the following: function index() { $this-set('archives', $this-Archive-findAll()); $this-set('posts', $this-requestAction('/posts/index')); } so on my layout I have ?php foreach ($archives as $archive): ? input type=textbox name=setting1 value=?php echo $archive['archive']['user']; ?/ ?php endforeach; ? ?php foreach ($posts as $post): ? input type=textbox name=setting2 value=?php echo $post['post'] ['created']; ? / ?php endforeach; ? the first one gets the archive user and that one works, but the second one , which I used the table posts created on the 15 min tutorial doesn't get thedata. Can anyone tell me what I'm doing 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 -~--~~~~--~~--~--~---
Re: Access cake data from external php script
What I have done when faced with a similar situation (existing php site / scripts needs stuff from my cake app) is to generate the required page fragments in cake and pull them in using file_get_contents($url_to_piece_of_cake) works fine. You'll probably want to create and use a layout just for those pieces, mine is just this : ?php echo $content_for_layout; ? then make sure you render that layout in the controller : $this-render(viewName,layoutName); then just put whatever you need into the view. Paolo wrote: Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: findAllThreaded Returning Empty
The code does not know the name of the model (array key) to loop on, look at the example usage in the comments (you need to pass something in the 2nd parameter) PS. there /is/ a typo $itemReturn should just be $return. Both changed, but still getting the $node error. Where is that variable coming from? I don't see it actually being set by the helper. PS: I really appreciate you sticking with me on 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: findAllThreaded Returning Empty
Ah, $node should also be $return. It works now! The ul and li structure doesn't seem to be building quite right, but that's the least of my worries now. I'm sure I can figure that out. Thanks again! AJ http://atlantajones.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: Upload behavior does not work
What version of cake are you using? Behaviors are for 1.2, and creating forms using HtmlHelper is deprecated in 1.2. Hint, try pr($_FILES); in your controller. On Dec 11, 2007 5:19 PM, Anna [EMAIL PROTECTED] wrote: Hi guys I'm a new baker, I guess I'm better at cooking. I tried to use the upload behavior 1.3 ( http://bin.cakephp.org/saved/21813# ) but it didn't upload anything. There are no debugging messages or errors either, so I dont know what else to do. I tried using other versions of this behaviour and the results are the same. Everything I upload fills the Image table with filename: Null, mime type: Null, filesize: Null. Only datetime created and datetime modified are populated correctly. Also, no file appears on the directory, This is my MODEL: class Image extends AppModel { var $name = 'Image'; var $actsAs = array('upload' = array('image' = array('dir' = 'photos', 'overwrite_existing' = true, 'create_directory' = true, ))); } This is my CONTROLLER: function upload() { if (!empty($this-data)) { if ($this-Image-save($this-data)) { $this-flash('image added','/images'); } } And this is a VIEW I called upload.ctp ?php echo $html-formTag('/images/upload/','post', array('enctype'='multipart/form-data') ); ? p add photo ?php echo $html-file('Upload/filename', array('size'='80') )? ?php echo $html-tagErrorMsg('Upload/filename', 'You must specify a path on your disk') ? /p p ?php echo $html-submit('Upload') ? /p What could I be doing wrong? XOXO Anna --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How does one use $this-render in plugins in the latest SVN build?
I'm getting Missing View and it's looking for the view file in the main app. This wasn't so about a week ago. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.2 Session variable disappears
My login function sets a session variable which contains user data. It then redirects to an index page. Using Firecake, i see that the session data is there: 5fbout['Sessions'] = {Config: {userAgent:25fed2e5facba72bdb68484b4b19538b,time: 1197579960,rand:2113374583},User:{id: 33,username:test,password:098f6bcd4621d373cade4e832627b4f6,email:,admin:,created:2007-12-08 13:12:25}}; But, as soon as i try to access another page, i get kicked back to the login screen, and the session data is not there. The really odd thing is that this is working fine on my WAMP development setup, but not on my production machine. Obviously, the function checking the user's credentials and setting the session variable is correct. Somehow this is being lost. I wanted to migrate to the Auth component, but i was having troubles with that. So, i upgraded to 1.2 first and then was going to tackle the Auth stuff. Now i am thinking that the issue i was having with Auth is the same as this issue. Any thoughts? I am at a loss as to what is happening here... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
ACL commandline prompts fail on 1.2
I am trying to configure my CakePHP 1.2 for ACL. When I run the commandline prompt php acl.php initdb from the cake/scripts directory I get an error stating that acl.php failed at line 90 because cake/ basics.php was not found. But it's there. Is my webroot configuration 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 -~--~~~~--~~--~--~---
Re: CakePHP 1.2. pre-beta with CakeAMFPHP
I have not been working too much on the CakeAMFPHP mainly because I wanted something simple and easy to move around. Plus, with the new AMFEXT, it made sense to write something new. So, we put together the AMF plugin. AMFPHP is not required and working with AMF is a little more Cake. You can find out more about working with Cake/Flex/Flash https://trac.cakefoundation.org/amf/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP 1.2. pre-beta with CakeAMFPHP
On Dec 13, 2007, at 1:37 PM, Gwoo wrote: I have not been working too much on the CakeAMFPHP mainly because I wanted something simple and easy to move around. Plus, with the new AMFEXT, it made sense to write something new. So, we put together the AMF plugin. AMFPHP is not required and working with AMF is a little more Cake. You can find out more about working with Cake/Flex/Flash https://trac.cakefoundation.org/amf/ I highly recommend this solution. It's been lightning fast, and killer easy to use. It makes AMF services easy to create. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
DESCRIBE happening too often
Hello bakers, in one of applications I'm working on, I have noticed DESCRIBE queries being executed on every page for all used models. With a load of page views, this only creates problems. As far as I know, such queries should be cached if application is in production (DEBUG = 0), but I still get them quite often. I have cheched /app/tmp/ directory permissions, and they are set to 777. I am using CakePHP 1.1 I don't know if CakePHP's cache expires after a number of pageviews since last update or after a set period of time, but is there a way to extend its lifetime? Thanks -- Sincerely yours, Olexandr Melnyk http://omelnyk.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access cake data from external php script
Paolo, If you use cake 1.2, you can set Router::parseExtension('xml') in core.php. If you call your action from external application, using http:// myhost. com/app/controller/action.xml, cake will look for a ctp in this form view/xml/action.ctp (note the subfolder xml). In this view you can just return xml. You also have an xml helper in the core that can help you to format your xml. hth On Dec 13, 5:47 pm, Martin Wood-Mitrovski [EMAIL PROTECTED] wrote: What I have done when faced with a similar situation (existing php site / scripts needs stuff from my cake app) is to generate the required page fragments in cake and pull them in using file_get_contents($url_to_piece_of_cake) works fine. You'll probably want to create and use a layout just for those pieces, mine is just this : ?php echo $content_for_layout; ? then make sure you render that layout in the controller : $this-render(viewName,layoutName); then just put whatever you need into the view. Paolo wrote: Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How does one use $this-render in plugins in the latest SVN build?
Seems the render() does not look into the pluginPath. I think the refactoring of the cake_core_path etc.. with persistent caching is on the way and not completed yet. A solution is to have the view name being the same as your action, but probably you needed a different name (for different rendering)... On Dec 13, 8:48 pm, Aaron Shafovaloff [EMAIL PROTECTED] wrote: I'm getting Missing View and it's looking for the view file in the main app. This wasn't so about a week ago. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.2 Session variable disappears
If it's works under development and not on production, this seems a configuration problem to me .. Did you check if the directory where sessions are stored is present en writable on production server (if you store in file of course)? Are the settings for cake (and version, Security level etc ..) identical ? On Dec 13, 9:13 pm, dw [EMAIL PROTECTED] wrote: My login function sets a session variable which contains user data. It then redirects to an index page. Using Firecake, i see that the session data is there: 5fbout['Sessions'] = {Config: {userAgent:25fed2e5facba72bdb68484b4b19538b,time: 1197579960,rand:2113374583},User:{id: 33,username:test,password:098f6bcd4621d373cade4e832627b4f6,email:,admin:,created:2007-12-08 13:12:25}}; But, as soon as i try to access another page, i get kicked back to the login screen, and the session data is not there. The really odd thing is that this is working fine on my WAMP development setup, but not on my production machine. Obviously, the function checking the user's credentials and setting the session variable is correct. Somehow this is being lost. I wanted to migrate to the Auth component, but i was having troubles with that. So, i upgraded to 1.2 first and then was going to tackle the Auth stuff. Now i am thinking that the issue i was having with Auth is the same as this issue. Any thoughts? I am at a loss as to what is happening here... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: findAllThreaded Returning Empty
On Dec 13, 3:34 pm, AJ [EMAIL PROTECTED] wrote: Something to play with:http://bin.cakephp.org/view/375925194 $data would be flat findAll sorted by lft. Thanks a ton, but I'm having some issues. Here is what's in my controller: var $helpers = array('Tree' ); $this-set('navContent', $this-Content- findAll(null,null,'Content.lft ASC')); ...and in my layout: echo $tree-generate($navContent); And I'm getting these errors: Undefined variable: node [CORE/app/views/helpers/tree.php, line 65] Undefined variable: itemReturn [CORE/app/views/helpers/tree.php, line 65] The code does not know the name of the model (array key) to loop on, look at the example usage in the comments (you need to pass something in the 2nd parameter) hth, AD PS. there /is/ a typo $itemReturn should just be $return. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: findAllThreaded Returning Empty
On Dec 13, 8:24 pm, AJ [EMAIL PROTECTED] wrote: Ah, $node should also be $return. It works now! The ul and li structure doesn't seem to be building quite right, but that's the least of my worries now. I'm sure I can figure that out. Thanks again! AJhttp://atlantajones.com $node should be $result I changed the variable names between a xhtml- valid-but-fat-and-complex-code to the slimmed-but-not-yet-perfect version in the paste. If you find an enhancement, please edit the paste. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.2 Session variable disappears
One thing you can check: The location where session is saved. If 2 pages are from 2 different applications and if they share session the paths (locations) need to be identical Good luck, Zonium On Dec 13, 1:35 pm, francky06l [EMAIL PROTECTED] wrote: If it's works under development and not on production, this seems a configuration problem to me .. Did you check if the directory where sessions are stored is present en writable on production server (if you store in file of course)? Are the settings for cake (and version, Security level etc ..) identical ? On Dec 13, 9:13 pm, dw [EMAIL PROTECTED] wrote: My login function sets a session variable which contains user data. It then redirects to an index page. Using Firecake, i see that the session data is there: 5fbout['Sessions'] = {Config: {userAgent:25fed2e5facba72bdb68484b4b19538b,time: 1197579960,rand:2113374583},User:{id: 33,username:test,password:098f6bcd4621d373cade4e832627b4f6,email:,admin:,created:2007-12-08 13:12:25}}; But, as soon as i try to access another page, i get kicked back to the login screen, and the session data is not there. The really odd thing is that this is working fine on my WAMP development setup, but not on my production machine. Obviously, the function checking the user's credentials and setting the session variable is correct. Somehow this is being lost. I wanted to migrate to the Auth component, but i was having troubles with that. So, i upgraded to 1.2 first and then was going to tackle the Auth stuff. Now i am thinking that the issue i was having with Auth is the same as this issue. Any thoughts? I am at a loss as to what is happening here... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Incomplete query result
I am running CakePHP 1.1.18.x on Windows 2003 Server, IIS, and MS SQL 2000. I'm querying a table with a column defined as varchar(2000) and the query result only returns 256 chars for that column. I tried the page on a Linux, Apache, and MS SQL environment and I get the proper result. Anyone know what could be causing this issue on the Win2K3 environment? Thanks in advanced for any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
A question about MVC
Shall I put more database operations in model or in controller. For example, suppose I need to get all students (name and ID) who registers in course 101 but did not pay mandatory lab fee. It requires at least three tables, students, course_registration, and lab_fee_payment. I can do this in controller and I can also put this in a model. In other words, you can put most db operation codes in controller (you will have a big controller but a small model, usually just a few lines); or you can put all those db operations in model, and call thoese operations from controller. in this case, the model tends to be bigger, and controller tends to be just a bunch of if/else, for/while statements (the main responsibility for the controller is to direct traffic to model and let model do the job ) Which one do you think is the prefereed way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: A question about MVC
You _can_ do whatever you like. It really doesn't matter. However, generally speaking models, views and controllers should be equally sized with appropriate content. What I usually use to judge (btw, no one says I'm right) is this: - I start with the view. Generally they shouldn't have much logic in them. Just a for each loop to spit out data. - I use controllers as a port to the views. So if data isn't being processed to be displayed, it doesn't belong in the controller. - Models are validation generally. If I have a lot of repeatable data processes that dump data...I usually stick them in here too. On Dec 13, 2007 6:00 PM, Steveston [EMAIL PROTECTED] wrote: Shall I put more database operations in model or in controller. For example, suppose I need to get all students (name and ID) who registers in course 101 but did not pay mandatory lab fee. It requires at least three tables, students, course_registration, and lab_fee_payment. I can do this in controller and I can also put this in a model. In other words, you can put most db operation codes in controller (you will have a big controller but a small model, usually just a few lines); or you can put all those db operations in model, and call thoese operations from controller. in this case, the model tends to be bigger, and controller tends to be just a bunch of if/else, for/while statements (the main responsibility for the controller is to direct traffic to model and let model do the job ) Which one do you think is the prefereed way? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Frustration with FileHandler snippet and saving returned value, any advice?
Maybe your are using cake 1.2 ? Try this one instead: http://bin.cakephp.org/saved/22195 --- kiang On 12月13日, 下午8時07分, designvoid [EMAIL PROTECTED] wrote: Hi there, I'm currently playing with the FileHandler snippet by Chris Partridge (http://cakeforge.org/snippet/detail.php?type=snippetid=52) and I've hit a problem! I can get the file to upload correctly and saved in the correct location, but I cannot for the life of me get the filename back into the the data array for storing in the database... My current code is below: Model: uses('file_handler'); class News extends AppModel { var $name = 'News'; function beforeSave() { $FileHandler = new FileHandler(); $this-params['data']['image'] = $FileHandler-save($_FILES['image']['tmp_name'], $_FILES['image']['name'], 'img/ news/', true); return true; } } Controller: function add() { if (empty($this-params['data'])) { $this-render(); } else { if ($this-News-save($this-params['data'])) { $this-flash('Your News has been saved.','/news'); } else { $this-set('data', $this-params['data']); $this-render('edit'); } } } It uploads the file aok and adds a db entry, just without any data in the image field. I'm sure it must be something I'm overlooking, but I'm stumped! Any help would be gratefully recieved, d. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: Incomplete query result
Nevermind I just found the solution from the PHP manual page... http://us2.php.net/manual/en/function.mssql-query.php#69695 It wasn't a cake issue but rather a PHP + Windows issue. On Dec 13, 3:02 pm, wetmonkey [EMAIL PROTECTED] wrote: I am running CakePHP 1.1.18.x on Windows 2003 Server, IIS, and MS SQL 2000. I'm querying a table with a column defined as varchar(2000) and the query result only returns 256 chars for that column. I tried the page on a Linux, Apache, and MS SQL environment and I get the proper result. Anyone know what could be causing this issue on the Win2K3 environment? Thanks in advanced for any help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Recursively return SOME attached model data
Hi, Let's say I have two models Property and Picture. One Property can have many Pictures. So I make two models like this: class Property extends AppModel { var $name = Property; var $hasMany = array('Picture' = array('className' = 'Picture', 'foreignKey' = 'property_id') ); } class Picture extends AppModel { var $name = Picture; var $belongsTo = array('Property' = array('className' = 'Property', 'conditions' = '', 'order' = '', 'foreignKey' = 'property_id' ) ); } Now I want to use $this-Property-findAll with some conditions and return ALL the Property model, but NOT ALL the picture Model. That is because the Picture model have large image data that I don't need. I just need the picture ID returned. What is the best way to accomplish this? Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Access cake data from external php script
Paolo, This has been discussed here: http://groups.google.com/group/cake-php/browse_thread/thread/8e5f487a944abeaf/e284ffdecdab0c69?lnk=gstq=+cakephp+structure#e284ffdecdab0c69 A note : - if you use $Dispatcher-dispatch($action) you need to use output buffering On Dec 13, 8:29 am, Paolo [EMAIL PROTECTED] wrote: Hi all! I created a website for a real estate agency using cake. I used cake to create the management part of the website, now I'm creating the remaining part, that one that will be available to the user. I wouldn't like to use cake for this, but would it be possible to query some page or something in order to get the answer from cake pages? For example, if I want to get all the items in a table, how can I do it? Or if I would like to search for something? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Recursively return SOME attached model data
in your Property model $hasMany add: var $hasMany = array('Picture' = array('className' = 'Picture', 'foreignKey' = 'property_id'), 'fields' = array('id', 'name'), ); replacing 'id', and 'name' with whatever you would like returned. As a note - its generally a bad idea to store photos in a database. Just store their filename and location. Hope that helps. On Dec 13, 5:04 pm, Miguel XT [EMAIL PROTECTED] wrote: Hi, Let's say I have two models Property and Picture. One Property can have many Pictures. So I make two models like this: class Property extends AppModel { var $name = Property; var $hasMany = array('Picture' = array('className' = 'Picture', 'foreignKey' = 'property_id') ); } class Picture extends AppModel { var $name = Picture; var $belongsTo = array('Property' = array('className' = 'Property', 'conditions' = '', 'order' = '', 'foreignKey' = 'property_id' ) ); } Now I want to use $this-Property-findAll with some conditions and return ALL the Property model, but NOT ALL the picture Model. That is because the Picture model have large image data that I don't need. I just need the picture ID returned. What is the best way to accomplish this? Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: A question about MVC
It should be in the model - as should all data retrieval functions. Put as much stuff in the model as you can - the controller should just parse the request to see what model functions should be called, then set() this for the view. While some processing in the controller is inevitable, models are much easier to unit test than controllers and so should contain the majority of your application code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Helper Error, point me in the right direction...
I'm trying to implement the excel output helper from this article: http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-from-your-database But, I'm getting the following errors: Notice (8): Undefined property: ExcelHelper::$helpers [CORE/cake/libs/ view/view.php, line 868] Notice (8): Undefined property: ExcelHelper::$helpers [CORE/cake/libs/ view/view.php, line 744] Where should I look to track this down (I doubt it has anything to do with view.php directly)? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Helper Error, point me in the right direction...
Look closely..., these are not errors, just notices. Some variables have not been properly set for views. Check your the controller logic. Zonium On Dec 13, 5:52 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm trying to implement the excel output helper from this article:http://bakery.cakephp.org/articles/view/generate-excel-spreadsheets-f... But, I'm getting the following errors: Notice (8): Undefined property: ExcelHelper::$helpers [CORE/cake/libs/ view/view.php, line 868] Notice (8): Undefined property: ExcelHelper::$helpers [CORE/cake/libs/ view/view.php, line 744] Where should I look to track this down (I doubt it has anything to do with view.php directly)? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Selection jump function / menu
Hey, Thank you very much for all of you! Blessings, Rocky On Dec 13, 5:24 pm, MrTufty [EMAIL PROTECTED] wrote: That's exactly how I'd do it too. With the exception that I'd put the code in via a touch of jQuery in the view instead, but that's a matter of style. Tufty On Dec 13, 9:02 am, francky06l [EMAIL PROTECTED] wrote: You could set your text field as an hidden field at first. Then handling onChange in the select box, with a small javascript you would show the text box when the is other and hide it otherwise.on Something like : $js = 'if(this.value == other) $(\'inpbox\').show(); else $(\'inpbox \').hide();'; echo $form-input('knowsfrom', array('type' = 'select', 'options' = $options, 'onchange' = $js)); echo $form-input('otherfrom', array('type' = 'text', 'id' = 'inpbox')); I did write this code just straight here, so you might get some syntax errors, but that should give you a hint. hth On Dec 13, 7:32 am, rocky [EMAIL PROTECTED] wrote: Hey, I'm trying to use cakePHP to do a client's sign up form. I want to know how did our clients find us so we have a selection box for them to choose. Well, there's an option called other, When they select Other as option I want the web page throws an text field for them to fill out. If any of you could give me some hint on how to achieve this, I would really appreciate it? Blessings, Rocky --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Trac Bug #3537
I encountered a problem with using paginator with: https://svn.cakephp.org/repo/trunk/cake/1.2.x.x/cake r6147 For some reason all the table sort links and paging links are coming out like so: /admin/faqs/admin_index/page:2 That extra /admin_index/ should really be /index/. It appears there's two patch diffs posted on this bug to fix this problem, but the bug was marked invalid before these were posted. The patches fix the sort column issue, but not the paging links. I created a consolidated patch for paginator.php file, which I could not attach to the ticket. Index: paginator.php === --- paginator.php (revision 6147) +++ paginator.php (working copy) @@ -212,6 +212,7 @@ *key the returned link will sort by 'desc'. */ function sort($title, $key = null, $options = array()) { + $admin = Configure::read('Routing.admin'); $options = am(array('url' = array(), 'model' = null), $options); $url = $options['url']; unset($options['url']); @@ -225,6 +226,11 @@ if ($this-sortKey($options['model']) == $key $this- sortDir($options['model']) == 'asc') { $dir = 'desc'; } + + if (preg_match('/'.$admin.'_/i', $this- params['action'])) { + $url['action'] = preg_replace('/'.$admin.'_/ i', '', $this-params['action']); + unset($url[$admin]); + } $url = am(array('sort' = $key, 'direction' = $dir), $url, array('order' = null)); return $this-link($title, $url, $options); @@ -238,6 +244,7 @@ * @return string A link with pagination parameters. */ function link($title, $url = array(), $options = array()) { + $admin = Configure::read('Routing.admin'); $options = am(array('model' = null, 'escape' = true), $options); $model = $options['model']; unset($options['model']); @@ -252,6 +259,12 @@ $urlOption = $options['url']; unset($options['url']); } + + if (preg_match('/'.$admin.'_/i', $this- params['action'])) { + $url['action'] = preg_replace('/'.$admin.'_/ i', '', $this-params['action']); + unset($url[$admin]); + } + $url = am(array_filter(Set::diff(am($paging['defaults'], $paging['options']), $paging['defaults'])), $urlOption, $url); if (isset($url['order'])) { @@ -489,4 +502,4 @@ return $this-output($out); } } -? \ No newline at end of file +? James --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP and VBulletin
Hi Dan, We had already integrated Phpbbbut when we tried integrating VBulletin we encountered problems. It is a problem of VBulletin handling the object in CakePHP. Thanks for the help. Regards, Lakshmi On Dec 13, 2007 8:34 PM, cakeFreak [EMAIL PROTECTED] wrote: DUnno if you are interested but I integrated SMF forum (http:// www.simplemachines.org/) as explained here: http://4webby.com/blog/posts/view/2/smake_smf_cakephp_integration Maybe you can use the same method to integrate vBullettin. Dan --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe 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: A question about MVC
@Grant Cox I agree with you. However, I find myself putting a lot of code into controllers. In many cases my models are quite thin while controllers are rather thick. One reason my controllers become thick is that it's easy for me to test out new methods while developing them. Just access them via URLs from browser (Turn on debug, use pr() and set autoRender to false). I tend to put real business / application logics in Model. For me it's fine for controller methods to do data (array , string) manipulation/ preparation before setting variables for views. On Dec 13, 8:48 pm, Grant Cox [EMAIL PROTECTED] wrote: It should be in the model - as should all data retrieval functions. Put as much stuff in the model as you can - the controller should just parse the request to see what model functions should be called, then set() this for the view. While some processing in the controller is inevitable, models are much easier to unit test than controllers and so should contain the majority of your application code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: DESCRIBE happening too often
How are you checking that you are getting a lot of DESCRIBE queries with DEBUG set to 0? On Dec 14, 7:09 am, Olexandr Melnyk [EMAIL PROTECTED] wrote: Hello bakers, in one of applications I'm working on, I have noticed DESCRIBE queries being executed on every page for all used models. With a load of page views, this only creates problems. As far as I know, such queries should be cached if application is in production (DEBUG = 0), but I still get them quite often. I have cheched /app/tmp/ directory permissions, and they are set to 777. I am using CakePHP 1.1 I don't know if CakePHP's cache expires after a number of pageviews since last update or after a set period of time, but is there a way to extend its lifetime? Thanks -- Sincerely yours, Olexandr Melnyk http://omelnyk.net/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---