$this->passedArgs breaking my Routes
Hey all. I have a fairly troublesome problem that has really been grating my goat for the past little while. It has to do with the supplying of named parameters to a URL, and having them break my pagination. I have a feeling that the example below might explain this better: --- __Route configuration__ Router::connect('/wap/', array('controller' => 'categories', 'action' => 'index', 'prefix' => 'wap')); Router::connect('/wap/:controller/:action/*', array('prefix' => 'wap', 'wap' => true)); [ As far as I can understand, this will map /wap/users/view/4 => userscontroller/wap_view/4 ] --- __Pagination__ options(array('url' => $this->passedArgs))?> [ This is what I am using to set the pagination URL options. ] --- Now, this works fine when I have no named parameters (e.g. URL: /wap/ products/index/22/page:3/). However, as soon as I add in another named parameter - no matter what the named parameter - the URLs used in the pagination are broken; they don't seem to use the reverse routing anymore. This is an example of the kinds of URLs that are generated once another named parameter is added: /products/wap_index/22/page:3/ images:on. So, as you can see, it merely takes the user to the controller/action URL, which is not the way that I would want it. I'm suspecting that this might actually just be because there is some silly parameter that I haven't included or something. If there is anyone that can help me, or at least point in the a decent direction, I would really appreciate it! Cheers, Geoff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I am clueless...
Read the cookbook, go through the example applications at the end, and things will clear up. http://book.cakephp.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I am clueless...
I need many clues, many clues... On 6 mar, 03:51, Delirium tremens wrote: > To extend CakePHP, do I have to read all of its source code? > > On 6 mar, 03:09, Delirium tremens wrote: > > > How do you work without having read all CakePHP source code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: I am clueless...
To extend CakePHP, do I have to read all of its source code? On 6 mar, 03:09, Delirium tremens wrote: > How do you work without having read all CakePHP source code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
link problem
I want to create a link like this: But if I use "link(' ', "../", array ('alt'=>'Home'))?>", it is giving this html: If i use "link(' ', "../", array('alt'=>'Home'))?>", it is giving this html: where no link action is working. How to solve this problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use contained models in conditions?
Miles, that's bad news. But how can I solve my problem? Is there any workaround? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
I am clueless...
How do you work without having read all CakePHP source code? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Converting SQL query to Cake query
Hello, I am having trouble converting this SQL query to a Cake query that uses find(): SELECT Page.*, COUNT(*) AS views FROM pages AS Page INNER JOIN page_views AS PageView ON Page.id = PageView.page_id GROUP BY Page.id ORDER BY COUNT(*) DESC LIMIT 10 OFFSET 0 This is what I've got, but it doesn't return anything: $this->Page->find('all', array( 'fields' => array('*', 'COUNT(*) as views'), 'conditions' => array('Page.id' => 'PageView.page_id'), 'group' => array('Page.id') ) ); Can someone help me refine? Thank you. -- View this message in context: http://n2.nabble.com/Converting-SQL-query-to-Cake-query-tp2434189p2434189.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Labels around inputs
Nope, still shows up the same. -Original Message- From: Miles J [mailto:mileswjohn...@gmail.com] Sent: March-06-09 1:20 AM To: CakePHP Subject: Re: Labels around inputs Try this, I havent tested it though. label('id', $form->input('id', array('label' => false))); ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Labels around inputs
Try this, I havent tested it though. label('id', $form->input('id', array('label' => false))); ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Labels around inputs
Does anyone know how I can put my inputs inside the label DIV? Right now the code rendered is: Perfect from this in the view : input(User,array('multiple'=>'checkbox','label'=>false)); ?> What I need is : Perfect I dont even care if the class=checkbox is there. Thnaks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: customizing foreign key constraint error
> You could create the "onError" function (takes no parameters) in your > model, which should get called every time there is a DB error of some > kind. This idea sounds great to fulfill my requirement. Thank you my friend. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Error message for the extension validation rule will not display
var $validate = array( 'imageupload' => array( 'rule' => array('extension', array('gif', 'jpeg', 'png', 'jpg'), 'message' => 'Please supply a valid image.' ) ) , 'email'=>array( 'rule'=>'email', 'message'=>'Please enter a proper email' ) ); should be like this var $validate = array( 'imageupload' => array( 'rule' => array('extension', array('gif', 'jpeg', 'png', 'jpg')), 'message' => 'Please supply a valid image.' ), 'email'=>array( 'rule'=>'email', 'message'=>'Please enter a proper email' ) ); - Best regards ! Giang Son Dat Mobile: +84 988114164 Email giangson...@gmail.com, giangson...@yahoo.com On Thu, Mar 5, 2009 at 6:37 PM, Dr. Loboto wrote: > > 'message' key-value should be in 'imageupload' array, not in 'rule' > one. You messed braces. > > On Mar 5, 9:49 pm, ryanam1 wrote: > > Hi, > > > > I am new to CakePHP and I am having trouble getting the extension > > error message to display. The error message for the email rule > > displays fine when someone enters an improperly formatted email and I > > tried other examples of Cake's built in validation, they all seem to > > work fine except for the extension validation. Can someone please > > tell me what I am doing wrong. > > > > Here are the validation rules in my model: > > var $validate = array( > > 'imageupload' => array( > > 'rule' => array('extension', array('gif', 'jpeg', 'png', > > 'jpg'), > > 'message' => 'Please supply a valid image.' > > ) > > ) > > , > > 'email'=>array( > > 'rule'=>'email', > > 'message'=>'Please enter a proper email' > > ) > > ); > > > > Here is the snippet code in the Controller: > >function add(){ > > if (!empty($this->data)) { > > > > if($this->Student->save($this->data)){ > > > > $this->flash('Success','/add'); > > } > > } > > } > > > > Finally the snippet code in my view: > > > echo $form->create('Student',array('type' => 'file')); > > echo $form->input('email'); > > echo $form->file('imageupload'); > > echo $form->end('Add'); > > ?> > > > > Again, the display message for the email displays correctly so I know > > that the validation is working at least somewhat. The validation for > > the file upload seems to operate correctly. If I try to upload a file > > with a .DOC extension the "save" fails except that it does not display > > the error message at all. > > > > Please help what am I doing wrong? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best Practice?
But the I'm in the EntryController, the associations would be more complex than in the Blog. I would need to connect the Entry to the Blog to the languages and then load more Entries at the same time in the edit-page... thx Aurelius On 5 Mrz., 00:07, brian wrote: > When you fetch the data for a BlogEntry, you can also get the Blog > info. Have a look at ContainableBehavior (or setting recursive in find > conditions). You can have Cake fetch data from any other table row > (model instance) which is associated with BlogEntry. > > On Wed, Mar 4, 2009 at 7:14 AM, Aurelius wrote: > > > Hi! > > > I have a Software Design Question, here's what I want to do (a bit > > simplified for better understanding): > > > I have following tables: > > Users -> hasMany -> Blogs -> hasMany -> Entries > > Users -> hasAndBelongsToMany -> Languages > > Blogs -> hasAndBelongsToMany -> Languages > > Entries use the TranslationBehaviour. > > So User one or more Blogs and can chose the languages in which he post > > all his blogentrie. > > An example would be: > > User (id=5,name=max) has one blog > > (id=7,name=myblog,languages=eng,ger). > > So every blogentry is saved in eng and ger with the > > TranslationBehaviour. > > > Now to the Design Part. > > Is it now right that I have to programm the whole Backend in the > > BlogController (while saving the Owner id in a session)? > > When I want to edit a Blogentry I need to know the settings of the > > blog... > > > And other Design Ideas? > > > thx > > Aurelius --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Update related model data
hi, did you check this: http://book.cakephp.org/view/75/Saving-Your-Data --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Security Component & $form->file()
Hey Everyone! I am struggling to write a file upload here. I have the security component enabled in my app_controller and as soon as i place a $form- >file() in the form and submit it, i get taken to a white page, no errors, and only a list of queries if i have them enabled. It is much like: https://trac.cakephp.org/ticket/5489 However the bug status is set to "fixed" so i am wondering if maybe someone else can reproduce the same error? Before i bother with opening a ticket. Thank you! VoiDeT --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM-Linking multiple times to the same model
hi, accidentaly I came across this, which might help you with your problem: http://www.webiscake.com/model-x-with-multiple-associations-leading-to-model-y/ the code is: array('className' => 'User', 'foreignKey' => 'sender_id' ), //Same goes for Receiver 'Receiver' => array('className' => 'User', 'foreignKey' => 'receiver_id' ), ); } ?> if anyone with real expertise could confirm that would be great. and hi all, btw. good luck! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form validation without model
Hi! I have a form that submits it's data to a controller, which then processes it (possibly in some complicated way) and saves it to a database. Or even doesn't save it, just uses it to render view. The point is that there is no direct relation between form fields and database tables. How do I validate such form, while still having the benefits of form helpers mentioned in tutorials (automatic toggling of error messages, repopulating the fields with entered data). One idea I have is to create the model with empty useTable var, and use it to validate the form - but that's not entirely intuitive to me. Is it okay (and "the MVC way") to do so, create such model for every form I want to validate, or is there some other, preferred solution? The other question is - there is a function that I want to be accessible by two controllers (but not necessarily by every function in the whole application, global variables and functions doesn't sound too OOP). Where do I put it to make it possible? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Unit Testing drops Test tables
I have a $test database config, into which I've loaded my production database schema When I do not load the fixtures, it operates on the $default database config, adding test data to prod. That's bad When I load the test fixture via the CakeTestCase::fixtures array, it deletes the tables it just used in the tests. Why? I know I can set CakeTestCase::dropTables = false, but it seems this would be the default. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Pagination with POST data
I dunno why you want to pass pagination data via POST. POST is not good for searching and paginating. Because your result-page can not keep the content by URL of itself. So, I think, cakePHP developer team did not support pagination via POST. They don't need to be stupid. Am I right? - Best regards ! Giang Son Dat Mobile: +84 988114164 Email giangson...@gmail.com, giangson...@yahoo.com On Thu, Mar 5, 2009 at 7:05 AM, marco.rizze...@gmail.com < marco.rizze...@gmail.com> wrote: > > I have seen from manual that I can pass arguments to paginator > functions with > >$paginator->options(array('url' => .)); > > Now with this I arguments pass via GET. > How can I do If I would pass arguments via POST. > Many Thanks > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Security and associated Models
Hi! I have a model Users which has Many Blogs which hasMany Entries. When I'm now in the Users edit function, I can also save Blog changes, so here's my question about Security. Does CakePHP automaticly checks if the Blog belongs to User or could I save any Blog changes through my user edit page, is the Standard - CakePHP-function secure? And the same question about changing entries from the users edit-page. (I can't use the SecurityComponent, which would make this (almost) imposible) thx Aurelius --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Error message for the extension validation rule will not display
'message' key-value should be in 'imageupload' array, not in 'rule' one. You messed braces. On Mar 5, 9:49 pm, ryanam1 wrote: > Hi, > > I am new to CakePHP and I am having trouble getting the extension > error message to display. The error message for the email rule > displays fine when someone enters an improperly formatted email and I > tried other examples of Cake's built in validation, they all seem to > work fine except for the extension validation. Can someone please > tell me what I am doing wrong. > > Here are the validation rules in my model: > var $validate = array( > 'imageupload' => array( > 'rule' => array('extension', array('gif', 'jpeg', 'png', > 'jpg'), > 'message' => 'Please supply a valid image.' > ) > ) > , > 'email'=>array( > 'rule'=>'email', > 'message'=>'Please enter a proper email' > ) > ); > > Here is the snippet code in the Controller: > function add(){ > if (!empty($this->data)) { > > if($this->Student->save($this->data)){ > > $this->flash('Success','/add'); > } > } > } > > Finally the snippet code in my view: > echo $form->create('Student',array('type' => 'file')); > echo $form->input('email'); > echo $form->file('imageupload'); > echo $form->end('Add'); > ?> > > Again, the display message for the email displays correctly so I know > that the validation is working at least somewhat. The validation for > the file upload seems to operate correctly. If I try to upload a file > with a .DOC extension the "save" fails except that it does not display > the error message at all. > > Please help what am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Returned mail: see transcript for details
Can someone give a temporary solution? On Fri, Mar 6, 2009 at 5:38 AM, Alfredo Quiroga-Villamil wrote: > > Can someone please fix this. As Brian previously pointed out I am > getting one of these failures everytime I post. > > Thanks in advance, > > Alfredo > > On Thu, Mar 5, 2009 at 4:25 PM, Mail Delivery Subsystem > wrote: > > The original message was received at ... > > > > The following addresses had permanent fatal errors > > > > (553 5.7.1 From=grbounce-j2ddrguaaaboxexadd8yj4w11_qw7men=iraj23= > lycos@googlegroups.com: To=iraj23: Mail is denied, message has been > blocked by user's personal blacklist) > > > > Final-Recipient: RFC822; ira...@lycos.com > > Action: failed > > Status: 553 5.7.1 From=grbounce-j2ddrguaaaboxexadd8yj4w11_qw7men=iraj23= > lycos@googlegroups.com: To=iraj23: Mail is denied, message has been > blocked by user's personal blacklist > > > > > > -- Forwarded message -- > > From: Alfredo Quiroga-Villamil > > To: cake-php@googlegroups.com > > Date: Thu, 5 Mar 2009 16:25:37 -0500 > > Subject: Re: routes regex > > > > Btw, I think I might have missed a digit in that regex: > > > > /\w+-\w+-\w+-\d+-\+-\d+-\w+-\w+/ > > > > Regards, > > > > Alfredo > > > > > > On Thu, Mar 5, 2009 at 4:18 PM, Alfredo Quiroga-Villamil > > wrote: > >> The code below is using perl; but take a look at the regex to match > >> the given string. I didn't test this a whole lot; so double check it > >> and run a few tests to see if it does what you want. > >> > >> use strict; > >> use warnings; > >> > >> my $string = 'asus-eee-pc-900-+-2-gb-ram'; > >> > >> if ( $string =~ /\w+-\w+-\w+-\d+-\+-\w+-\w+/ ) { > >> print "yes it matched \n"; > >> } else { > >> print "no match \n"; > >> } > >> > >> Regards, > >> > >> Alfredo > >> On Thu, Mar 5, 2009 at 3:12 PM, Alexandru Ciobanu < > ics.cake...@gmail.com> wrote: > >>> > >>> Hi guys, > >>> > >>> I'm having some trouble with custom routes. > >>> > >>> I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 > >>> > >>> My line for this in routes.php is: > >>> Router::connect('/product-details/:slug/:id', array('controller' => > >>> 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => > >>> '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', > 'slug'))); > >>> > >>> For some reason "\+" (literal plus sign) is ignored. > >>> > >>> Can anyone shed some light? > >>> > >>> Thanks. > >>> > >>> >> > >>> > >> > > > > > > > > > > > > > -- Thanks Joshua --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use contained models in conditions?
@Braindead - You are allowed to use conditions with contained items, but they cannot be tier 2 relations, only the first tier (like a belongs to). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake performance tips
Ill mention a few more things: - Install the DebugKit. It has load timers for everything, the controller, the views, etc so you can figure out whats taking the longest. - Look at all your queries and see what is taking the longest, and see if you can lower what fields/relations are returned to shave off a few milliseconds. - Use containable compared to bind/unbind. Binding can be extremely slow, because when you bind a model, that model has to load all its relation models, and then that one does also, down and down. So it could be very slow, containable disregards all this unless need be. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Index page problem
By default the home page routes to a "static" page which may be edited by adding home.ctp to the views\pages dir or as Blackymetal says you may reroute the page to a specific controller. You will also do well to read up on elements which allow you to place "modules" into specific views. On Mar 5, 2:12 am, kaushik wrote: > Below is my 'default.thtml', it is working properly. But i cannot > understand how to call any specific controller in index page. > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > > Untitled Document > > > > > > > > Anyone can help me? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Returned mail: see transcript for details
Can someone please fix this. As Brian previously pointed out I am getting one of these failures everytime I post. Thanks in advance, Alfredo On Thu, Mar 5, 2009 at 4:25 PM, Mail Delivery Subsystem wrote: > The original message was received at ... > > The following addresses had permanent fatal errors > > (553 5.7.1 > from=grbounce-j2ddrguaaaboxexadd8yj4w11_qw7men=iraj23=lycos@googlegroups.com: > To=iraj23: Mail is denied, message has been blocked by user's personal > blacklist) > > Final-Recipient: RFC822; ira...@lycos.com > Action: failed > Status: 553 5.7.1 > from=grbounce-j2ddrguaaaboxexadd8yj4w11_qw7men=iraj23=lycos@googlegroups.com: > To=iraj23: Mail is denied, message has been blocked by user's personal > blacklist > > > -- Forwarded message -- > From: Alfredo Quiroga-Villamil > To: cake-...@googlegroups.com > Date: Thu, 5 Mar 2009 16:25:37 -0500 > Subject: Re: routes regex > > Btw, I think I might have missed a digit in that regex: > > /\w+-\w+-\w+-\d+-\+-\d+-\w+-\w+/ > > Regards, > > Alfredo > > > On Thu, Mar 5, 2009 at 4:18 PM, Alfredo Quiroga-Villamil > wrote: >> The code below is using perl; but take a look at the regex to match >> the given string. I didn't test this a whole lot; so double check it >> and run a few tests to see if it does what you want. >> >> use strict; >> use warnings; >> >> my $string = 'asus-eee-pc-900-+-2-gb-ram'; >> >> if ( $string =~ /\w+-\w+-\w+-\d+-\+-\w+-\w+/ ) { >> print "yes it matched \n"; >> } else { >> print "no match \n"; >> } >> >> Regards, >> >> Alfredo >> On Thu, Mar 5, 2009 at 3:12 PM, Alexandru Ciobanu >> wrote: >>> >>> Hi guys, >>> >>> I'm having some trouble with custom routes. >>> >>> I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 >>> >>> My line for this in routes.php is: >>> Router::connect('/product-details/:slug/:id', array('controller' => >>> 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => >>> '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', 'slug'))); >>> >>> For some reason "\+" (literal plus sign) is ignored. >>> >>> Can anyone shed some light? >>> >>> Thanks. >>> >>> >> >>> >> > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session Object seems to disappear
Hi, i solved. The page that contains the second controller didn't have the starting statement ob_start(); Inserting the statement it works correctly. bye. On 5 Mar, 17:18, whitewolf wrote: > I have some information into my session object after my login > I set the session object information into the my user_controller. > I want to redirect to another controller under particular condition. > > the behaviour: > > If i try to dump $_session object before the redirect i'll see the > information correctly, > but if i try to dump the same information into the other controller > where i redirect in the index action, > i'll see only 'array()'. > > I set Session component for every controller but > i'don't know why when i change the controller > Session object information are lost. > > Can someone help me? > > Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: routes regex
Btw, I think I might have missed a digit in that regex: /\w+-\w+-\w+-\d+-\+-\d+-\w+-\w+/ Regards, Alfredo On Thu, Mar 5, 2009 at 4:18 PM, Alfredo Quiroga-Villamil wrote: > The code below is using perl; but take a look at the regex to match > the given string. I didn't test this a whole lot; so double check it > and run a few tests to see if it does what you want. > > use strict; > use warnings; > > my $string = 'asus-eee-pc-900-+-2-gb-ram'; > > if ( $string =~ /\w+-\w+-\w+-\d+-\+-\w+-\w+/ ) { > print "yes it matched \n"; > } else { > print "no match \n"; > } > > Regards, > > Alfredo > On Thu, Mar 5, 2009 at 3:12 PM, Alexandru Ciobanu > wrote: >> >> Hi guys, >> >> I'm having some trouble with custom routes. >> >> I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 >> >> My line for this in routes.php is: >> Router::connect('/product-details/:slug/:id', array('controller' => >> 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => >> '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', 'slug'))); >> >> For some reason "\+" (literal plus sign) is ignored. >> >> Can anyone shed some light? >> >> Thanks. >> >> >> >> > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: routes regex
The code below is using perl; but take a look at the regex to match the given string. I didn't test this a whole lot; so double check it and run a few tests to see if it does what you want. use strict; use warnings; my $string = 'asus-eee-pc-900-+-2-gb-ram'; if ( $string =~ /\w+-\w+-\w+-\d+-\+-\w+-\w+/ ) { print "yes it matched \n"; } else { print "no match \n"; } Regards, Alfredo On Thu, Mar 5, 2009 at 3:12 PM, Alexandru Ciobanu wrote: > > Hi guys, > > I'm having some trouble with custom routes. > > I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 > > My line for this in routes.php is: > Router::connect('/product-details/:slug/:id', array('controller' => > 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => > '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', 'slug'))); > > For some reason "\+" (literal plus sign) is ignored. > > Can anyone shed some light? > > Thanks. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake performance tips
On Mar 5, 9:02 pm, Javier wrote: > Thx for the answers, here are some points: > 1. We do have index on my DB (from primary keys and foreign keys > mainly), usually the DB access is really fast. > 2. We aren't using the Containable behavior, but we make use of > bindModel and unBindModel to limit the queries produced > 3. I just updated to 1.2 final 8004 and gain a little speed (thx!) > 4. To develop we use Firefox with some add-ons (firebug, developer > toolbar, YSlow), and we test our application with a clean IE (we have > even tested it on Chrome who has a really fast javascript engine), in > all cases, the application has a very slow response time > 5. Our css and js are both concatenated and obfuscated, so it > shouldn't be an issue. I'll try to profile the application, but right > now I can't install a profiler on our developer machine. > 6. Our project has 68 models and 22 controllers, 2 plug-ins (with no > models and a few controllers). We make use of Auth and RequestHandler > components and HTML and Form helpers. > Loading the initial page with debug=2 make a describe of all tables > (our models have lots of relations). > Right now the application performance's about 1 request per second on > the initial page and the apache process use around 20MB of memory for > each request. Other pages take up to 4 or 5 seconds to load. > > I'll try to get some profile info next time. > > Any other good practices or tips to further improve the performance?? When talking about performance, you are using debug = 0, right? Your best course of action will always be to profile your app and therefore *identify* what is slow rather than guess at the usual suspects. That said, if you have 68 models and they are all inter related (i.e. you could if you want go from any model to any other model by traversing associations) that means all 68 models will be loaded for each page load. Using Persistent models, or modifying the way you're using associations such that they aren't all inter-related would help with that. hth, AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: A better way to save to HABTM join table meta data?
Thanks for the reply mscdex I think if you do it the way I posted (put the field in Tag) you don't need bindModel at all. You can also use save() and not saveAll(). On Mar 5, 2:28 am, mscdex wrote: > On Mar 4, 6:52 pm, Omi wrote: > > > The correct way is to set > > $this->data['Tag'][0] = array( > > 'tag_id' => $foo, > > 'tagger_id' => $bar > > ); > > This is kinda on the right track. Here's an example of what I used for > a Movies sample project: > > views/movies/add.ctp: > echo $form->create('Movie'); > echo $form->input('Movie.name'); > echo $form->input('MoviesUser.0.user_id'); > echo $form->input('MoviesUser.0.ranking'); > echo $form->end('Submit'); > ?> > > controllers/movies_controller.ctp: > function add() { > if (!empty($this->data)) { > $this->Movie->create(); > > $this->Movie->bindModel(array('hasMany'=>array('MoviesUser')), > false); > if ($this->Movie->saveAll($this->data)) { > $this->Session->setFlash(__('The Movie has > been saved', true)); > $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The Movie could > not be saved. Please, > try again.', true)); > } > } > $users = $this->Movie->User->find('list'); > $this->set(compact('users')); > } > > IIRC the key was to do a bindModel with the name of the join relation > name as a hasMany association before saving. > > Hope that helps some. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
routes regex
Hi guys, I'm having some trouble with custom routes. I'm trying to match /asus-eee-pc-900-+-2-gb-ram/1521 My line for this in routes.php is: Router::connect('/product-details/:slug/:id', array('controller' => 'store', 'action' => 'view_product', 'id', 'slug'), array('id' => '[0-9]+','slug' => '[A-Za-z0-9_\-\.\,\+]+', 'pass' => array('id', 'slug'))); For some reason "\+" (literal plus sign) is ignored. Can anyone shed some light? Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake performance tips
Thx for the answers, here are some points: 1. We do have index on my DB (from primary keys and foreign keys mainly), usually the DB access is really fast. 2. We aren't using the Containable behavior, but we make use of bindModel and unBindModel to limit the queries produced 3. I just updated to 1.2 final 8004 and gain a little speed (thx!) 4. To develop we use Firefox with some add-ons (firebug, developer toolbar, YSlow), and we test our application with a clean IE (we have even tested it on Chrome who has a really fast javascript engine), in all cases, the application has a very slow response time 5. Our css and js are both concatenated and obfuscated, so it shouldn't be an issue. I'll try to profile the application, but right now I can't install a profiler on our developer machine. 6. Our project has 68 models and 22 controllers, 2 plug-ins (with no models and a few controllers). We make use of Auth and RequestHandler components and HTML and Form helpers. Loading the initial page with debug=2 make a describe of all tables (our models have lots of relations). Right now the application performance's about 1 request per second on the initial page and the apache process use around 20MB of memory for each request. Other pages take up to 4 or 5 seconds to load. I'll try to get some profile info next time. Any other good practices or tips to further improve the performance?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Adding multiple tags at the same time
Still don't working The content of $this->data is Array ( [Robot] => Array ( [name] => robotname [description] => robotdescription ) [Tag] => Array ( [0] => Array ( [id] => 6 [tag] => tag1 ) [1] => Array ( [id] => 7 [tag] => tag2 ) [2] => Array ( [tag] => tag3 ) ) ) I save using $this->Robot->saveAll($this->data) and got these queries: START TRANSACTION INSERT INTO `robots` (`name`, `description`) VALUES ('robotname', 'robotdescription') SELECT LAST_INSERT_ID() AS insertID SELECT `RobotsTag`.`tag_id` FROM `robots_tags` AS `RobotsTag` WHERE `RobotsTag`.`robot_id` = 2 COMMIT The models relations are: class Tag extends AppModel { var $name = 'Tag'; var $hasAndBelongsToMany = array( 'Robot' => array('className' => 'Robot', 'joinTable' => 'robots_tags', 'foreignKey' => 'tag_id', 'associationForeignKey' => 'robot_id', 'unique' => true, ); } class Robot extends AppModel { var $name = 'Robot '; var $hasAndBelongsToMany = array( 'Tag' => array('className' => 'Tag', 'joinTable' => 'robots_tags', 'foreignKey' => 'robot_id', 'associationForeignKey' => 'tag_id', 'unique' => true, ) ); What I am doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: can't pagination use the group by ?
I wrote a small example on this a while back, can be found here :- http://wiltonsoftware.com/posts/view/custom-group-by-pagination-and-a-calculated-field On Wed, Mar 4, 2009 at 6:22 PM, Rimoe wrote: > hi, > I have write a > var $paginate = array( > 'limit' => 50, > 'fields' => array('acc_id', 'count(*) as countnum'), > 'order' => array('countnum ' => 'desc'), > 'group' => array('acc_id') > ); > the paginate can't get the paginate's count, > > can't pagination use the group by ? > or how to use the group by in paginate. > > Thanks > rimoe > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use contained models in conditions?
give me an idea of cake php query i want to create a link of values get from table and if values are same then it become one link and click that link show all values --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to use contained models in conditions?
how i get same name values id from table pls tell me --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: AuthComponent doesn't work with scaffolding!
I know I'm not speaking for a popular opinion, but consider this: Scaffolding is a good way to get a prototype off the ground and show something to a client nearly instantly. Clients care about authentication. Clients would prefer to see the prototype with authentication working as the authentication is intimately associated with IA, use cases, application flow, what have you. Clients want to be able to visualize the completed application as much as possible. Finally, for newbies out there, out of the box, auth blanket applies to your controller methods when invoked in the controller. It's totally unintuitive for it to treat scaffolding any differently. So, what's the compelling reason not to support auth in scaffolds? On Jan 29, 11:14 am, Gwoo wrote: > the best way to solve it definitely to add more ! > something likeSCAFFOLD IS NOT FOR PRODUCTION USE --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to use contained models in conditions?
Hi all, I have 3 models: Company, Site and Country. All relations are set properly. Company hasMany Site Company belongsTo Country Site belongsTo Country Using the Containable Behavior find queries and pagination works well, except one thing: I can't get conditions to work that are related to the contained models. The following code shows how I paginate the Company model. But how can I specify that I only get companies that have at least one site? Or how is it possible to get only companies who have at least one site in Germany? $this->paginate = array( 'contain' => array( 'Country' => array( 'name', 'region', 'continent' ), 'Site' => array( 'fields' => array( 'id', 'name' ), 'Country' => array( 'name', 'region', 'continent' ) ) ) ); Thanks, Markus --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate rule: multiple (CookBook -> 4.1.4.17 Multiple)
Hello, I am looking for a way to do it in model page too. Any luck so far? Using HABTM classname for the fieldname doesn't work at all. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: requestAction problem with different version 1.2.0.7692 and 1.2.1.8004
( I'll skip the usual suggestion: to not use requestAction for this purpose. It has been said too often and I am sure you have read a few already. ) That does sound strange. I can suggest only one far-fetched things to look into. The very unlikely thing that can mess with the models in this way is if the same models (or more specifically: other models named the same) have been loaded into the ClassRegistry before you do the request. This IS very rare and has only happened to me once. Using requestAction can probably increase the odds though. In that case the "other model" was simply Cake creating an "empty" joining model (based off AppModel) for an association. That model was then reused when I was trying to load up the "real" joining model. You can check if the models are there and really descendants of your models and not direct descendants of AppModel. Looking at your model definitions I see no "with" parameter specified. So if the model "Tab" is loaded, it will load an empty "RolesTab" and nothing you do from that oint on will even get the real RolesTab model up and running. You will simply re-use the empty one. Try adding: 'with' => 'RolesTab', to both sides of the habtm. /Martin On Mar 5, 12:11 pm, "mazzon.mat...@gmail.com" wrote: > Hello, > I have a problem with requestAction when I change cakephp version from > 1.2.0.7692 to 1.2.1.8004. > I have this relations into Models that make a hasAndBelongsToMany from > Roles table and Tabs table (in the join table I have 2 fileds more: > position and active) : > > class RolesTab extends AppModel { > > var $name = 'RolesTab'; > > //The Associations below have been created with all possible keys, > those that are not needed can be removed > var $belongsTo = array( > 'Role' => array('className' => 'Role', > 'foreignKey' > => 'role_id', > 'conditions' > => '', > 'fields' => > '', > 'order' => '' > ), > 'Tab' => array('className' => 'Tab', > 'foreignKey' > => 'tab_id', > 'conditions' > => '', > 'fields' => > '', > 'order' => '' > ) > ); > > } > > class Role extends AppModel { > > var $name = 'Role'; > > //The Associations below have been created with all possible keys, > those that are not needed can be removed > > var $hasAndBelongsToMany = array( > 'Tab' => array('className' => 'Tab', > 'joinTable' => 'roles_tabs', > 'foreignKey' => 'role_id', > 'associationForeignKey' => > 'tab_id', > 'unique' => true, > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'limit' => '', > 'offset' => '', > 'finderQuery' => '', > 'deleteQuery' => '', > 'insertQuery' => '' > ) > ); > > } > > class Tab extends AppModel { > > var $name = 'Tab'; > > var $hasAndBelongsToMany = array( > 'Role' => array('className' => 'Role', > 'joinTable' => 'roles_tabs', > 'foreignKey' => 'tab_id', > 'associationForeignKey' => > 'role_id', > 'unique' => true, > 'conditions' => '', > 'fields' => '', > 'order' => '', > 'limit' => '', > 'offset' => '', > 'finderQuery' => '', > 'deleteQuery' => '', > 'insertQuery' => '' > ) > ); > var $displayField = 'text'; > >
Re: HTTP redirect messes up Cake routes
Have a look here: http://bakery.cakephp.org/articles/view/cakephp-in-a-subdirectory-and-no-trailing-slash On Wed, Mar 4, 2009 at 10:45 PM, gattu_marrudu wrote: > > Hi, > I am developing a website under a provider (Bluehost) which allows me > to put my website root under a subfolder. To do this I had to add the > following .htaccess file in the public_html folder: > > RewriteEngine on > > RewriteCond %{HTTP_HOST} ^(www\.)?(mydomain.net)$ > RewriteCond %{REQUEST_URI} !^/lii/ > RewriteCond %{REQUEST_FILENAME} !-f > RewriteCond %{REQUEST_FILENAME} !-d > RewriteRule ^(.*)$ /lii/$1 > > RewriteCond %{HTTP_HOST} ^(www\.)?(mydomain.net)$ > RewriteRule ^(/)?$ lii/index.php [L] > > > My public html files are in public_html/lii. The added 'lii/' never > shows up, as it should be. > > Everything looks fine until it comes to the routes. The router adds > 'lii/' to all the URLS when it translates them. > After debugging a little I got this: > //debug (Router::getPaths()); > Array > ( > [plugin] => > [controller] => > [action] => > [base] => /lii > [here] => /lii/somepage > [webroot] => /lii/ > ) > > //debug (Configure::read('App')); > Array > ( > [base] => > [baseUrl] => > [dir] => LII-4.0 > [webroot] => lii > [encoding] => UTF-8 > ) > > I tried to set Configure::write('App.base','/') in bootstrap, but it > won't work - it will strip all slashes from the URL! > Is there a way to set the Router base path? This might be the > solution... unless someone has another one. > > thanks > gm > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Captcha reload problem, works in ff not in IE
iraj23\ That seems pretty silly. There is not much benefit of using the same captcha image on every load. The point of captcha images is to be dynamic, ensuring a warm body is on the other end of the request. If you just want to use the same image, for the same action, and the same user (like validation failed the first time, etc) there are ways to do that. (perhaps by using session and checking for existence of $data) Anyway I have a great disdain for captcha images cause they tend to be a pain. Have you considered using logical questions to prevent bots? Asking if ice is cold, if rain is wet, or 5 * 3, etc. For one of my client's site I just created a table full of random questions like that, used in conjunction with session variables. might be worth a look. http://edwardawebb.com/programming/php-programming/cakephp/logical-bot-check-cakephp-captcha (it also uses some logic to determine whether it should load a new question, or reuse the existing one, if nothing else this portion may be helpful to you.) On Mar 5, 6:39 am, iraj23 wrote: > yes i want to see SAME captcha image on every load > > -- > View this message in > context:http://www.nabble.com/Captcha-reload-problem%2C-works-in-ff-not-in-IE... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot execute javascript
On Thu, Mar 5, 2009 at 12:32 AM, SergioTorresC. wrote: > > Brian, > > Thank you for your answer. > > You are right, it was a typo. I am not using the extensions when > calling the scripts. > > When I see the view source the links appear like this: > > >
Session Object seems to disappear
I have some information into my session object after my login I set the session object information into the my user_controller. I want to redirect to another controller under particular condition. the behaviour: If i try to dump $_session object before the redirect i'll see the information correctly, but if i try to dump the same information into the other controller where i redirect in the index action, i'll see only 'array()'. I set Session component for every controller but i'don't know why when i change the controller Session object information are lost. Can someone help me? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Error message for the extension validation rule will not display
Hi, I am new to CakePHP and I am having trouble getting the extension error message to display. The error message for the email rule displays fine when someone enters an improperly formatted email and I tried other examples of Cake's built in validation, they all seem to work fine except for the extension validation. Can someone please tell me what I am doing wrong. Here are the validation rules in my model: var $validate = array( 'imageupload' => array( 'rule' => array('extension', array('gif', 'jpeg', 'png', 'jpg'), 'message' => 'Please supply a valid image.' ) ) , 'email'=>array( 'rule'=>'email', 'message'=>'Please enter a proper email' ) ); Here is the snippet code in the Controller: function add(){ if (!empty($this->data)) { if($this->Student->save($this->data)){ $this->flash('Success','/add'); } } } Finally the snippet code in my view: create('Student',array('type' => 'file')); echo $form->input('email'); echo $form->file('imageupload'); echo $form->end('Add'); ?> Again, the display message for the email displays correctly so I know that the validation is working at least somewhat. The validation for the file upload seems to operate correctly. If I try to upload a file with a .DOC extension the "save" fails except that it does not display the error message at all. Please help what am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Call Functions of another controller.
well, what exactly Im trying to do is make a function that registers every movement of my application; I tried make a component but because depending of the parameters its the table that I extract the information; the component doesn't work so I tried the metod above cause was the one someone suggest me So I used requestAction in this way $results = $this->requestAction('/iptelpm_logs/bitacora/'. $numTables .'/'.$idTable .'/'.$keys .'/'.$mov.'/'.$model1 .'/'. $resource); And the only problem I had with it is that doesn't send and return arrays; but I controlled the function "bitacora" to prevent performance problems. Thanks everyone for your replys, and I want to know why don't use requestAction(), it's good know every point of view. On Mar 4, 1:34 pm, keymaster wrote: > You have these options: > 1. put the common function in a component. > 2. put the common function in appController. > 3. use requestAction() - (not good practise) > 4. combine all the actions of both controllers into a single > controller > 5. put the function in a model (if applicable) and have both > controllers access the model. > 6. put the common function in a file and include it in both > controllers (not good practise). > > Option #1 is recommended if it is only a few controllers sharing the > function. If all or most controllers need the function, option #2 is > best. The other options are not usually recommended. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake performance tips
Caching whole pages makes a difference: http://book.cakephp.org/view/346/Caching-in-the-Controller --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What do you develop in (ide, text editor, etc.)?
I use Komodo edit too, it's a great editor I recommend it ;D On Mar 4, 5:43 pm, uristar wrote: > Komodo :)http://www.activestate.com/komodo_edit/ > > On Mar 1, 10:35 pm, Samuel DeVore wrote: > > > a tutu and go go boots > > > On Sun, Mar 1, 2009 at 12:34 PM, Tomás Laureano Peralta Tormey > > > wrote: > > > Currently using NetBeans 6.5. The hints from this bakery article [1] were > > > really useful. > > > Hopefully, better support for CakePHP could be available in the near > > > future > > > (if this issue [2] get enough votes). > > > > [1]: > > >http://bakery.cakephp.org/articles/view/model-based-code-insight-and-... > > > [2]:http://www.netbeans.org/issues/show_bug.cgi?id=140918 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What do you develop in (ide, text editor, etc.)?
I continually forget to unsubscribe from PHPEdit's (update) newsletter, but...they recently had news announcing new support for Symfony within the editor. It has project explorer (big deal), and YAML syntax highlighting - based on indentation (again, big deal), but what it DOES do, is offer common command-line based tasks to be executed directly from the IDE without any need to open a terminal/ shell window. Pretty neat. I wonder if they'd eventually support CakePHP too? Here's a screencast: http://www.waterproof.fr/~shordeaux/phpedit-3.2/screencast/en/ On Mar 4, 8:29 pm, joshua wrote: > The textmate on windows/ some times I need editplus. Eclipse is eating your > machine memory! > > On Sun, Mar 1, 2009 at 4:14 AM, adam wrote: > > > I'm using Eclipse with PDT, but Dreamweaver for making layouts. > > -- > Thanks > Joshua --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Pagination with POST data
I have seen from manual that I can pass arguments to paginator functions with $paginator->options(array('url' => .)); Now with this I arguments pass via GET. How can I do If I would pass arguments via POST. Many Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: intercepting HABTM inserts - Where?
I was stumbling because I thought the beforeSave() was an all or nothing thing. So if you return true, the save functionthe ENTIRE save function executes. So I was trying to query bits of the save function to specifically stop the insert query on the HABTM table. Now I realize that if I unset the key variable of the HABTM relationship, cake knows to not make the insert. So here's the solution in the User model to the above problem: function beforeSave() { if ($this->data['User']['role_id'] != 'Club Administrator') { unset($this->data['Club']['Club']); } } FOLLOW-UP QUESTION: Is there a way to detect the action the controller is executing so I can wrap the if..then in a condition like: if ($this->action) { } ...that of course does not work...but what would get me the current users_controller action? Thanks! On Mar 4, 6:19 pm, brian wrote: > I would do that in beforeSave(). What problems were you having with that? > > On Wed, Mar 4, 2009 at 1:34 PM, foldiman wrote: > > > I've successfully setup a HABTM between a User model and Club model > > that looks like this in my User model: > > var $hasAndBelongsToMany = array( > > 'Club' =>array( > > 'className' => 'Club', > > 'foreignKey' => 'user_id', > > 'associationForeignKey' => 'club_id' > > ) > > ); > > > When creating new Users, I display a select field using the following > > in my Controller. > > > $this->set('clubs', $this->User->Club->find('list')); > > > However, after saving a new user, I only want to insert records into > > my clubs_users table for certain types of Users. For example, if a > > User is a 'Club Administrator', they can have a relationship with a > > Club. If they are an 'Anonymous User', I don't want to associate them > > with a Club. > > > I've successfully got this running by using jQuery to hide and show > > the Clubs select field on the add new User page according to a > > preceding User Role field. jQuery actually sets the Clubs field's name > > to 'null' when hidden so Cake ignores the field. However, this sees > > like a fragile system. > > > Is there a built in way in Cake to achieve the same results? Maybe in > > the beforeSave() callback in the User model to intercept and kill the > > clubs_users table insert? I've tried a few things there without luck. > > Any help would be appreciated. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Custom url's
Thank you for asnwering! I think I'm close to make it work, but I'm havent been able yet... I followed the instructions of the article and what I have is: 1) A database table called "fields"(it's strange, but fields is the real name of the table :S), whose fields are id fieldname content 2) In my Field model class Field extends AppModel { var $name = 'Article'; var $actsAs = array('Sluggable' => array('separator' => '_', 'overwrite' => true, 'slug'=>'id', 'label'=>'fieldname')); ; } 3) In my Fields Controller: function view($slug) { $field= $this->Field->findBySlug($slug); $this->set('field', $field); } 4) The link to see a field is like that: echo $html->link($temp_field['Field']['fieldname'],array ('controller'=>'fields','action'=>'view',$temp_field['Field']['id'])); Previously, I put the sluggable.php file in the app/models/behaviors folder. What I'm missing or doing wrong?? Thank you very much again. Regards! On 5 mar, 02:38, Sam Sherlock wrote: > have a look athttp://bakery.cakephp.org/articles/view/sluggable-behavior > > 2009/3/5 park > > > > > You either define a '/fields/view/science' route (hard coded) in /app/ > > config/route.php, > > Or pass 'science' as an argument an do a query in db. > > > On Mar 5, 8:23 am, MaNuM wrote: > > > Hi everybody. I haven't worked for a long time with CakePHP and I > > > can't find a solution for this: > > > > In my application a I have now url's like this one: > > > >http://localhost/cake/ocwdev/fields/view/17 > > > > 17 is the id refered to a field called "Science" for example. I would > > > like the url to be like this one: > > > >http://localhost/cake/ocwdev/fields/view/Science > > > > Is this possible without passing "Science" as an argument? I think it > > > is not a good idea to search by 'name' instead of by 'id' in the > > > controller to see the contents of the field.. > > > > Thank's in advanced. > > > > Regards. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Debug Comment Data in JSON Results
you can also change the index.php file inside the webroot directory and comment out the execution time line at the end On 4 Mrz., 03:31, Alex wrote: > Ahh, I see. Didn't think to write the debug configuration based on the > request. > > Annoying though that it appends that right? What practical purpose > could it serve? > > Thank you, > Alex > > On Mar 3, 11:57 am, bcreeve wrote: > > > What I do is parse .json extensions and return the JSON with > > Configure::write('debug', 0); like brian stated. > > > If I want to see what errors I'm getting when things bomb, I can hit > > the same URL without the extension to return the data as HTML in the > > default layout while respecting the environment's debug mode. > > > On Mar 3, 2:43 pm, brian wrote: > > > > On Tue, Mar 3, 2009 at 2:09 PM, Alex wrote: > > > > > I'm using the javascript->object() method to return JSON data for XHR > > > > requests. All works great when the cake debug level is set to 0, but > > > > when higher will append an html style comment to my JSON data like so: > > > > "", indicating the response time of the request. This > > > > prohibits the JSON data from being evaluated. Is there anyway to keep > > > > a non-zero debug level and keep cake from appending this value? > > > > Do you mean, so that you can see debugging info aside from the XHR > > > request? > > > > Configure::write('debug', 0); > > > > ... just before you send the JSON data. This way, you can see > > > debugging info elsewhere. There's no practical way to output debugging > > > info *with* your JSON data, as you've already seen. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake performance tips
Have you tried indexing your foreign keys? I work on an app with a page that does about 100 minimum queries per page load (it combines data from a lot of tables) and the query time spent is only about 80ms. On Mar 5, 6:10 am, Javier wrote: > Hello everyone, > I've read some posts about cakephp performance posted here and we've > implemented some of the stuff discussed previously, but our > application still have a really slow response time (it feels really > really slow). We are using cake 1.2RC3 and we don't have an opcodes > cache (like APC or xcache) installed yet. > I have a few questions: > Updating to CakePHP helps? > Our application have a lot of models and relation between them, could > this is be the cause of the slow response time? Can this be fixed/ > improved somehow? > Does anyone have any tips to improve the performance of a cakephp > application? > Are there any plans on improving CakePHP performance on the near > future? > > Thanks in advance for any reply. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HTTP redirect messes up Cake routes
Hi, I am developing a website under a provider (Bluehost) which allows me to put my website root under a subfolder. To do this I had to add the following .htaccess file in the public_html folder: RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?(mydomain.net)$ RewriteCond %{REQUEST_URI} !^/lii/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /lii/$1 RewriteCond %{HTTP_HOST} ^(www\.)?(mydomain.net)$ RewriteRule ^(/)?$ lii/index.php [L] My public html files are in public_html/lii. The added 'lii/' never shows up, as it should be. Everything looks fine until it comes to the routes. The router adds 'lii/' to all the URLS when it translates them. After debugging a little I got this: //debug (Router::getPaths()); Array ( [plugin] => [controller] => [action] => [base] => /lii [here] => /lii/somepage [webroot] => /lii/ ) //debug (Configure::read('App')); Array ( [base] => [baseUrl] => [dir] => LII-4.0 [webroot] => lii [encoding] => UTF-8 ) I tried to set Configure::write('App.base','/') in bootstrap, but it won't work - it will strip all slashes from the URL! Is there a way to set the Router base path? This might be the solution... unless someone has another one. thanks gm --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Index page problem
so where lies d prb? On Thu, Mar 5, 2009 at 2:42 PM, kaushik wrote: > > Below is my 'default.thtml', it is working properly. But i cannot > understand how to call any specific controller in index page. > > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > http://www.w3.org/1999/xhtml";> > > > Untitled Document > > > > > > > > Anyone can help me? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
integrating DNSdoctor in cakephp application
Hello All, I am doing one cakePHP application which requires DNSdoctor. How can i integrate DNSdoctor in my application without installing DNSdoctor. I searched on intenet , but i am not getting exact details about integrating DNSdoctor. Please any one can help me what i have to do and tell me the way how can i integrate into my cakePHP allpication without installing it into my application. finally my Operating System is: Windows Xp. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
requestAction problem with different version 1.2.0.7692 and 1.2.1.8004
Hello, I have a problem with requestAction when I change cakephp version from 1.2.0.7692 to 1.2.1.8004. I have this relations into Models that make a hasAndBelongsToMany from Roles table and Tabs table (in the join table I have 2 fileds more: position and active) : class RolesTab extends AppModel { var $name = 'RolesTab'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $belongsTo = array( 'Role' => array('className' => 'Role', 'foreignKey' => 'role_id', 'conditions' => '', 'fields' => '', 'order' => '' ), 'Tab' => array('className' => 'Tab', 'foreignKey' => 'tab_id', 'conditions' => '', 'fields' => '', 'order' => '' ) ); } class Role extends AppModel { var $name = 'Role'; //The Associations below have been created with all possible keys, those that are not needed can be removed var $hasAndBelongsToMany = array( 'Tab' => array('className' => 'Tab', 'joinTable' => 'roles_tabs', 'foreignKey' => 'role_id', 'associationForeignKey' => 'tab_id', 'unique' => true, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => '' ) ); } class Tab extends AppModel { var $name = 'Tab'; var $hasAndBelongsToMany = array( 'Role' => array('className' => 'Role', 'joinTable' => 'roles_tabs', 'foreignKey' => 'tab_id', 'associationForeignKey' => 'role_id', 'unique' => true, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'finderQuery' => '', 'deleteQuery' => '', 'insertQuery' => '' ) ); var $displayField = 'text'; } In the roles_tabs_controller I have this method: function gettabs() { $dati = $this->RolesTab->find('all', array('conditions'=>array ('Role.id'=>1),'order' => 'position ASC' ) ) ; ecc... } This is the only one method that I have found to retrive all the data: tab, Role and rolesTab with order in rolesTab. If I run gettabs action directly all is ok, but if I run this action with requestAction into another controller (for example post controller: $tabs = $this->requestAction(array ('controller'=>'roles_tabs','action'=>'gettabs')); ) the action runs wihout the associated model (into the final array I don't have the tab and role data). If I work with 1.2.0.7692 cake version all is ok and the requestaction return same result when I call gettabs directly. What' the problem? Is a bug? Thank's Mattia --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cannot execute javascript
Brian, Thank you for your answer. You are right, it was a typo. I am not using the extensions when calling the scripts. When I see the view source the links appear like this: And both files are, indeed, under cake/webroot/js Since my Www_Root variable is "C:\Inetpub\wwwroot\cake\app\webroot\" I understand the tags' src is correct, maybe not? On Mar 4, 10:13 pm, brian wrote: > On Wed, Mar 4, 2009 at 8:09 PM, SergioTorresC. > wrote: > > > link('prototype.js')); ?> > > Is this a typo? I ask because, further on in your mail, you leave out > the ".js", which is the correct way. Always leave out the extension > for both JS & CSS files. > > > > > > In myview.ctp file > > > link('listinvoices', false)); ?> > > > Firebug reports for both files a "syntax error" on line 1. > > Line 1 has the document declaration > > > > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > > > I checked on the web and the declaration seems to be ok. > > This is the same thing I see when the path to a JS file is incorrect. > You didn't mention what the script tag's src looks like (when you view > source). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with cascade deleting in cake_1.2.1.8004.
Can nobody help me with this? My workaround requires me to alter the cake code to get the app working, which is not a good idea. Thanks, Mal --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Index page problem
in /app/config/routes.php put this route : Router::connect('/', array('controller' => 'contents', 'action' => 'view',1)); On Mar 5, 6:39 am, kaushik wrote: > In front page i want to show same with "http;//www.test.com/contents/ > view/1", but the url must be like "http;//www.test.com/". How I can do > it? > > On Mar 5, 4:08 pm, Miles J wrote: > > > What exactly are you trying to do? You need to add links to > > controllers/actions before you can view them. > > > I would suggest reading the whole manual before going any further. > > Also upgrade to 1.2. > > >http://book.cakephp.org/ > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help in DRY'ing a controllers
Thanks for replying, this information might come in handy later. I just noticed that I have a typo in my title. It's supposed to be 'help in dry'ing controllers' On Mar 5, 1:08 am, majna wrote: > CommonController extends AppController > all common methods here... > (remeber to set parent::beforefilter() etc. if there is controller > callabacks) > > App:import('Controller', 'Common'); > PostController extends CommonController > > On Mar 4, 3:16 pm, ramonmaruko wrote: > > > > > > > I have three controllers that have the same code for the index/add/ > > edit/delete/view actions. How should I refactor the code so that it'll > > be in just one place, and those three controllers would just inherit > > the actions from somewhere? Currently, I have the actions defined > > inside my AppController class. Each action checks to see if the > > controller that called the action is one the three controllers > > 'expected' to inherit them. Is there a better way of doing this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help in DRY'ing a controllers
Thanks for the links, I think I'll go with grigri's approach. On Mar 5, 1:03 am, keymaster wrote: > These links may help: > > http://groups.google.com/group/cake-php/browse_thread/thread/5339fd41...http://groups.google.com/group/cake-php/browse_thread/thread/5339fd41... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Captcha reload problem, works in ff not in IE
yes i want to see SAME captcha image on every load -- View this message in context: http://www.nabble.com/Captcha-reload-problem%2C-works-in-ff-not-in-IE-tp17855131p22349653.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Index page problem
In front page i want to show same with "http;//www.test.com/contents/ view/1", but the url must be like "http;//www.test.com/". How I can do it? On Mar 5, 4:08 pm, Miles J wrote: > What exactly are you trying to do? You need to add links to > controllers/actions before you can view them. > > I would suggest reading the whole manual before going any further. > Also upgrade to 1.2. > > http://book.cakephp.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why we cann't use Auth component in AppController?
Yeah, maybe this is the only way I can access post detail now. I assume there is ancymous role in my ACL model. And the detail view page can be accessed by ancymous user. But now it seems I should give up this way. On Thu, Mar 5, 2009 at 7:07 PM, Miles J wrote: > > Add this to your posts beforeFilter(). You must allow pages to be > viewed publicly (meaning without logging in), else they are required > to login. > > $this->Auth->allow('detail'); > > You also dont need to call ACL twice. > > > -- Thanks Joshua --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Index page problem
What exactly are you trying to do? You need to add links to controllers/actions before you can view them. I would suggest reading the whole manual before going any further. Also upgrade to 1.2. http://book.cakephp.org/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why we cann't use Auth component in AppController?
Add this to your posts beforeFilter(). You must allow pages to be viewed publicly (meaning without logging in), else they are required to login. $this->Auth->allow('detail'); You also dont need to call ACL twice. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Why we cann't use Auth component in AppController?
Thank you, Miles. I have another question. class AppController extends Controller { var $uses = array('User'); var $helpers = array('Form', 'Html', 'Pagination','Javascript','Ajax'); var $components = array('Acl','Email','Auth'); function beforeFilter() {//} } class PostsController extends AppController { var $name = 'Posts'; var $components = array('Pagination','Acl','RequestHandler'); // //anonymous user can also view the post detail too. function detail($id){ //... } } When I try to call 'http:///posts/detail/2', the page will redirect to users::login page. I dig into the source of Dispatcher::_invoke() , there is a line: //code $controller->Component->startup($controller); //code end When I invoke this url, the Auth::startup method wil be invoked. And you can this source block //code if ($loginAction == $url) { // }else{ if (!$this->user()) { if (!$this->RequestHandler->isAjax()) { $this->Session->setFlash($this->authError, 'default', array(), 'auth'); $this->Session->write('Auth.redirect', $url); $controller->redirect($loginAction); return false; } elseif (!empty($this->ajaxLogin)) { //... } else { // } } } //code end It is here that my action was redirected. That is why I doubt should we put the Auth component in Appcontroller at my first post. Where I have made mistake at again? On Thu, Mar 5, 2009 at 10:50 AM, Miles J wrote: > > Your doing Auth all wrong. > > http://www.milesj.me/blog/read/5/using-cakephps-auth-component > > > -- Thanks Joshua --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Captcha reload problem, works in ff not in IE
I don't understand you. You want to see SAME captcha image on every load or DIFFERENT? On Mar 5, 1:53 pm, iraj23 wrote: > someone help me > i need this problem > how can i do this problem > i want when i reload the image i see again the similar captcha again and > again > > -- > View this message in > context:http://www.nabble.com/Captcha-reload-problem%2C-works-in-ff-not-in-IE... > Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Error handling in production
I think that is a very good solution. I don't know if another debug level is necessary since you resolve it in a good way. On Mar 5, 8:35 am, Aidan Lister wrote: > My previous comment was incorrect, you can easily override > ErrorHandler methods by creating app_error.php and AppError extends > ErrorHandler (as per my first comment). > > This is how I have decided to handle production errors now: > > /** > * Handle logging errors in production mode > */ > if (Configure::read() === 0) { > > // Disable the default handling and include logger > define('DISABLE_DEFAULT_ERROR_HANDLING', 1); > uses('cake_log'); > > /** > * A function to directly log errors > * > * @param $errno The error number > * @param $errstr The error description > * @param $errfile The file where the error occured > * @param $errline The line of the file where the error occured > * @return bool Success > */ > function productionError($errno, $errstr, $errfile, $errline) { > if ($errno === 2048) { > return; > } > > $level = LOG_DEBUG; > switch ($errno) { > case E_PARSE: > case E_ERROR: > case E_CORE_ERROR: > case E_COMPILE_ERROR: > case E_USER_ERROR: > $error = 'Fatal Error'; > $level = LOG_ERROR; > break; > case E_WARNING: > case E_USER_WARNING: > case E_COMPILE_WARNING: > case E_RECOVERABLE_ERROR: > $error = 'Warning'; > $level = LOG_WARNING; > break; > case E_NOTICE: > case E_USER_NOTICE: > $error = 'Notice'; > $level = LOG_NOTICE; > break; > default: > return false; > break; > } > > CakeLog::write($level, "{$error} ({$errno}): {$errstr} in > [{$errfile}, line {$errline}]"); > > if ($error == 'Fatal Error') { > die(); > } > return true; > } > > // Use the above handling > set_error_handler('productionError'); > > } > > This code belongs in your bootstrap.php file. > > This is how I am handling custom error pages in production: > function __construct($method, $messages) > { > $methods = array('paypal', 'system', 'payflow', 'cart', > 'generate'); > if (in_array($method, $methods)) { > Configure::write('debug', 1); > } > parent::__construct($method, $messages); > } > ?> > > Ideally cake would support a debug level of between production and > development, this would allow: > - Errors to still be logged in production environments > - Custom error handlers (as raised by cakeError) to be displayed to > the user. > > I have raised an enhancement so the clever folks in the development > team can consider:https://trac.cakephp.org/ticket/6165 > > Regards, > Aidan > > On Mar 4, 9:02 pm, Aidan Lister wrote: > > > Hi, > > > Firstly, there is no mechanism to overriding any of the functions in > > the ErrorHandler class. > > > Secondly, it's completely unnecessary, as you can use either > > _outputMessage() or appError() to achieve the same thing. Neither of > > these lend themselves to a) or b). > > > - Aidan > > > On Mar 4, 5:28 am, mscdex wrote: > > > > On Mar 3, 1:08 pm, Aidan Lister wrote: > > > > > Does anyone else have any suggestions? > > > > Why not override ErrorHandler's default 'error' function to handle the > > > HTTP errors? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---