Re: can't pagination use the group by ?
http://book.cakephp.org/view/249/Custom-Query-Pagination On Mar 4, 7:22 am, Rimoe meiyo...@gmail.com 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: Email component with smtp error: 503
I'm afraid, it's more complicated than that... When I unset the username and password, I get the error 550 unknown user. So the authentication should work. Any idea what this could 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: Error handling in production
On Mar 3, 7:28 pm, mscdex msc...@gmail.com wrote: On Mar 3, 1:08 pm, Aidan Lister aidanlis...@gmail.com wrote: Does anyone else have any suggestions? Why not override ErrorHandler's default 'error' function to handle the HTTP errors? I think that is a important question: Have a system that permits to log errors and notices even if the debug is set to 0. I haven't have experience about CAKEPHP and I don't have suggestion but I'm very intersting about 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: Error handling in production
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 msc...@gmail.com wrote: On Mar 3, 1:08 pm, Aidan Lister aidanlis...@gmail.com 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 -~--~~~~--~~--~--~---
validation notEmpty
I am using following code for validating a not empty field. var $validate = array( 'blogCategoryId' = array( 'required' = array('rule' = 'notEmpty', 'message'='Please select Blog category.'), ) ); It is working properly but giving the following warning: Warning (2): preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193] Can anyone highlight what is problem in 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 -~--~~~~--~~--~--~---
Best Practice?
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: L18n Showing and editing all available languages at the same time
Because the german title could be Mein Blog über CakePHP, but most Americans will not understand it, same with Spanish, I would not understand Spanish... (The whole Content will be available in more languages.) What would be the best realization? Can I work with the TranslationBehaviour or should I create a model which represents the translation table? thx Aurelius On 4 Mrz., 06:33, Miles J mileswjohn...@gmail.com wrote: You would have to store all of this in a database, and use some heavy relations. Why would the use add one for each language? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Will saveAll work for model on Level three?
Hi! I have 3 models on same form having relation in a tree format. Please guide me if the following [Post data dump] will work while using saveAll Array ( [Product] = Array ( [site_admin_id] = 1 ) [ProductVariation] = Array ( [0] = Array ( [catalog_number] = AXYCATA 6th1 [packaging] = 2 [product_variation_package_type_id] = 3 [quantity] = 300 [site_admin_id] = 1 ) [1] = Array ( [catalog_number] = AXYCATA 6th2 [packaging] = 4 [product_variation_package_type_id] = 3 [quantity] = 600 [site_admin_id] = 1 ) [2] = Array ( [catalog_number] = AXYCATA 6th3 [packaging] = 6 [product_variation_package_type_id] = 3 [quantity] = 1000 [site_admin_id] = 1 ) ) [ProductVariationTranslation] = Array ( [0] = Array ( [title] = Prod 6 Var 1 [description] = [site_admin_id] = 1 [language_code] = en ) [1] = Array ( [title] = [description] = This is 2nd variation for Product 6 [site_admin_id] = 1 [language_code] = en ) [2] = Array ( [title] = Prod 6 Var 3 [description] = This is 3rd Variation for Product 6 [site_admin_id] = 1 [language_code] = en ) ) ) Here Product hasMany ProductVariation then ProductVariation hasMany ProductVariationTranslation While executing the saveAll, all get saved except ProductVariationTranslation. It is also not getting validated during saveAll. The other format I have tried is as below [POST data dump]: Array ( [Product] = Array ( [site_admin_id] = 1 ) [ProductTranslation] = Array ( [0] = Array ( [title] = Product 6 [description] = This is the 6th product on Axygen website [site_admin_id] = 1 [language_code] = en ) ) [ProductVariation] = Array ( [0] = Array ( [catalog_number] = AXYCATA 6th1 [ProductVariationTranslation] = Array ( [0] = Array ( [title] = [description] = 2 packs with 500 quantity each [site_admin_id] = 1 [language_code] = en ) ) [packaging] = 2 [product_variation_package_type_id] = 3 [quantity] = 300 [site_admin_id] = 1 ) [1] = Array ( [catalog_number] = AXYCATA 6th2 [ProductVariationTranslation] = Array ( [0] = Array ( [title] = Prod 6th Variation 2 [description] = [site_admin_id] = 1 [language_code] = en ) ) [packaging] = 4 [product_variation_package_type_id] = 3 [quantity] = 600 [site_admin_id] = 1 ) ) ) This also dose not work and behaves similar to the previous one. Please help. :) 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: Brain sprain
Awesome I am going to try that now. I was also thinking since its essentially the same view it should also be the same action. I could just write a switch in the action that reads a hidden field in the form and then process accordingly. Not very pretty but it should work. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Wednesday, March 04, 2009 12:12 AM To: cake-php@googlegroups.com Subject: Re: Brain sprain Actually, I just realised that you could call $this-setAction('view', $user_id) instead of redirecting. On Tue, Mar 3, 2009 at 11:42 PM, Steven Wright rhythmicde...@gmail.com wrote: Well the only issue is that the client wants all the data and the add device on the same view. There will possible be more mini forms as well. I would prefer to break it up into logical chunks but its not my call. Would AJAX get me out of this? If I only have to update a region of the page its different than a redirect. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Tuesday, March 03, 2009 9:17 PM To: cake-php@googlegroups.com Subject: Re: Brain sprain On Tue, Mar 3, 2009 at 3:55 PM, RhythmicDevil rhythmicde...@gmail.com wrote: Hi, I am having a brain sprain. I have a controller Subscribers that has two actions 'view' and 'add_device'. View is called from the index page with a Subscriber ID and then shows all the Subscriber's details. In the 'view' view there is a form to add a device. This form's action points at 'subscribers/add_device' and passes the subscriber_id and the device_id. If the device_id is empty I want to send the user back to the 'view' view (I have to change that name) populated with the Subscriber's data. For some reason I cant figure out how to do that in a simple way. Because each call to a view is separate request the data does not persist. Would someone be so kind as to point out the obvious to me? Usually, the way this sort of thing is handled is to put the form in the add view. This way, if the save fails, Cake can simply re-display the form. If it succeeds, a redirect occurs. Would it be possible to put a regular link in the view view that pointed to controller::add_device()? You could append the subscriber_id to the URL. Or, you could use a hidden field in a form with a GET method. So, things would look something lie this: request: /subscribers/view/:id display: the subscriber's info, plus link/form to add device request: /subscribers/add_device/:id display: the form If the POST fails, you simply don't redirect and Cake will re-display the same form, though with an error msg if you've set that up. --~--~-~--~~~---~--~~ 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: Will saveAll work for model on Level three?
Will saveAll work for model on Level three? Not yet. You're going to have to do some looping for now. Maybe in 1.3?... https://trac.cakephp.org/ticket/5937#preview --~--~-~--~~~---~--~~ 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: Will saveAll work for model on Level three?
Thanks for the kind information. I will loop it! Thanks! On Mar 4, 6:23 pm, keymaster ad...@optionosophy.com wrote: Will saveAll work for model on Level three? Not yet. You're going to have to do some looping for now. Maybe in 1.3?... https://trac.cakephp.org/ticket/5937#preview --~--~-~--~~~---~--~~ 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: Brain sprain
That was the trick. Thanks Brian. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Wednesday, March 04, 2009 12:12 AM To: cake-php@googlegroups.com Subject: Re: Brain sprain Actually, I just realised that you could call $this-setAction('view', $user_id) instead of redirecting. On Tue, Mar 3, 2009 at 11:42 PM, Steven Wright rhythmicde...@gmail.com wrote: Well the only issue is that the client wants all the data and the add device on the same view. There will possible be more mini forms as well. I would prefer to break it up into logical chunks but its not my call. Would AJAX get me out of this? If I only have to update a region of the page its different than a redirect. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Tuesday, March 03, 2009 9:17 PM To: cake-php@googlegroups.com Subject: Re: Brain sprain On Tue, Mar 3, 2009 at 3:55 PM, RhythmicDevil rhythmicde...@gmail.com wrote: Hi, I am having a brain sprain. I have a controller Subscribers that has two actions 'view' and 'add_device'. View is called from the index page with a Subscriber ID and then shows all the Subscriber's details. In the 'view' view there is a form to add a device. This form's action points at 'subscribers/add_device' and passes the subscriber_id and the device_id. If the device_id is empty I want to send the user back to the 'view' view (I have to change that name) populated with the Subscriber's data. For some reason I cant figure out how to do that in a simple way. Because each call to a view is separate request the data does not persist. Would someone be so kind as to point out the obvious to me? Usually, the way this sort of thing is handled is to put the form in the add view. This way, if the save fails, Cake can simply re-display the form. If it succeeds, a redirect occurs. Would it be possible to put a regular link in the view view that pointed to controller::add_device()? You could append the subscriber_id to the URL. Or, you could use a hidden field in a form with a GET method. So, things would look something lie this: request: /subscribers/view/:id display: the subscriber's info, plus link/form to add device request: /subscribers/add_device/:id display: the form If the POST fails, you simply don't redirect and Cake will re-display the same form, though with an error msg if you've set that up. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Help in DRY'ing a controllers
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: Hi All :-)
Not a big deal Brian, I know you are cool and helpful; have seen plenty of emails coming from you helping people and suggesting ideas. I just felt bad for the guy and didn't want him to feel unwelcome. On Wed, Mar 4, 2009 at 12:23 AM, brian bally.z...@gmail.com wrote: On Tue, Mar 3, 2009 at 10:11 PM, Alfredo Quiroga-Villamil laww...@gmail.com wrote: Brian: I am hoping you are simply joking here or having a bad day or something. If you are not, that's not a cool way to reply to a valid question in my opinion. Alfredo, did you follow the link in his sig? Anyone who drags their soap opera into a dev list is worth flaming, IMHO. I'm sure he expects that Sergey is bemoaning the loss. But, maybe you're right--I should refrain from feeding the trolls. --~--~-~--~~~---~--~~ 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 in Cakephp install
Hi there while i install the cakephp this message appears Missing Database Table Error: Database table cakes for model Cake was not found. i delete the cache but there's the message also Thanks for 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 -~--~~~~--~~--~--~---
can not find javascripthelper
Hi all, I am new to cakephp. Maybe this problem is simple, but please help me. I have a hotels_controller.php: ?php class HotelsController extends AppController { var $scaffold; var $helpers = array(Javascript); function index() { } } ? and in the /app/views/layouts/default.ctp, there is ?php echo $javascript-link(main); ? and there is an empty view /app/views/hotels/index.ctp but I get error msg: Notice (8): Undefined variable: javascript [APP\views\layouts \default.ctp, line 1581] Code | Context $___viewFn = E:\xampp\htdocs\booking\app\views\layouts\default.ctp $___dataForView = array( controller = HotelController, controllerName = Hotel, title_for_layout = Missing Controller, content_for_layout = h2Missing Controller/h2 p class=error strongError: /strong emHotelController/em could not be found./p p class=error strongError: /strong Create the class emHotelController/em below in file: app \controllers\hotel_controller.php/p pre lt;?php class HotelController extends AppController { var $name = 'Hotel'; } ?gt; /pre p class=notice strongNotice: /strong If you want to customize this error message, create app\views\errors \missing_controller.ctp/p, scripts_for_layout = , cakeDebug = , html = HtmlHelper HtmlHelper::$tags = array HtmlHelper::$base = /booking HtmlHelper::$here = NULL HtmlHelper::$params = array HtmlHelper::$action = NULL HtmlHelper::$data = array HtmlHelper::$_crumbs = array HtmlHelper::$__docTypes = array HtmlHelper::$helpers = NULL HtmlHelper::$webroot = /booking/ HtmlHelper::$themeWeb = NULL HtmlHelper::$plugin = NULL HtmlHelper::$namedArgs = NULL HtmlHelper::$argSeparator = NULL HtmlHelper::$validationErrors = NULL HtmlHelper::$__tainted = NULL HtmlHelper::$__cleaned = NULL HtmlHelper::$_log = NULL, form = FormHelper FormHelper::$helpers = array FormHelper::$fieldset = array FormHelper::$__options = array FormHelper::$fields = array FormHelper::$requestType = NULL FormHelper::$base = /booking FormHelper::$webroot = /booking/ FormHelper::$themeWeb = NULL FormHelper::$here = NULL FormHelper::$params = array FormHelper::$action = NULL FormHelper::$plugin = NULL FormHelper::$data = array FormHelper::$namedArgs = NULL FormHelper::$argSeparator = NULL FormHelper::$validationErrors = NULL FormHelper::$tags = array FormHelper::$__tainted = NULL FormHelper::$__cleaned = NULL FormHelper::$_log = NULL FormHelper::$Html = HtmlHelper object, session = SessionHelper SessionHelper::$helpers = NULL SessionHelper::$__active = true SessionHelper::$valid = false SessionHelper::$error = false SessionHelper::$_userAgent = 644aff775060fb52a3ee411e4ab5015b SessionHelper::$path = / SessionHelper::$lastError = NULL SessionHelper::$security = NULL SessionHelper::$time = 1236152562 SessionHelper::$sessionTime = false SessionHelper::$watchKeys = array SessionHelper::$id = NULL SessionHelper::$_log = NULL SessionHelper::$base = /booking SessionHelper::$webroot = /booking/ SessionHelper::$here = NULL SessionHelper::$params = array SessionHelper::$action = NULL SessionHelper::$data = array SessionHelper::$themeWeb = NULL SessionHelper::$plugin = NULL ) $loadHelpers= false $cached = true $loadedHelpers = array() $controller = HotelController $controllerName = Hotel $title_for_layout = Missing Controller $content_for_layout = h2Missing Controller/h2 p class=error strongError: /strong emHotelController/em could not be found./p p class=error strongError: /strong Create the class emHotelController/em below in file: app \controllers\hotel_controller.php/p pre lt;?php class HotelController extends AppController { var $name = 'Hotel'; } ?gt; /pre p class=notice strongNotice: /strong If you want to customize this error message, create app\views\errors \missing_controller.ctp/p $scripts_for_layout = $cakeDebug = $html = HtmlHelper HtmlHelper::$tags = array HtmlHelper::$base = /booking HtmlHelper::$here = NULL HtmlHelper::$params = array HtmlHelper::$action = NULL HtmlHelper::$data = array HtmlHelper::$_crumbs = array HtmlHelper::$__docTypes = array HtmlHelper::$helpers = NULL HtmlHelper::$webroot = /booking/ HtmlHelper::$themeWeb = NULL HtmlHelper::$plugin = NULL HtmlHelper::$namedArgs = NULL HtmlHelper::$argSeparator = NULL HtmlHelper::$validationErrors = NULL HtmlHelper::$__tainted = NULL HtmlHelper::$__cleaned = NULL HtmlHelper::$_log = NULL $form = FormHelper FormHelper::$helpers = array FormHelper::$fieldset = array FormHelper::$__options = array FormHelper::$fields = array FormHelper::$requestType = NULL FormHelper::$base = /booking FormHelper::$webroot = /booking/ FormHelper::$themeWeb = NULL FormHelper::$here = NULL FormHelper::$params = array FormHelper::$action = NULL
Re: What do you develop in (ide, text editor, etc.)?
same here. have u tried safari (beta4) web inspector (under the develop menu)? sweet. On Mar 2, 8:18 pm, supp...@savant.be supp...@savant.be wrote: even though I still do preview in Safari and Firefox (with Firebug!) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
$javascript-link(main.js) doesn't work
Hi, I am new to cakephp. I want to add a script/script tag to the head the page. I add the ?php echo $scripts_for_layout ? in the layout's head/head block, and ?php $javascript-link(main.js); ? in the view. But I can not see any script tag in the output html. Why? --~--~-~--~~~---~--~~ 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: validation notEmpty
'names' = array('rule'=VALID_NOT_EMPTY ,'message'='Please provide your name.'), You can use it for your validation. On Wed, Mar 4, 2009 at 4:23 PM, kaushik kaushikwo...@gmail.com wrote: I am using following code for validating a not empty field. var $validate = array( 'blogCategoryId' = array( 'required' = array('rule' = 'notEmpty', 'message'='Please select Blog category.'), ) ); It is working properly but giving the following warning: Warning (2): preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193] Can anyone highlight what is problem in code? -- Regards Yasir Arafat Web developer United Group International 01816536901 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Why we cann't use Auth component in AppController?
It seems that if I use Auth component in AppController and then I use it again in my UserController again. All the request like ../users/ method_a will be redirect to login page. If I remove the Auth component from UserController, everything works fine! Why? Is there any explanation for 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: $javascript-link(main.js) doesn't work
Try *echo *$javascript-link('*main*'); sulong wrote: Hi, I am new to cakephp. I want to add a script/script tag to the head the page. I add the ?php echo $scripts_for_layout ? in the layout's head/head block, and ?php $javascript-link(main.js); ? in the view. But I can not see any script tag in the output html. Why? --~--~-~--~~~---~--~~ 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?
That depends on how did you set up your Auth. Are you denying everything in UsersController? On Mar 4, 4:01 pm, Joshua josh...@gmail.com wrote: It seems that if I use Auth component in AppController and then I use it again in my UserController again. All the request like ../users/ method_a will be redirect to login page. If I remove the Auth component from UserController, everything works fine! Why? Is there any explanation for 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: Why we cann't use Auth component in AppController?
Thanks for your reply. I do all the auth allow/deny in app controller. Did that means we shouldn't do auth in app controller? On Wed, Mar 4, 2009 at 11:09 PM, dr. Hannibal Lecter lecter...@gmail.comwrote: That depends on how did you set up your Auth. Are you denying everything in UsersController? On Mar 4, 4:01 pm, Joshua josh...@gmail.com wrote: It seems that if I use Auth component in AppController and then I use it again in my UserController again. All the request like ../users/ method_a will be redirect to login page. If I remove the Auth component from UserController, everything works fine! Why? Is there any explanation for this? -- 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: Why we cann't use Auth component in AppController?
On Wed, Mar 4, 2009 at 1:33 PM, joshua josh...@gmail.com wrote: Thanks for your reply. I do all the auth allow/deny in app controller. Did that means we shouldn't do auth in app controller? Might be a good idea to show your app_controller.php code where you initialize the Auth stuff. - Gonzalo --~--~-~--~~~---~--~~ 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?
Well, the short answer is that you can. There must be something wrong in your code, because I use the Auth in both appController and other controllers quite often. You should show us some of your code so we can help. On 4 mar, 10:01, Joshua josh...@gmail.com wrote: It seems that if I use Auth component in AppController and then I use it again in my UserController again. All the request like ../users/ method_a will be redirect to login page. If I remove the Auth component from UserController, everything works fine! Why? Is there any explanation for 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: Why we cann't use Auth component in AppController?
You can put Auth in App Controller and it will work fine, and you can override it in UsersController. In this controller, you can write beforeFilter() { parent::beforeFilter(); // this line will call the AppController's beforeFilter line 1 } and after line 1, you can put new allow/deny commands and they will replace the old allow/deny. --~--~-~--~~~---~--~~ 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 filter the content based on its format type
hello, i want to filter the data on the basis of its type i.e whether it is a document, or video or ppt, how should i do that. currently my finder query results the mix of the formats according to the condition supplied. I have an entities_controller.php which has the actions as latest, popular, browse which all result me the paginate result of entities and set a common variable for the view. and my url looks like www.abcd.com/latest for latest data www.abcd.com/popular for popular and so on now i want something like www.abcd.com/latest/vid gives me all latest videos www.abcd.com/popular/doc gives me all the popular documents and so on for rest of the actions what should i alter in my code to make it generic so that one change can do this all.. is something done in model entity.php beforeFind or any other sort of approch anyone suggests. i can send the code if wanted for this if problem is not understood. Thanx, --~--~-~--~~~---~--~~ 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
These links may help: http://groups.google.com/group/cake-php/browse_thread/thread/5339fd41fa534323# http://groups.google.com/group/cake-php/browse_thread/thread/5339fd41fa534323# --~--~-~--~~~---~--~~ 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 Handle Tightly Coupled Database Tables?
Hey Nate. Thanks for the feedback but I'm not sure it provided much help for me. Hopefully it will provide some insight for some others. By tightly coupled I simply meant that I pretty much always want to look at data from both tables together. I didn't realize the term was conflicting with an existing notion of coupling. In hindsight I suppose the contrived example is insufficient to explain reality. I have Voicemail hasMany Transcription (and Transcription belongsTo Voicemail). When I mentioned a MySQL view to solve the problem of calculated columns, you replied: This is called de-normalization, and is a very common thing to want to do, for many reasons, including but not limited to performance improvements and reducing code complexity. For what it's worth, creating a MySQL View to join the two and include calculated columns is not de-normalization. Each table is still as normalized as it is without the view. Using a view is really just a valid choice to move some core business logic to the database for performance and complexity reasons. You can see an example implemented in the CakePHP core in the form of counter caches for hasMany/belongsTo relationships:http://book.cakephp.org/view/490/counterCache-Cache-your-count I currently use counter cache where appropriate, however AFAIK I can't have an auto-magic counter cache while specifying child conditions. For instance, at the Voicemail level I need to know how many Transcriptions are transcribed and how many are untranscribed. Also, the the voicemail level, I want a boolean column as a flag to tell me if any transcriptions are transcribed but blank. In my Oracle and MS SQL experience, no question this stuff would be best calculated a view or pipeline function. Cake seems to want things done in Cake, the Cake way. I buy into this only as long as it is possible or practical to do so within the framework. So I started adding these calculated columns in the afterFind method of the Voicemail model. Now they are always available when I find a Voicemail (these were referred to as pseudo columns or pseudo fields in other articles or posts). Problem is, these columns end up being a separate SELECT COUNT statement to the DB, which is not going to scale well in terms of performance. For my needs, the above has several limitations: 1. I cannot query against any Child columns or these calculated columns. This seems like an artificial constraint. Why not query the Child object directly? The context is not at the child level. I'm trying to search and sort Voicemails (in the Voicemail index) based on the status of its collective child Transcriptions. In my opinion, it is not appropriate to be querying about Voicemails at the Transcriptions level. Also, it's not trivial or appropriate to be asking about information about sibling Transcriptions that are related by voicemail_id at the Transcription level. In other words, I don't want to ask the Transcriptions if all Transcriptions for a particular Voicemail are adequately transcribed. I should be able to ask a Voicemail about its children Transcriptions. 2. I cannot sort on said columns. See above. Same as #1 above. 3. Cake gives each Child get its own SELECT via hasMany, and each pseudo column for each parent gets its own SELECT, which likely won't scale with respect to performance. If you query the Child object directly, Parent will be attached via a LEFT JOIN, and everything will happen in one query. Also, I'm not sure what you mean about pseudo columns. Why not just actually create the columns you mentioned above, and use them to cache count values? See #1 4. Lastly, I need to paginate filtered and/or sorted results, which just seems to add another layer of complexity. See the solution I mentioned immediately above. The default core pagination would apply perfectly in that scenario. Thanks for the feedback but I'm not sure we were on the same page initially. Does my response give you any more clarification? brian --~--~-~--~~~---~--~~ 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 Handle Tightly Coupled Database Tables?
On Mar 4, 1:01 am, Miles J mileswjohn...@gmail.com wrote: Have you tried paginating/searching from the actual HABTM model? In this case your model would be ChildParents. Miles: Thanks, but I have a hasMany/belongsTo relationship, not HABTM, so there is no relationship table. --~--~-~--~~~---~--~~ 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
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 ramonmar...@gmail.com 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 -~--~~~~--~~--~--~---
HABTM-Linking multiple times to the same model
Hello everybody! I would like to link one Model to another by HABTM-joinTables. That is no problem as long as I link Model A to Model B one time. But how do I link Model A to Model B for different uses. I try to explain by an example: I have a Shop (Model A) and I have a Person (Model B) I want to link multiple Persons to a Shop for different uses. 1.) Persons that do buy in this shop (joinTable jobs_persons) 2.) Persons that do want a newsletter from the shop (a second joinTable newsletter_persons_shops) The first variant is discussed everywhere. I tried the following: class Shop extends AppModel { ... var $hasAndBelongsToMany =array( 'Person' = array( 'className' = 'Person', 'joinTable' = 'persons_shops', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), 'NewsletterPerson' = array( 'className' = 'Person', 'joinTable' = 'admin_extensions_devices', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), ); } On reading the data of the Shop this seems to work. But is this the right way to do it? And how do I define the Linking in the Person-Model? var $hasAndBelongsToMany = array( 'Shop' = array( 'className' = 'Shop', 'joinTable' = 'persons_shops', 'foreignKey' = 'person_id', 'associationForeignKey'= 'shop_id', 'conditions' = '', 'order' = '', 'limit' = '',
Re: HABTM-Linking multiple times to the same model
Damn, the first part has an error. I meant this... class Shop extends AppModel { ... var $hasAndBelongsToMany =array( 'Person' = array( 'className' = 'Person', 'joinTable' = 'persons_shops', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), 'NewsletterPerson' = array( 'className' = 'Person', 'joinTable' = 'newsletter_persons_shops', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), ); } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HABTM-Linking multiple times to the same model
Hello everybody! I would like to link one Model to another by HABTM-joinTables. That is no problem as long as I link Model A to Model B one time. But how do I link Model A to Model B for different uses. I try to explain by an example: I have a Shop (Model A) and I have a Person (Model B) I want to link multiple Persons to a Shop for different uses. 1.) Persons that do buy in this shop (joinTable jobs_persons) 2.) Persons that do want a newsletter from the shop (a second joinTable newsletter_persons_shops) The first variant is discussed everywhere. I tried the following: class Shop extends AppModel { ... var $hasAndBelongsToMany =array( 'Person' = array( 'className' = 'Person', 'joinTable' = 'persons_shops', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), 'NewsletterPerson' = array( 'className' = 'Person', 'joinTable' = 'newsletter_persons_shops', 'foreignKey' = 'shop_id', 'associationForeignKey'= 'person_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), ); } On reading the data of the Shop this seems to work. But is this the right way to do it? And how do I define the Linking in the Person-Model? var $hasAndBelongsToMany = array( 'Shop' = array( 'className' = 'Shop', 'joinTable' = 'persons_shops', 'foreignKey' = 'person_id', 'associationForeignKey'= 'shop_id', 'conditions' = '', 'order' = '', 'limit' = '', 'unique' = true, 'finderQuery' = '', 'deleteQuery' = '', ), ... ??? ... I hope anybody understands my question :) --~--~-~--~~~---~--~~ 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: Problems with JPGraph
THANK YOU! My server was set to a 8M memory limit. My dev box was at 128M memory limit. I bumped the production server up to 64M and everything worked. On Feb 26, 10:17 am, Juan Miguel Paredes juan.pare...@gmail.com wrote: On Fri, Feb 27, 2009 at 9:31 AM, BarbarianGeek barbarian.g...@gmail.com wrote: I haveJPGraphloaded and creating graphs. I have a development machine and a production machine. I have a page with both a bar graph and a line graph. On the development machine, both graphs render fine. On my production machine, the bar graph will not render but the line graph does. This leaves me to be completely confused as to the problem. If it was JPGraphor GD, no graphs would work and if it was my code, the graph would fail on both dev and production boxes. Anyone have an idea of where the heck to hunt this problem down? Nothing on your app logs and/or web server log? Try to set debug level to 2 on your production machine (temporarily). Just guessing, are the web server and php memory settings equal on your dev and prod environments (e.g. memory_limit on php.ini, etc) ? --~--~-~--~~~---~--~~ 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: L18n Showing and editing all available languages at the same time
Yes, you can use TranslateBehavior, if you don't mind that callbacks are not fired on associated models. It means - any behavior's callbacks can work correctly only on primary model, so it does not translate virtual fields for associated models. Possible workaround for this issue is here: http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b As of displaying or editing multiple translations at once, yes it is possible - by default it picks up locale from your Config.language setting, but you can set YourModel-locale to array of locales and then ;) you know, read test case of TranslateBehavior. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
intercepting HABTM inserts - Where?
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 -~--~~~~--~~--~--~---
HABTM query with conditions - HELP
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? 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 -~--~~~~--~~--~--~---
Call Functions of another controller.
Hello Everyone! I want to now if someone knows how to call a function from another controller, I have already tried $results = $this-WhateverModelIs-TheModelIWantToCall- thefunctionIwanttocall($passeddata); but cake sends me this notice: Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall And I really don´t know what else can I do, I'll apreciate your help. --~--~-~--~~~---~--~~ 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 Handle Tightly Coupled Database Tables?
On Mar 4, 6:06 pm, bcreeve bcre...@gmail.com wrote: Hey Nate. Thanks for the feedback but I'm not sure it provided much help for me. Hopefully it will provide some insight for some others. By tightly coupled I simply meant that I pretty much always want to look at data from both tables together. I didn't realize the term was conflicting with an existing notion of coupling. In hindsight I suppose the contrived example is insufficient to explain reality. I have Voicemail hasMany Transcription (and Transcription belongsTo Voicemail). When I mentioned aMySQL viewto solve the problem of calculated columns, you replied: This is called de-normalization, and is a very common thing to want to do, for many reasons, including but not limited to performance improvements and reducing code complexity. For what it's worth, creating aMySQL Viewto join the two and include calculated columns is not de-normalization. You're quoting out of context/sequence and possibly missing the point. Each table is still as normalized as it is without the view. Using a view is really just a valid choice to move some core business logic to the database for performance and complexity reasons. indeedy. To all intents and purposes a db-view is just a table to cake. You can see an example implemented in the CakePHP core in the form of counter caches for hasMany/belongsTo relationships:http://book.cakephp.org/view/490/counterCache-Cache-your-count I currently use counter cache where appropriate, however AFAIK I can't have an auto-magic counter cache while specifying child conditions. For instance, at the Voicemail level I need to know how many Transcriptions are transcribed and how many are untranscribed. Also, the the voicemail level, I want a boolean column as a flag to tell me if any transcriptions are transcribed but blank. I don't follow your example but if you did de-normalize (which means literally creating a field for each of your counts) you can use counterCache and counterScope to update the values as appropriate. You could also do it directly with group by and agregate functions or if you use a view, no need for countercache but you'll probably find that given views in mysql are typlically un-optimized that only superficially solves your problem. In my Oracle and MS SQL experience, no question this stuff would be best calculated a view or pipeline function. Cake seems to want things done in Cake, the Cake way. I buy into this only as long as it is possible or practical to do so within the framework. So I started adding these calculated columns in the afterFind method That's typically a mistake. of the Voicemail model. Now they are always available when I find a Voicemail (these were referred to as pseudo columns or pseudo fields in other articles or posts). Problem is, these columns end up being a separate SELECT COUNT statement to the DB, which is not going to scale well in terms of performance. For my needs, the above has several limitations: 1. I cannot query against any Child columns or these calculated columns. This seems like an artificial constraint. Why not query the Child object directly? The context is not at the child level. I'm trying to search and sort Voicemails (in the Voicemail index) based on the status of its collective child Transcriptions. In my opinion, it is not appropriate to be querying about Voicemails at the Transcriptions level. That's the problem with contrived examples. Also, it's not trivial or appropriate to be asking about information about sibling Transcriptions that are related by voicemail_id at the Transcription level. In other words, I don't want to ask the Transcriptions if all Transcriptions for a particular Voicemail are adequately transcribed. I should be able to ask a Voicemail about its children Transcriptions. 2. I cannot sort on said columns. See above. Same as #1 above. It looks like your ignoring the answer that's already been given (de- normalize). 3. Cake gives each Child get its own SELECT via hasMany, and each pseudo column for each parent gets its own SELECT, which likely won't scale with respect to performance. If you query the Child object directly, Parent will be attached via a LEFT JOIN, and everything will happen in one query. Also, I'm not sure what you mean about pseudo columns. Why not just actually create the columns you mentioned above, and use them to cache count values? See #1 4. Lastly, I need to paginate filtered and/or sorted results, which just seems to add another layer of complexity. See the solution I mentioned immediately above. The default core pagination would apply perfectly in that scenario. Thanks for the feedback but I'm not sure we were on the same page initially. Does my response give you any more clarification? Maybe. In what way would using a view (if you choose) or using counterCache fields
Re: Call Functions of another controller.
On Mar 4, 7:33 pm, Max Granados gatt...@gmail.com wrote: Hello Everyone! I want to now if someone knows how to call a function from another controller, I have already tried $results = $this-WhateverModelIs-TheModelIWantToCall- thefunctionIwanttocall($passeddata); but cake sends me this notice: Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall And I really don´t know what else can I do, I'd suggest not making up code and error messages and stating exactly what you're doing and exactly what you're getting. 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 -~--~~~~--~~--~--~---
Update related model data
Just wondering where to start when saving related model data. Links or tutorials? Basically I want to remove the functions for updating THINGS and OTHERS from the USERS_CONTROLLER and use the native THINGS_CONTROLLER and OTHERS_CONTROLLER I have 3 controllers: users_controller : right now USERS/EDIT/1 is a standard form to edit/update all the info. THINGS and OTHERS are related data updated using select boxes. things_controller: I have no code in the controller others_controller: I have no code in the controller The tables: USERS THINGS OTHERS USERS_THINGS USERS_OTHERS USERS - hasAndBelongsToMany THINGS USERS - hasAndBelongsToMany OTHERS THINGS - hasAndBelongsToMany USERS OTHERS - hasAndBelongsToMany USERS 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: Call Functions of another controller.
On Wed, Mar 4, 2009 at 4:33 PM, Max Granados gatt...@gmail.com wrote: Hello Everyone! I want to now if someone knows how to call a function from another controller, I have already tried $results = $this-WhateverModelIs-TheModelIWantToCall- thefunctionIwanttocall($passeddata); but cake sends me this notice: Notice: Undefined property: WhateverModelIs::$TheModelIWantToCall Makes sense. You're trying to call a related model to WhateverModells when your message states you're trying to call a function from another *controller* (I'm confused). You might be able to use requestAction() but it depends on what you're trying achieve (requestAction() is not always recommended, as it can affect performance when abused) - Gonzalo --~--~-~--~~~---~--~~ 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.
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 -~--~~~~--~~--~--~---
Cake performance tips
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 -~--~~~~--~~--~--~---
Re: Cake performance tips
Hint: that RC in the version identifier (1.2RC3) stands for release candidate. And the one that you have in particular is outdated by several versions. We have a final release now, and several minor releases that have come after it. That in itself is probably your main issue. On Mar 4, 3:10 pm, Javier javier.cor...@gmail.com 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 -~--~~~~--~~--~--~---
Re: Cake performance tips
Have you tried profiling your app to see where time is going? Is the bottleneck on the server side? Or is it the http requests due to your js, css, flash, images, and other client side stuff? If you come to this list with more specific information, you'll probably get a better response. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
HABTM checkboxes disappearing after validation rules applied
I have an add User page that has a set of checkboxes representing the User model's HABTM relationship to another model. On form submission, when one of the validation rules gets triggered, all the checkboxes disappear. Has anyone else encountered this problem? To get around it, I do the validation in the Users controller and resend the HABTM data on validation failure. Is this standard practice or am I missing something? 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: $javascript-link(main.js) doesn't work
Or $javascript-link('main.js', false); On Mar 4, 7:06 am, Bernardo Vieira bvieira.li...@gmail.com wrote: Try *echo *$javascript-link('*main*'); sulong wrote: Hi, I am new to cakephp. I want to add a script/script tag to the head the page. I add the ?php echo $scripts_for_layout ? in the layout's head/head block, and ?php $javascript-link(main.js); ? in the view. But I can not see any script tag in the output html. Why? --~--~-~--~~~---~--~~ 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
Use containable instead of recursive. Thatll cut down a ton of unnecessary queries. My app currently has about 30 models and 40 database tables, all using a ton of HABTM relations and it loads within 1 second. --~--~-~--~~~---~--~~ 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 Handle Tightly Coupled Database Tables?
On Mar 4, 2:05 pm, AD7six andydawso...@gmail.com wrote: When I mentioned aMySQL viewto solve the problem of calculated columns, you replied: This is called de-normalization, and is a very common thing to want to do, for many reasons, including but not limited to performance improvements and reducing code complexity. For what it's worth, creating aMySQL Viewto join the two and include calculated columns is not de-normalization. You're quoting out of context/sequence and possibly missing the point. You're right. My mistake. However, my point is still valid as I believe Nate originally incorrectly considered calculating pseudo- columns in the model s afterFind method de-normalization. In what way would using a view (if you choose) or using counterCache fields for each of your agregate fields, or a stock left join, group by and agregate function, NOT solve your question? Everything you mention is sufficient, except using counterCache. I was trying to get a sanity check to make sure I wasn't bypassing some already existing piece of Cake. Since it seems the community is divided when it comes to using views/functions in the database or using a custom query (really the same thing) I wanted to see if there really is a Cake way to do what I want. De-normalizing would certainly allow me to search and sort as I described. I know counterCache can be used to populate a voicemails.transcription_count column, but I don't know that I can use it to populate something like voicemails.transcribed_transcription_count or a boolean voicemails.has_blank_transcriptions, can I? Maybe that is the purpose of counterScope, which does not appear to be documented at book.cakephp.org. I'll check into Cake's core and unit tests to see if it would do the trick. De-normalizing also does not support a calculated column that depends on a point in time. For instance if a transcription can be locked for 15 minutes, and that 15 minute window passes, a voicemails.locked_transcription_count column is not instantly (or ever) updated. The best you could do is set up a cron job to manage these, which is not clean. A view with a calculated column (like DATEDIFF with SYSDATE) handles all of this by trading off a bit of read-time performance. I think this trade off very much outweighs the cost of development complexity to manage de-normalizing data. Thanks all for the help. But given my situation, and the lack of another clear solution that will solve every challenge I've noted, I think creating a view is going to be the best option. --~--~-~--~~~---~--~~ 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: Hi All :-)
On Wed, Mar 4, 2009 at 9:24 AM, Alfredo Quiroga-Villamil laww...@gmail.com wrote: Not a big deal Brian, I know you are cool and helpful; have seen plenty of emails coming from you helping people and suggesting ideas. I just felt bad for the guy and didn't want him to feel unwelcome. Thanks Alfredo. The fact is, though, I felt pretty bad for basically abusing the list. There was no need to send that out to everyone. I put the lame in flame. So, sorry everyone. I realised later that I should have apologised, but didn't want to drag this out. And, if anyone's talking to ira23, please ask him/her to change their blacklist setting to delete rather than bounce because I get one now every time I post to the list (thanks, lycos.com!). I got the hint.. ;-) --~--~-~--~~~---~--~~ 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: validation notEmpty
Which version are you using? On Wed, Mar 4, 2009 at 5:23 AM, kaushik kaushikwo...@gmail.com wrote: I am using following code for validating a not empty field. var $validate = array( 'blogCategoryId' = array( 'required' = array('rule' = 'notEmpty', 'message'='Please select Blog category.'), ) ); It is working properly but giving the following warning: Warning (2): preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash [CORE/cake/libs/model/model.php, line 2193] Can anyone highlight what is problem in 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: can not find javascripthelper
On Wed, Mar 4, 2009 at 2:44 AM, loong sulong1...@gmail.com wrote: Hi all, I am new to cakephp. Maybe this problem is simple, but please help me. I have a hotels_controller.php: ?php class HotelsController extends AppController { var $scaffold; var $helpers = array(Javascript); function index() { } } ? and in the /app/views/layouts/default.ctp, there is ?php echo $javascript-link(main); ? and there is an empty view /app/views/hotels/index.ctp but I get error msg: Notice (8): Undefined variable: javascript [APP\views\layouts \default.ctp, line 1581] This is because the controller's $helpers were not loaded. See below: Code | Context $___viewFn = E:\xampp\htdocs\booking\app\views\layouts\default.ctp $___dataForView = array( controller = HotelController, controllerName = Hotel, title_for_layout = Missing Controller, content_for_layout = h2Missing Controller/h2 p class=error strongError: /strong emHotelController/em could not be found./p p class=error strongError: /strong Create the class emHotelController/em below in file: app \controllers\hotel_controller.php/p pre lt;?php class HotelController extends AppController { var $name = 'Hotel'; } ?gt; /pre Cake is looking for a class named HotelController, but you have a HotelsController. The latter is the correct naming convention, though. So, it's possible that you have an incorrect route. What's the URL you're using to get to this page, and do you have a route for it? Also, do you really have more than 1581 lines in your default layout?!? I'm wondering if that's a Cake boo-boo. --~--~-~--~~~---~--~~ 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 Wed, Mar 4, 2009 at 4:17 PM, Miles J mileswjohn...@gmail.com wrote: Use containable instead of recursive. Thatll cut down a ton of unnecessary queries. My app currently has about 30 models and 40 database tables, all using a ton of HABTM relations and it loads within 1 second. I'll second that. Containable makes for a much simpler task of getting just what you want and not having to worry too much about whether a recursive level that's necessary for one model will pull in 10 others, as well. Also, run with debug = 2 to check what queries are being run, though set that to 0 when you want to test for speed. And, I should mention that I resolved an ugly slow-down in one app by realising that the problem was with Firebug, not Cake. Make sure you're profiling the right thing. --~--~-~--~~~---~--~~ 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?
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 aurel...@temporaryinbox.com 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 -~--~~~~--~~--~--~---
A better way to save to HABTM join table meta data?
I've searched through the groups and web, but I can't find any mention of SAVING to the model, only reading from it. Some example Models: Recipes HABTM Tags The recipies_tags table has an extra column which is tagger_id I have tried setting the value in $this-data before the save but this doesn't propagate back to the DB - the HABTM saves with the third column empty (I tried: $this-data['RecipiesTag']['tagger_id'] $this-data['Tag']['RecipiesTag']['tagger_id'] $this-data['Recipie']['RecipiesTag']['tagger_id'] - are there any more locations I should try?) I did find a way of saving to the third column, but it seems pretty hacky: $recipiestag = $this-Tag-RecipiesTag-find('first', array ('conditions' = array( 'RecipiesTag.tag_id' = $this-data['Tag'] ['tag_id'], 'RecipiesTag.user_id' = $this-data['User'] ['id'] ) ) ); $this-Tag-RecipiesTag-id = $recipiestag ['RecipiesTag']['id']; $this-Tag-RecipiesTag-saveField('tagger_id', $user_id); 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: Error message in Cakephp install
Do you mean that you see this on the main page, before adding any of your own models? I suspect the problem lies with your routes--is this site in a subdirectory? On Tue, Mar 3, 2009 at 10:06 PM, webdev.ahmed webdev.ah...@gmail.com wrote: Hi there while i install the cakephp this message appears Missing Database Table Error: Database table cakes for model Cake was not found. i delete the cache but there's the message also Thanks for 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: how to filter the content based on its format type
On Wed, Mar 4, 2009 at 10:58 AM, aman batra batra_aman2...@yahoo.com wrote: hello, i want to filter the data on the basis of its type i.e whether it is a document, or video or ppt, how should i do that. currently my finder query results the mix of the formats according to the condition supplied. I have an entities_controller.php which has the actions as latest, popular, browse which all result me the paginate result of entities and set a common variable for the view. and my url looks like www.abcd.com/latest for latest data www.abcd.com/popular for popular and so on now i want something like www.abcd.com/latest/vid gives me all latest videos www.abcd.com/popular/doc gives me all the popular documents and so on for rest of the actions what should i alter in my code to make it generic so that one change can do this all.. is something done in model entity.php beforeFind or any other sort of approch anyone suggests. i can send the code if wanted for this if problem is not understood. If you have a route like: Router::connect( '/latest', array( 'controller' = 'entities', 'action' = 'latest' // or whatever your method is ) ) ... you can do something like: Router::connect( '/latest/:type', array( 'controller' = 'entities', 'action' = 'latest' // or whatever your method is ), array( 'type' = '[\+\-_A-Za-z]+', // or whatever is appropriate 'pass' = array('type') ) ) Change your method signature to, eg: function latest($type = null) { If $type is not null, add it to your find conditions --~--~-~--~~~---~--~~ 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 would do that in beforeSave(). What problems were you having with that? On Wed, Mar 4, 2009 at 1:34 PM, foldiman vi...@vinceallen.com 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: What do you develop in (ide, text editor, etc.)?
Komodo :) http://www.activestate.com/komodo_edit/ On Mar 1, 10:35 pm, Samuel DeVore sdev...@gmail.com wrote: a tutu and go go boots On Sun, Mar 1, 2009 at 12:34 PM, Tomás Laureano Peralta Tormey tomas.laureano.peralta.tor...@gmail.com 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: A better way to save to HABTM join table meta data?
There is! The correct way is to set $this-data['Tag'][0] = array( 'tag_id' = $foo, 'tagger_id' = $bar ); Does this seem unintuitive to anyone else? I think updating the CakePHP Book with saving and retrieving join table data would be very helpful, as this information is hard to find On Mar 4, 10:30 pm, Omi omi.chowdh...@gmail.com wrote: I've searched through the groups and web, but I can't find any mention of SAVING to the model, only reading from it. Some example Models: Recipes HABTM Tags The recipies_tags table has an extra column which is tagger_id I have tried setting the value in $this-data before the save but this doesn't propagate back to the DB - the HABTM saves with the third column empty (I tried: $this-data['RecipiesTag']['tagger_id'] $this-data['Tag']['RecipiesTag']['tagger_id'] $this-data['Recipie']['RecipiesTag']['tagger_id'] - are there any more locations I should try?) I did find a way of saving to the third column, but it seems pretty hacky: $recipiestag = $this-Tag-RecipiesTag-find('first', array ('conditions' = array( 'RecipiesTag.tag_id' = $this-data['Tag'] ['tag_id'], 'RecipiesTag.user_id' = $this-data['User'] ['id'] ) ) ); $this-Tag-RecipiesTag-id = $recipiestag ['RecipiesTag']['id']; $this-Tag-RecipiesTag-saveField('tagger_id', $user_id); 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: A better way to save to HABTM join table meta data?
'RecipiesTag.user_id' = $this-data['User'] ['id'] should be 'RecipiesTag.recipe_id' = $this-data['Recipe'] ['id'] On Mar 4, 10:30 pm, Omi omi.chowdh...@gmail.com wrote: I've searched through the groups and web, but I can't find any mention of SAVING to the model, only reading from it. Some example Models: Recipes HABTM Tags The recipies_tags table has an extra column which is tagger_id I have tried setting the value in $this-data before the save but this doesn't propagate back to the DB - the HABTM saves with the third column empty (I tried: $this-data['RecipiesTag']['tagger_id'] $this-data['Tag']['RecipiesTag']['tagger_id'] $this-data['Recipie']['RecipiesTag']['tagger_id'] - are there any more locations I should try?) I did find a way of saving to the third column, but it seems pretty hacky: $recipiestag = $this-Tag-RecipiesTag-find('first', array ('conditions' = array( 'RecipiesTag.tag_id' = $this-data['Tag'] ['tag_id'], 'RecipiesTag.user_id' = $this-data['User'] ['id'] ) ) ); $this-Tag-RecipiesTag-id = $recipiestag ['RecipiesTag']['id']; $this-Tag-RecipiesTag-saveField('tagger_id', $user_id); 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 -~--~~~~--~~--~--~---
Add related info to model....
I'm scratching my head with this problem, that I assume is probably quite simple to resolve... I've searched the web with no luck... My application has a reseller model, and a contacts model. Each reseller can have many contacts. Thanks to Cake bake, my reseller view shows all my reseller information along with a section related contacts, and a list of all the related contacts... perfect! Now my problem is that when I click add contact below the related contacts area, it doesn't automatically figure out which supplier it is being added to, and need to select it from a drop down list. I would like the app to automatically know which supplier it is being related to. Can anyone help me with that? Thanks! -Mathieu --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom url's
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 -~--~~~~--~~--~--~---
Cannot execute javascript
I can't get to execute javascripts from CakePHP-Javascript helper. I am trying to call myscript.js from myview.ctp I have the following code lines to achieve this: In app_controller.php file: var $helpers = array('Html', 'Form', 'Javascript'); In default.ctp file header section: ?php e($javascript-link('prototype.js')); ? ?php e($scripts_for_layout); ? In myview.ctp file ?php e($javascript-link('listinvoices', false)); ? Firebug reports for both files a syntax error on line 1. Line 1 has the document declaration !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; I checked on the web and the declaration seems to be ok. When I try to read my js files content from Firebug debug panel all I get is a web page stating Missing Controller ... JcController could not be found I looked the web for the error message and found articles saying it is caused by missing .js files being called. Firebug reports the called .js files are under localhost/cake/js. I checked and both .js called are physically under C:\Inetpub\wwwroot \cake\webroot\js. Even though all my calls to views and actions work, I checked my environment variables and they seem to be Ok. [Root] = C:\Inetpub\wwwroot\cake\app\ [App] = Is empty, Do I need to assign it a value? [Www_Root] = C:\Inetpub\wwwroot\cake\app\webroot\ ) I tried to include the absolute path in the javascript helper link. Instead of ?php e($javascript-link('prototype')); ? I wrote ?php e($javascript-link('/cake/webroot/js/prototype')); ? It did not worked. I thought maybe it was an access right problem. I checked and the js folder has Read and Execute Scripts only permission and is allowed to be accessed by the IUSR_VIRTUAL-TGM user. Can anybody help me with this? I am developing from a MS Virtual Machine with the following set up: Host: MS Vista Ultimate 64 bits SP 1. Virtual Machine: OS :Windows XP Pro SP 3 build 2600 http Server : IIS 5.1 with CGI/FastCGI API PHP : 5.2.6 Cake : 1.2.18004 I am using Mod_rewrite.dll. My Mod_rewrite.ini file says: Debug 0 Reload 5000 RewriteCond HTTP_HOST localhost RewriteRule ^/cake/?$/cake/index.php?REQUEST_URI=index.php [L] RewriteRule ^(/cake/.*)$ /cake/index.php?REQUEST_URI=$1 [L] Sergio Torres --~--~-~--~~~---~--~~ 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
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 manumohed...@gmail.com 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: Why we cann't use Auth component in AppController?
Thanks all of your reply! Many appreciate! I find the problem, Model::User: function validateLogin($data){ //... } AppController::beforeFilter(){ //here I validate the login data, if(($user = $this-User-validateLogin($thid-data))){ //store this user in Session $this-Session-write('user', $user); } } UserController::login(){ //Here I validate second time and rewrite the session for this user if(($user = $this-User-validateLogin($thid-data))){ //store this user in Session $this-Session-write('user', $user); } // } My solution: Remove the validate in UserController::login(),like this: UserController::login(){ // } It works again. So is that means the Session couldn't be wrote twice? On Wed, Mar 4, 2009 at 11:44 PM, persivo_cunha ricky...@gmail.com wrote: You can put Auth in App Controller and it will work fine, and you can override it in UsersController. In this controller, you can write beforeFilter() { parent::beforeFilter(); // this line will call the AppController's beforeFilter line 1 } and after line 1, you can put new allow/deny commands and they will replace the old allow/deny. -- 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: Why we cann't use Auth component in AppController?
I just guess, maybe I should spend some time to find the really fail reason of my application. On Thu, Mar 5, 2009 at 9:25 AM, joshua josh...@gmail.com wrote: Thanks all of your reply! Many appreciate! I find the problem, Model::User: function validateLogin($data){ //... } AppController::beforeFilter(){ //here I validate the login data, if(($user = $this-User-validateLogin($thid-data))){ //store this user in Session $this-Session-write('user', $user); } } UserController::login(){ //Here I validate second time and rewrite the session for this user if(($user = $this-User-validateLogin($thid-data))){ //store this user in Session $this-Session-write('user', $user); } // } My solution: Remove the validate in UserController::login(),like this: UserController::login(){ // } It works again. So is that means the Session couldn't be wrote twice? On Wed, Mar 4, 2009 at 11:44 PM, persivo_cunha ricky...@gmail.com wrote: You can put Auth in App Controller and it will work fine, and you can override it in UsersController. In this controller, you can write beforeFilter() { parent::beforeFilter(); // this line will call the AppController's beforeFilter line 1 } and after line 1, you can put new allow/deny commands and they will replace the old allow/deny. -- Thanks Joshua -- 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: What do you develop in (ide, text editor, etc.)?
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 abennett...@sbcglobal.net 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 -~--~~~~--~~--~--~---
Re: Custom url's
have a look at http://bakery.cakephp.org/articles/view/sluggable-behavior 2009/3/5 park park@gmail.com 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 manumohed...@gmail.com 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: Add related info to model....
On Mar 4, 7:25 pm, Matt mmanai...@gmail.com wrote: I would like the app to automatically know which supplier it is being related to. You can either: a) make the id of the supplier an argument to the controller action (named or un-named) or b) insert a hidden field with the value of the supplier's id on the form containing the contacts multiple select list (or whatever form element you're using). --~--~-~--~~~---~--~~ 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?
On Mar 4, 6:52 pm, Omi omi.chowdh...@gmail.com 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: ?php 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 -~--~~~~--~~--~--~---
Re: Why we cann't use Auth component in AppController?
Your doing Auth all wrong. http://www.milesj.me/blog/read/5/using-cakephps-auth-component --~--~-~--~~~---~--~~ 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 Wed, Mar 4, 2009 at 8:09 PM, SergioTorresC. sergiotorr...@gmail.com wrote: ?php e($javascript-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. ?php e($scripts_for_layout); ? In myview.ctp file ?php e($javascript-link('listinvoices', false)); ? Firebug reports for both files a syntax error on line 1. Line 1 has the document declaration !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 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 -~--~~~~--~~--~--~---
Conditions in Controller
Question about conditions. I am updating a DIV using Ajax, I have Configure::write('debug', 2); so I can see what is being requested from the database. Now when I update the info - save I see 25 queries yet the element I was updating is independent of any of the queries being run. I am updating info in the USER profile (checkboxes) but the info being updated is their ARTISTS checkbox selection. Yet the query returns queries from AUTHORS, USER, ARTISTS, BIO tables and so on Is that normal? I thought it should only query the tables used in the update. CONTROLLER CODE: function update_artists($slug = null) { if ($this-RequestHandler-isAjax()) { $this-set('user', $this-User-findBySlug($slug)); if (!empty($this-data)) { if ($this-User-save($this-data)) { $this-view_artists($slug); } } $artists= $this-User-Artist-find('list', array('fields' = artists, 'order' = artists ASC')); $this-set(compact(artists)); } if (empty($this-data)) { $this-data = $this-User-findBySlug($slug); } } How can I set it so it only queries the tables that are relevant? Thanks, 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 -~--~~~~--~~--~--~---
Include Javascript code for one specific view. how to?
How, I dont know how to include a js file or code for one specific view. The only way I found to include js files is to do it in the layout.. Thks for the help --~--~-~--~~~---~--~~ 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: Conditions in Controller
Are the queries mostly DESCRIBE? Cake does that occasionally when debug 0. I believe it has to do with freshening the model cache. Otherwise, I'd guess it might have something to do with the fact you're running a find on an associated model. Although it's a 'list' type, maybe the assoc. has something to do with it. Actually, you'd be able to tell by looking at the order of the queries. If they're mostly after your save, then I'd think that's probably it. On Wed, Mar 4, 2009 at 11:32 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Question about conditions. I am updating a DIV using Ajax, I have Configure::write('debug', 2); so I can see what is being requested from the database. Now when I update the info - save I see 25 queries yet the element I was updating is independent of any of the queries being run. I am updating info in the USER profile (checkboxes) but the info being updated is their ARTISTS checkbox selection. Yet the query returns queries from AUTHORS, USER, ARTISTS, BIO tables and so on Is that normal? I thought it should only query the tables used in the update. CONTROLLER CODE: function update_artists($slug = null) { if ($this-RequestHandler-isAjax()) { $this-set('user', $this-User-findBySlug($slug)); if (!empty($this-data)) { if ($this-User-save($this-data)) { $this-view_artists($slug); } } $artists= $this-User-Artist-find('list', array('fields' = artists, 'order' = artists ASC')); $this-set(compact(artists)); } if (empty($this-data)) { $this-data = $this-User-findBySlug($slug); } } How can I set it so it only queries the tables that are relevant? Thanks, 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: Include Javascript code for one specific view. how to?
As long as you have $scripts_for_layout in the head of your layout file: echo $javascript-link('some_file_without_extension', false); The second param tells Cake not to write the script tag in the body (even though you're echoing), but instead pass it to $scripts_for_layout (the view is rendered before the layout wrapper). If you want a code block: echo $javascript-codeBlock($code, array('inline' = false)); Set 'inline' to true if you want the code block printed in your view instead of the head. On Thu, Mar 5, 2009 at 12:40 AM, Matthieu matthieu.aussag...@gmail.com wrote: How, I dont know how to include a js file or code for one specific view. The only way I found to include js files is to do it in the layout.. Thks for the help --~--~-~--~~~---~--~~ 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: Conditions in Controller
Hello Brian, I made the time edit to remove the describe query. For example on the USER/PROFILE page I use AJAX to let the USER edit his COUNTRY for example. The queries after the COUNTRY save are all the tables that are associated with the USER. I guess that’s normal? The USER has a quite a few hasManyAndBelongToMany and belongsTo. Is that normal then? Thanks, Dave -Original Message- From: brian [mailto:bally.z...@gmail.com] Sent: March-05-09 2:11 AM To: cake-php@googlegroups.com Subject: Re: Conditions in Controller Are the queries mostly DESCRIBE? Cake does that occasionally when debug 0. I believe it has to do with freshening the model cache. Otherwise, I'd guess it might have something to do with the fact you're running a find on an associated model. Although it's a 'list' type, maybe the assoc. has something to do with it. Actually, you'd be able to tell by looking at the order of the queries. If they're mostly after your save, then I'd think that's probably it. On Wed, Mar 4, 2009 at 11:32 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: Question about conditions. I am updating a DIV using Ajax, I have Configure::write('debug', 2); so I can see what is being requested from the database. Now when I update the info - save I see 25 queries yet the element I was updating is independent of any of the queries being run. I am updating info in the USER profile (checkboxes) but the info being updated is their ARTISTS checkbox selection. Yet the query returns queries from AUTHORS, USER, ARTISTS, BIO tables and so on Is that normal? I thought it should only query the tables used in the update. CONTROLLER CODE: function update_artists($slug = null) { if ($this-RequestHandler-isAjax()) { $this-set('user', $this-User-findBySlug($slug)); if (!empty($this-data)) { if ($this-User-save($this-data)) { $this-view_artists($slug); } } $artists= $this-User-Artist-find('list', array('fields' = artists, 'order' = artists ASC')); $this-set(compact(artists)); } if (empty($this-data)) { $this-data = $this-User-findBySlug($slug); } } How can I set it so it only queries the tables that are relevant? Thanks, 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: how to filter the content based on its format type
function latest() { $this-paginate = array('Entity'=array('fields'=array ('Entity.title','Entity.description', 'Entity.user_id','Entity.thumb_url','Entity.entity_uid', 'Entity.num_fachaks', 'Entity.number_of_views', 'Entity.rating', 'Entity.entity_ext', 'Entity.service'), 'order' = 'Entity.created DESC', 'limit'=21, 'recursive'=-1)); if (!isset($this-params['year']) || !isset($this-params['month']) || !isset($this-params['day'])) { $entities = $this-paginate('Entity', array('Entity.status'='Y', 'Entity.approved'='Y')); } else { $datestr = $this-params['year'].'-'.$this-params['month'].'-'. $this-params['day']; $date = date('Y-m-d', strtotime($datestr)); $entities = $this-paginate('Entity', array('Entity.created ='= $date, 'Entity.status'='Y', 'Entity.approved'='Y')); } $this-set('res', $entities); } this is my latest function. what should be done?? and the way u r saying is a change in every action..right?? can this be done through beforeFIND?? On Mar 5, 4:17 am, brian bally.z...@gmail.com wrote: On Wed, Mar 4, 2009 at 10:58 AM, aman batra batra_aman2...@yahoo.com wrote: hello, i want to filter the data on the basis of its type i.e whether it is a document, or video or ppt, how should i do that. currently my finder query results the mix of the formats according to the condition supplied. I have an entities_controller.php which has the actions as latest, popular, browse which all result me the paginate result of entities and set a common variable for the view. and my url looks like www.abcd.com/latestfor latest data www.abcd.com/popularfor popular and so on now i want something like www.abcd.com/latest/vidgives me all latest videos www.abcd.com/popular/docgives me all the popular documents and so on for rest of the actions what should i alter in my code to make it generic so that one change can do this all.. is something done in model entity.php beforeFind or any other sort of approch anyone suggests. i can send the code if wanted for this if problem is not understood. If you have a route like: Router::connect( '/latest', array( 'controller' = 'entities', 'action' = 'latest' // or whatever your method is ) ) ... you can do something like: Router::connect( '/latest/:type', array( 'controller' = 'entities', 'action' = 'latest' // or whatever your method is ), array( 'type' = '[\+\-_A-Za-z]+', // or whatever is appropriate 'pass' = array('type') ) ) Change your method signature to, eg: function latest($type = null) { If $type is not null, add it to your find conditions --~--~-~--~~~---~--~~ 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: Include Javascript code for one specific view. how to?
excellent, thks a lot! On Mar 5, 6:46 pm, brian bally.z...@gmail.com wrote: As long as you have $scripts_for_layout in the head of your layout file: echo $javascript-link('some_file_without_extension', false); The second param tells Cake not to write the script tag in the body (even though you're echoing), but instead pass it to $scripts_for_layout (the view is rendered before the layout wrapper). If you want a code block: echo $javascript-codeBlock($code, array('inline' = false)); Set 'inline' to true if you want the code block printed in your view instead of the head. On Thu, Mar 5, 2009 at 12:40 AM, Matthieu matthieu.aussag...@gmail.com wrote: How, I dont know how to include a js file or code for one specific view. The only way I found to include js files is to do it in the layout.. Thks for the help --~--~-~--~~~---~--~~ 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
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: ?php /** * 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: ?php 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 aidanlis...@gmail.com 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 msc...@gmail.com wrote: On Mar 3, 1:08 pm, Aidan Lister aidanlis...@gmail.com 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 -~--~~~~--~~--~--~---
Re: Why we cann't use Auth component in AppController?
Thank you, Miles. I almost made a big mistake this time. I try to modify it now. On Thu, Mar 5, 2009 at 10:50 AM, Miles J mileswjohn...@gmail.com 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
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-tp17855131p22346756.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 -~--~~~~--~~--~--~---