Re: Poll: what do you hate about CakePHP?
after so many years still too "american"! no real multi-lingual support for usage in other languages than just englisch e.g. the mb_() function problem i already pointed out 12 months ago with utf8 as default + mb_() functions there wouldn't be any trouble On 13 Mai, 11:57, majna wrote: > Think Routing.admin and prefix routing implementation is not complete. > -prefix routing ignores reverse routing and pagination > -Routing.admin accepts only one string > > maybe Routing.admin should be removed and replaced with prefix routing > completely. > > On May 8, 3:08 pm, Smelly Eddie wrote: > > > I hate that it is a powerful framework that can make the tedious work > > of developing sites a breeze. Its strict adherence to the tried and > > true MVC model is a pain point as well. Why so logical? > > > I hate the active community involvement and powerful documentation and > > API sites. I hate that people expect Cake to do every little thing. > > > It is a framework! Not a solve everything-all-in-one-cms-portal-file- > > manager-blog-forum. > > > Use the framework to create an upload component, it takes all of 5 > > minutes!! > > > On May 8, 8:56 am, "Dennis S. Hennen" wrote: > > > > Consider Post hasMany Comment > > > > Comment->find('all') returns {n}.Comment.* > > > > Post->find('all') gives you Comment.{n}.* > > > > If I want a helper to do processing on a list of comments, I have to > > > handle both potential formats, or massage the data. > > > > Related to this is the $primary parameter to the afterFind callback. > > > > Perhaps find results as objects instead of arrays? --~--~-~--~~~---~--~~ 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 validate texbox which is not related to table's field
if you want to validate by posting, it doesnt matter if those fields are in the DB or not just set up the rules and cake will validate those as well if you want to validate them directly by JS, you have to validate it manually On 16 Apr., 15:56, vikas wrote: > Hello all.. > > I have a task list page in which all task listed(simple index.ctp).. > > Now in that index.ctp i have set a two text box in which user can > enter a startdate & enddate of project respectively. and according to > that dates I show the projects. > > Now I want to validate user has enterd a valid date or not? so for > that I have to use my own javascript validation or is there inbuilt > facility in cakephp?? > > Thanx in advance.. > > vikas --~--~-~--~~~---~--~~ 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: Reserved words in CakePHP?
yeah i once proposed to change components into $this->FileComponent->foo() etc with "Component" attached to prevent this from happening but they did not care about that much in the core team at that point in time :) PS: same with helpers (conflicts between vars from controller): $poll (content array from table polls) $poll (helper) -> better: $this->poll (like inside other helpers), or at lest $pollHelper->... On 16 Apr., 06:59, John Andersen wrote: > Thanks Dr. Loboto, > That may be, but not in my case, as I don't use any components > together with my installations controller, and each model, loaded by > request, does not have any conflict with CakePHP or other parts, so to > sum it up, I am happy with that :) > Enjoy, > John > > On Apr 16, 5:36 am, "Dr. Loboto" wrote:> There can be > also conflict between models and components names (not > > classnames). > > > On Apr 16, 1:45 am, John Andersen wrote: > > > > Thanks Dardo and Teh, but it turned out to be a conflict between all > > > my models, when I loaded them all in an installations controller :) > > > Solved by loading the models only by request (ClassRegistry). > > > Enjoy, > > > John > > [snip] --~--~-~--~~~---~--~~ 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: Run an action with out a view? Is it possible?
oh, i just relized that this was your first point here^^ my mistake, overread that one On 15 Apr., 00:44, "Mark (Germany)" wrote: > you forgot one: > > $this->redirect() > > as it always ends with exit() anyway > > but the proper way without redirect would be: > > $this->autoRender = false (anywhere inside that method in the > controller) > > On 15 Apr., 00:08, Miles J wrote: > > > You can either do the following: > > > - Have the delete action redirect once the logic is finished > > - Put $this->autoRender = false; at the top of the action > > - Put an exit() at the end of the action > > > I personally would do the 1st or 2nd. --~--~-~--~~~---~--~~ 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: Run an action with out a view? Is it possible?
you forgot one: $this->redirect() as it always ends with exit() anyway but the proper way without redirect would be: $this->autoRender = false (anywhere inside that method in the controller) On 15 Apr., 00:08, Miles J wrote: > You can either do the following: > > - Have the delete action redirect once the logic is finished > - Put $this->autoRender = false; at the top of the action > - Put an exit() at the end of the action > > I personally would do the 1st or 2nd. --~--~-~--~~~---~--~~ 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: Time helper
i usually wouldn't use time->format() because it uses date() instead of strftime() the first causes problems with displaying correct i18n results when using other languages than englisch so you have to decide on your own if time->format() is gould enough for you or not On 13 Apr., 05:39, Miles J wrote: > Well if you want a custom date: > > echo $time->format('m/d/y', $timestamp); --~--~-~--~~~---~--~~ 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: Reverse "LIKE" sql statement
if you want to find an entry whith "blue": obviously: "WHERE fieldName LIKE '%blue%' " OR - if you dont want anything after the word "blue": "WHERE fieldName LIKE '%blue' " On 9 Apr., 23:07, Miles J wrote: > NOT LIKE '%term%' > > Is that what you mean? > > http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html --~--~-~--~~~---~--~~ 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: media view and files on the fly
are you sure it is app_media.php then? i only got it to work by leaving it the same name "media.php" in /app/ views/ mark On 31 Mrz., 21:45, "Mark (Germany)" wrote: > nice :) > thx > > On 31 Mrz., 15:17, Matt Curry wrote: > > > I had to do this with pdf/xls files returned by a webservice. I took > > the default media view (/cake/libs/views/media.php) and copied it to / > > app/views/app_media.php. > > > Then I modified it so that it checked for a $content view var and > > wrote that to a tmpfile. > > Here's the diff:http://bin.cakephp.org/view/1310700342 > > > -Matthttp://www.pseudocoder.com > > > On Mar 30, 1:05 pm, "Mark (Germany)" > > wrote: > > > > i tried to use the media view for files generated on thefly(some > > > exported text inside a export.txt or whatever) > > > but it seems like the media view can only handle downloads of > > > "existing" files on the server > > > > trying to rewrite it did not turn out very well > > > so, did anyone manage to create a txt file to download, that is filled > > > with the echoed content > > > > echo 'blabla' > > > or > > > $content = 'blabla' transfered to the media view > > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ 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: media view and files on the fly
nice :) thx On 31 Mrz., 15:17, Matt Curry wrote: > I had to do this with pdf/xls files returned by a webservice. I took > the default media view (/cake/libs/views/media.php) and copied it to / > app/views/app_media.php. > > Then I modified it so that it checked for a $content view var and > wrote that to a tmpfile. > Here's the diff:http://bin.cakephp.org/view/1310700342 > > -Matthttp://www.pseudocoder.com > > On Mar 30, 1:05 pm, "Mark (Germany)" > wrote: > > > i tried to use the media view for files generated on the fly (some > > exported text inside a export.txt or whatever) > > but it seems like the media view can only handle downloads of > > "existing" files on the server > > > trying to rewrite it did not turn out very well > > so, did anyone manage to create a txt file to download, that is filled > > with the echoed content > > > echo 'blabla' > > or > > $content = 'blabla' transfered to the media view > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
media view and files on the fly
i tried to use the media view for files generated on the fly (some exported text inside a export.txt or whatever) but it seems like the media view can only handle downloads of "existing" files on the server trying to rewrite it did not turn out very well so, did anyone manage to create a txt file to download, that is filled with the echoed content echo 'blabla' or $content = 'blabla' transfered to the media view without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ 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: Using MySql DB instead of PO files
i once had this idea as well but it is - as a fact - way slower than the po way AND i came up with this idea: language backend with editing/adding multiple languages to their corresponding __('textPlaceholder') and exporting it to the .po file after i am finished altering them this way it is very flexible, additional infos can be attached to the lang strings and you dont lose much speed this works only for __() of course for Database Content to be translated you could use the translate behaviour yours, mark On 26 Mrz., 16:15, Sourabh wrote: > Hi > > I am developing a multilingual site with cakePHP. > I need to use database instead of PO files to store language strings > as a requirement. > What can be the best way to do it ? > Can I override __() function if yes ,then how ? > > Thanks in advance ! > > Sourabh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: debug email address (catchall) for EmailComponent
i just made myself a new Mailer Component which extends the core one this way you can set default parameters or some debug triggers as well as some convinience functions to easily set up to, cc, etc On 18 Mrz., 16:50, brian wrote: > On Wed, Mar 18, 2009 at 6:10 AM, gianpaulo wrote: > > > How can I implement a debug email address that will be used to test > > the email sent from my application? When in debug mode, all emails > > sent using the EmailComponent will be sent to that email address. Then > > I'll also want to include in the email the intended recipients > > (to,cc,bcc, etc.) and hopefully other useful information. > > I've been defining constants in bootstrap.php, eg. EMAIL_ADMIN, etc. > But, I sometimes also need logic in my classes that checks the debug > level. Of course, even that's not bulletproof --~--~-~--~~~---~--~~ 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: combination of validation in model and behaviour?
maybe i didnt understand you in the first place do you want me to move both validation rules to the $validate? model internal and behaviorial validation rules? or only the first ones? i could try that - the beh. rules must stay though to accomplish the way this captcha is supposed to work On 20 Feb., 22:06, "Mark (Germany)" wrote: > well, this is easy - of course :) > > but i'd really apprechiate if it would be possible the way described > above > > as it is very flexible to add captchas > > in the view > > echo $captcha->input(); > > in the controller > > ...->Behaviors->attach('Captcha'); > > and the rest would be done automatically > > it works - but as i said, only after each other and not combined > maybe i need to use some other return value. > > On 19 Feb., 19:06, mscdex wrote: > > > On Feb 17, 9:56 am, "Mark (Germany)" > > wrote: > > > > hey there > > > > i tried for hours - but i can't get it to work > > > i want that the errors of the model AND of the behaviour are both > > > shown togehter (not after each other, as soon as one of them is fine). > > > Have you tried putting all of these beforeSave validation checks into > > your model's $validate array as individual validation rules? That way > > all error messages would appear on the form together (next to their > > respective form fields). --~--~-~--~~~---~--~~ 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: combination of validation in model and behaviour?
well, this is easy - of course :) but i'd really apprechiate if it would be possible the way described above as it is very flexible to add captchas in the view echo $captcha->input(); in the controller ...->Behaviors->attach('Captcha'); and the rest would be done automatically it works - but as i said, only after each other and not combined maybe i need to use some other return value. On 19 Feb., 19:06, mscdex wrote: > On Feb 17, 9:56 am, "Mark (Germany)" > wrote: > > > hey there > > > i tried for hours - but i can't get it to work > > i want that the errors of the model AND of the behaviour are both > > shown togehter (not after each other, as soon as one of them is fine). > > Have you tried putting all of these beforeSave validation checks into > your model's $validate array as individual validation rules? That way > all error messages would appear on the form together (next to their > respective form fields). --~--~-~--~~~---~--~~ 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: combination of validation in model and behaviour?
anybody an idea, how i can validate them both togehter? whatever i try, it seems to validate only one at a time On 17 Feb., 15:56, "Mark (Germany)" wrote: > hey there > > i tried for hours - but i can't get it to work > i want that the errors of the model AND of the behaviour are both > shown togehter (not after each other, as soon as one of them is fine). > > i tried it with before/afterValidate, etc, with returning queryData > and return false... all kind of possibities > > MODEL: > > function beforeSave() { > if > (!empty($this->data['RelationRequest']['new_request'])) { > if > ($this->requestExists($this->data['RelationRequest'] > ['user_id'], UID)) { > $this->invalidate('user_id','a > request is already pending - > please be patient'); > return false; > } elseif ($this->User->Relation->hasRelation > (RELATION_STATUS_BLOCKED, $this->data['RelationRequest']['user_id'], > UID)) { > $this->invalidate('user_id','you have > been blocked'); > return false; > } elseif ($this->User->Relation->hasRelation > (RELATION_STATUS_FRIENDS, $this->data['RelationRequest']['user_id'], > UID)) { > $this->invalidate('user_id','you are > already friends'); > return false; > } > } > return true; > } > > BEHAVIOUR: > > public function beforeSave(&$model, &$queryData) { > $this->model = $model; > > if > (!$this->validateCaptcha($this->model->data[$this->model->name])) > { > > $this->model->invalidate('captcha','captchaResultIncorrect'); > return false; > } > unset($this->model->data[$this->model->name]['captcha']); > unset($this->model->data[$this->model->name]['captcha_hash']); > unset($this->model->data[$this->model->name]['captcha_time']); > } > > what am i missing here? > i know that the behaviour gets triggered first - and if i return false > here, the validating of the model is skipped > if i do not return false, the form will submit successfully, even it > the captcha invalidates.. --~--~-~--~~~---~--~~ 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 display message "no record found"
if(!empty($data) {} is enough as it does not contain anything if there haven not been any found records On 18 Feb., 17:06, vikas wrote: > Ya you are right.. my problem is solved.. > 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: HTML not escaped in baked views - is this a bug?
i agree already did this with all my view templates i even tried to exclude the "id" and "foreign_id" fields (as they are keys and therefore no threats: foreach ($fields as $field) { $isKey = false; if(!empty($associations['belongsTo'])) { foreach ($associations['belongsTo'] as $alias => $details) { if($field === $details['foreignKey']) { $isKey = true; echo "\t\t\n\t\t\tlink(\${$singularVar} ['{$alias}']['{$details['displayField']}'], array('controller'=> '{$details['controller']}', 'action'=>'view', \${$singularVar} ['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\n"; break; } } } if($isKey !== true) { /** CORE-EDIT (protection against js injection by using h() function)**/ $h_b = "h("; $h_e = ")"; if ($field=='id' || (strlen($field) > 3 && substr($field, -3, 3) =='_id')) { $h_b = ""; $h_e = ""; } echo "\t\t\n\t\t\t\n\t\t\n"; /** CORE-EDIT end **/ } } TODO: exclude primaryKeys if they are called other than "id" maybe there is a nicer cleaner way - but it works^^ On 18 Feb., 16:58, mark_story wrote: > Well you can make your own bake templates, and include html escaping > there. The assumption is that you will 'harden' your app after > baking. I could see it being an enhancement. But like I said you can > make your own hardened bake files. > > -Mark > > On Feb 18, 9:37 am, Jonathan wrote: > > > Hi, > > > If you use the console to bake views like index.ctp and view.ctp, data > > is echo'ed directly like: > > > > > - I think that all output should by default be HTML-escaped to avoid > > security flaws, so the baked code should rather be something like: > > > > > What are your opinions - should this be considered a bug? > > > Regards > > > Jonathan --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
combination of validation in model and behaviour?
hey there i tried for hours - but i can't get it to work i want that the errors of the model AND of the behaviour are both shown togehter (not after each other, as soon as one of them is fine). i tried it with before/afterValidate, etc, with returning queryData and return false... all kind of possibities MODEL: function beforeSave() { if (!empty($this->data['RelationRequest']['new_request'])) { if ($this->requestExists($this->data['RelationRequest'] ['user_id'], UID)) { $this->invalidate('user_id','a request is already pending - please be patient'); return false; } elseif ($this->User->Relation->hasRelation (RELATION_STATUS_BLOCKED, $this->data['RelationRequest']['user_id'], UID)) { $this->invalidate('user_id','you have been blocked'); return false; } elseif ($this->User->Relation->hasRelation (RELATION_STATUS_FRIENDS, $this->data['RelationRequest']['user_id'], UID)) { $this->invalidate('user_id','you are already friends'); return false; } } return true; } BEHAVIOUR: public function beforeSave(&$model, &$queryData) { $this->model = $model; if (!$this->validateCaptcha($this->model->data[$this->model->name])) { $this->model->invalidate('captcha','captchaResultIncorrect'); return false; } unset($this->model->data[$this->model->name]['captcha']); unset($this->model->data[$this->model->name]['captcha_hash']); unset($this->model->data[$this->model->name]['captcha_time']); } what am i missing here? i know that the behaviour gets triggered first - and if i return false here, the validating of the model is skipped if i do not return false, the form will submit successfully, even it the captcha invalidates.. --~--~-~--~~~---~--~~ 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: containable and (left/inner) JOINS
well, great idea :) i dont know the model things in cake all too well so i have no idea why cake avoids the useful joins.. in my opinion, almost 99% of the queries could be left joins and then it would be totally easy to just change it to inner, where needed till now, i really did not care - as i had only up to 50-100 entries, maybe 300 at the most this resulted in "only" 300-500 queries, depending on how many other tables connected to it^^ but with more than thousand entries and maybe 3 BelongsTo/HasMany connections the number explodes up to many thousand queries - my database goes mad about that (understandable) this is the first time i use custom queries because i have no idea how to manage that problem - so far. On 20 Jan., 17:54, Bernardo Vieira wrote: > Maybe that's the queue to develop a new 'Joinable' behavior based on the > Containable behavior. > > Mark (Germany) wrote: > > i guess i did forget to mention that i already tried that > > but it gets totally ignored. > > > and besides this fact, i would already be happy if it would do any > > (e.g. left) join > > instead of producing many thousand queries where it would be only > > one... > > > do you have a simple approach to that one? > > with this trick "conditions->array(Model1.id=Model2._model1_id)" > > inside the containable arrays it does not work either (sql errors) > > > On 19 Jan., 19:01, rtconner wrote: > > >> I think you misunderstand what the containable does. Your complaint is > >> with model bindings in general, and not with this behavior. > > >> In any case, I'll leave you to expiriment and learn, but I wanted to > >> tell you, to do an inner join in cake you use the config.. > >> 'type'=>'INNER' in your binding definition. --~--~-~--~~~---~--~~ 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: containable and (left/inner) JOINS
i guess i did forget to mention that i already tried that but it gets totally ignored. and besides this fact, i would already be happy if it would do any (e.g. left) join instead of producing many thousand queries where it would be only one... do you have a simple approach to that one? with this trick "conditions->array(Model1.id=Model2._model1_id)" inside the containable arrays it does not work either (sql errors) On 19 Jan., 19:01, rtconner wrote: > I think you misunderstand what the containable does. Your complaint is > with model bindings in general, and not with this behavior. > > In any case, I'll leave you to expiriment and learn, but I wanted to > tell you, to do an inner join in cake you use the config.. > 'type'=>'INNER' in your binding definition. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
containable and (left/inner) JOINS
i was wondering why the containable beh. as well as many other queries are done in that very complicated way of - getting the results of the first table - use these ids for the result of the other tables with IN(x,y,z,...) instead of just using LEFT JOIN? it really gave me headache yesterday trying to use containable on "users" -> HAS MANY -> "phone_numbers" <- HAS MANY <-"numbers" besides the fact that i did not get the inner join to work here, my actual problem is the following: either way (from users down to numbers, or the other way around), it resulted in over 1200 queries (!!!) crashing my apache and database or resulting in an execution timeout error. well, there are around 2000 entries - but after setting up a manual query like this: "Select User.id, User.first_name, User.middle_name, User.last_name, Number.prefix, Number.number FROM numbers AS `Number` INNER JOIN phone_numbers AS `PhoneNumber` ON (Number.id = PhoneNumber.number_id) INNER JOIN users AS `User` ON (User.id = PhoneNumber.user_id)" i ended up in 1/1 of time needed for the cake'sh way, with the exact result i expected. is there a way to accomplish something similar using the behaviour? usually left joins always execute hundred times faster then the cakeish way described above (especially if the tables get fuller and fuller) the result with my custom query now was: Array ( [0] => Array ( [User] => Array ( [first_name] => test [last_name] => user ) [Number] => Array ( [prefix] => 123 [number] => 123456 ) ) ... ) and if several users shared the same number, or a user had several numbers they would (as an inner join would do) result in seperate entries thx :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Session trouble
always make sure that you check on or cast to whatever you need, especially reading from session! especially as type safety (as in java) is not one of PHP's strong points if it is an integer id you need to have, use (int) casting: $user_id = (int)$session->read('User.id') this way your input won't be filled with an array or something in this case, it will cast to a 0 (zero), if no valid entry was given the DB will prefer that one over just an empty string anyway for an INT field if it is a UUID, you could cast like this: $user_id = (string)$session->read('User.id') and if you want to populate a dropdown box (where you want to have an array), do this: $dropdownItems = (array)$session->read('User.roles') etc. On 8 Jan., 17:13, Steppio wrote: > Hi everybody. I've been getting gip from this cheeky little number for > a while now, was just wondering if anybody has any insights into how i > could solve this problem. > The problem is that i'm passing the lastInsertId into the session and > trying to pull it out in different views, and it works alot of the > time, but sometimes it just has a tissy fit. I keep getting > this error message when passing the ID across controller/views: > > SQL Error: 1366: Incorrect integer value: '' for column 'user_id' at > row > > The site takes the users username and password, then goes onto a > different set of controller/views for Details, then onto Duties, and > finally Terms and Conditions. I find the problem happens most when i > reload one of the pages, for instance when im adding Details and it > times-out or i just reload the page. It's sometimes as if it's not > writing correctly to the Session, but then again it works other times. > > Here's an example of how i read the session in a view: > read('User.id');?> > input('user_id', array('type' => > 'hidden', 'value' => $user_id));?> > > And in a controller: > $this->Session->read('User.id') > > Any suggestions? Any help would be greatly appreciated! > Thank you > Steppio --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
form helper for radio button list -> bug in cake?
Hey there i was wondering wheater i have been using the form->input function the wrong way here, or if this is supposed to be working.. foreach ($pollOptions as $p) { echo $form->input('Form.vote',array('type'=>'radio','options'=>array ('s'.$p['id']=>$p['name']))); //echo $form->radio('Form.vote',array($p['id']=>$p['name'])); // does not work either } always results in somethink like this: optionAoptionBoptionC note the 3 hidden inputs with id="FormVote_" and an empty value. this is sure not correct, as an ID should only exist once on a page the result is, that the content of the form only gets submitted (or validated and returned) if the last one of the above options is selected. if you select any other option, the form renders invalid, $_POST is empty and nothing is selected after page refresh. i have no security comp. on i need to loop through an array and build it up this way because each checkbox has some more stuff to be added to it (pictures and text), that does not fit into "seperator" or something like that. after all i wonder how i can set up simple radio button lists with a foreach() loop that will do the trick. thx --~--~-~--~~~---~--~~ 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: multiple [controllerName].po files + normal core.po?
anybody some idea on that? :) thx On 26 Nov., 04:13, "Mark (Germany)" <[EMAIL PROTECTED]> wrote: > Several posts and blogs have been made to similar topics > they usually end up with > use eather core.po OR multiple controllerName.po etc > > the way cake works is: > - if it finds a "domain".po, use it, abort > - if not, try to find core.po, use it, abort > > well, is there (without the need to hack into i18n.php in /cake/libs) > an easy way to > always include core.php (main translation things as "edit" "delete" > "add") > + including a controller based .po file having the specific strings > for each controller connected view? > > example, how the /LC_MESSAGES dir could look like: > > core.po (everything needed in every controller, always included) > blogs.po > posts.po > config.po > contact.po > ... > etc > > AND i probably have to add: > without having to use the domain everywhere inside the translation > strings like __('domain','string) > as this is not very usability-friendly. > they should still be of the type __('string') and just be merged from > both the core.po and the actual controller we use right now. > > maybe in the beforeFilter() method, as this one is triggered only if > some controller is used, > otherwise only the core.po file is needed for the debug/error messages > and the main layout etc. > > if it ends up to be a manual insert function, this would probably be > ok, as well.. > i reckon its gonna be like that, as i searched the internet quite > thoroughly > > thx in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: bug? or whats the matter with date fields?
only thing i can say, is that villas and Dardo Sordi Bogado were right there was no documentation on that, but now i know that it is better to avoid such naming conflicts anyway, if i ever publish a "cake Look-Out-list", this will definitly be on it i still do not know what xavier wanted to tell me :) On 10 Nov., 14:27, "Xavier Mathews" <[EMAIL PROTECTED]> wrote: > I am still over looking the problem and then i will prepare a > statement and tell you my point. > > On 11/10/2008, Mark (Germany) <[EMAIL PROTECTED]> wrote: > > > > > > > @xavier: > > what exactly is your point? :) > > > On 10 Nov., 12:12, "Mark (Germany)" <[EMAIL PROTECTED]> > > wrote: > >> well, i sure could have renamed it if i had known that it is a problem > >> a) to name a field like the model > >> b) to name it like a reserved word > > >> thx so far > > >> On 10 Nov., 02:11, "Xavier Mathews" <[EMAIL PROTECTED]> wrote: > > >> > What they said lol. If you find your self bugging with the date dont > >> > use it without debugging. > > >> > On 11/09/2008, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote: > > >> > > Avoid naming a field the same as the model and this will not happen ;) > > >> > > On Sun, Nov 9, 2008 at 8:03 PM, Mark (Germany) > >> > > <[EMAIL PROTECTED]> wrote: > > >> > >> As the pr() output shows, the processed form data on POST > >> > >> returns a devided array with the normal "Date" and a second "date" > >> > >> resulting in 2 warnings (Undefined variable: month/year) + the form > >> > >> process recognized as invalide. > > >> > >> Array > >> > >> ( > >> > >> [Date] => Array > >> > >> ( > >> > >> [user_id] => 1 > >> > >> [date_type_id] => 1 > >> > >> [date] => Array > >> > >> ( > >> > >> [day] => 09 > >> > >> ) > > >> > >> [details] => > >> > >> ) > > >> > >> [date] => Array > >> > >> ( > >> > >> [date] => Array > >> > >> ( > >> > >> [month] => 11 > >> > >> [year] => 2008 > >> > >> ) > > >> > >> ) > > >> > >> ) > > >> > >> The Form was baked by the console > > >> > >> create('Date');?> > >> > >> > >> > >> > >> > >> >> > >> echo $form->input('user_id'); > >> > >> echo $form->input('date_type_id'); > >> > >> echo $form->input('date'); > >> > >> echo $form->input('details'); > >> > >> ?> > >> > >> > >> > >> end('Submit');?> > > >> > >> I cant find the problem - the database field is of the normal "date" > >> > >> type > > >> > >> Wow.. > >> > >> After changing it to the following, it worked... > > >> > >> >> > >> echo $form->input('Date.user_id'); > >> > >> echo $form->input('Date.date_type_id'); > >> > >> echo $form->input('Date.date'); > >> > >> echo $form->input('Date.details'); > >> > >> ?> > > >> > >> So why is this neccessary if there is only that one model Date? > > >> > -- > >> > Xavier A. Mathews > >> > Student/Developer/Web-Master > >> > GG Client Based Tech Support Specialist > >> > Hazel Crest Illinois > >> > [EMAIL PROTECTED]@[EMAIL PROTECTED] > >> > "Fear of a name, only increases fear of the thing itself." > > -- > Xavier A. Mathews > Student/Developer/Web-Master > GG Client Based Tech Support Specialist > Hazel Crest Illinois > [EMAIL PROTECTED]@[EMAIL PROTECTED] > "Fear of a name, only increases fear of the thing itself." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
multiple [controllerName].po files + normal core.po?
Several posts and blogs have been made to similar topics they usually end up with use eather core.po OR multiple controllerName.po etc the way cake works is: - if it finds a "domain".po, use it, abort - if not, try to find core.po, use it, abort well, is there (without the need to hack into i18n.php in /cake/libs) an easy way to always include core.php (main translation things as "edit" "delete" "add") + including a controller based .po file having the specific strings for each controller connected view? example, how the /LC_MESSAGES dir could look like: core.po (everything needed in every controller, always included) blogs.po posts.po config.po contact.po ... etc AND i probably have to add: without having to use the domain everywhere inside the translation strings like __('domain','string) as this is not very usability-friendly. they should still be of the type __('string') and just be merged from both the core.po and the actual controller we use right now. maybe in the beforeFilter() method, as this one is triggered only if some controller is used, otherwise only the core.po file is needed for the debug/error messages and the main layout etc. if it ends up to be a manual insert function, this would probably be ok, as well.. i reckon its gonna be like that, as i searched the internet quite thoroughly thx in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: bug? or whats the matter with date fields?
@xavier: what exactly is your point? :) On 10 Nov., 12:12, "Mark (Germany)" <[EMAIL PROTECTED]> wrote: > well, i sure could have renamed it if i had known that it is a problem > a) to name a field like the model > b) to name it like a reserved word > > thx so far > > On 10 Nov., 02:11, "Xavier Mathews" <[EMAIL PROTECTED]> wrote: > > > What they said lol. If you find your self bugging with the date dont > > use it without debugging. > > > On 11/09/2008, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote: > > > > Avoid naming a field the same as the model and this will not happen ;) > > > > On Sun, Nov 9, 2008 at 8:03 PM, Mark (Germany) > > > <[EMAIL PROTECTED]> wrote: > > > >> As the pr() output shows, the processed form data on POST > > >> returns a devided array with the normal "Date" and a second "date" > > >> resulting in 2 warnings (Undefined variable: month/year) + the form > > >> process recognized as invalide. > > > >> Array > > >> ( > > >> [Date] => Array > > >> ( > > >> [user_id] => 1 > > >> [date_type_id] => 1 > > >> [date] => Array > > >> ( > > >> [day] => 09 > > >> ) > > > >> [details] => > > >> ) > > > >> [date] => Array > > >> ( > > >> [date] => Array > > >> ( > > >> [month] => 11 > > >> [year] => 2008 > > >> ) > > > >> ) > > > >> ) > > > >> The Form was baked by the console > > > >> create('Date');?> > > >> > > >> > > >> > >> echo $form->input('user_id'); > > >> echo $form->input('date_type_id'); > > >> echo $form->input('date'); > > >> echo $form->input('details'); > > >> ?> > > >> > > >> end('Submit');?> > > > >> I cant find the problem - the database field is of the normal "date" > > >> type > > > >> Wow.. > > >> After changing it to the following, it worked... > > > >> > >> echo $form->input('Date.user_id'); > > >> echo $form->input('Date.date_type_id'); > > >> echo $form->input('Date.date'); > > >> echo $form->input('Date.details'); > > >> ?> > > > >> So why is this neccessary if there is only that one model Date? > > > -- > > Xavier A. Mathews > > Student/Developer/Web-Master > > GG Client Based Tech Support Specialist > > Hazel Crest Illinois > > [EMAIL PROTECTED]@[EMAIL PROTECTED] > > "Fear of a name, only increases fear of the thing itself." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: bug? or whats the matter with date fields?
well, i sure could have renamed it if i had known that it is a problem a) to name a field like the model b) to name it like a reserved word thx so far On 10 Nov., 02:11, "Xavier Mathews" <[EMAIL PROTECTED]> wrote: > What they said lol. If you find your self bugging with the date dont > use it without debugging. > > On 11/09/2008, Dardo Sordi Bogado <[EMAIL PROTECTED]> wrote: > > > > > > > Avoid naming a field the same as the model and this will not happen ;) > > > On Sun, Nov 9, 2008 at 8:03 PM, Mark (Germany) > > <[EMAIL PROTECTED]> wrote: > > >> As the pr() output shows, the processed form data on POST > >> returns a devided array with the normal "Date" and a second "date" > >> resulting in 2 warnings (Undefined variable: month/year) + the form > >> process recognized as invalide. > > >> Array > >> ( > >> [Date] => Array > >> ( > >> [user_id] => 1 > >> [date_type_id] => 1 > >> [date] => Array > >> ( > >> [day] => 09 > >> ) > > >> [details] => > >> ) > > >> [date] => Array > >> ( > >> [date] => Array > >> ( > >> [month] => 11 > >> [year] => 2008 > >> ) > > >> ) > > >> ) > > >> The Form was baked by the console > > >> create('Date');?> > >> > >> > >> >> echo $form->input('user_id'); > >> echo $form->input('date_type_id'); > >> echo $form->input('date'); > >> echo $form->input('details'); > >> ?> > >> > >> end('Submit');?> > > >> I cant find the problem - the database field is of the normal "date" > >> type > > >> Wow.. > >> After changing it to the following, it worked... > > >> >> echo $form->input('Date.user_id'); > >> echo $form->input('Date.date_type_id'); > >> echo $form->input('Date.date'); > >> echo $form->input('Date.details'); > >> ?> > > >> So why is this neccessary if there is only that one model Date? > > -- > Xavier A. Mathews > Student/Developer/Web-Master > GG Client Based Tech Support Specialist > Hazel Crest Illinois > [EMAIL PROTECTED]@[EMAIL PROTECTED] > "Fear of a name, only increases fear of the thing itself." --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
bug? or whats the matter with date fields?
As the pr() output shows, the processed form data on POST returns a devided array with the normal "Date" and a second "date" resulting in 2 warnings (Undefined variable: month/year) + the form process recognized as invalide. Array ( [Date] => Array ( [user_id] => 1 [date_type_id] => 1 [date] => Array ( [day] => 09 ) [details] => ) [date] => Array ( [date] => Array ( [month] => 11 [year] => 2008 ) ) ) The Form was baked by the console create('Date');?> input('user_id'); echo $form->input('date_type_id'); echo $form->input('date'); echo $form->input('details'); ?> end('Submit');?> I cant find the problem - the database field is of the normal "date" type Wow.. After changing it to the following, it worked... input('Date.user_id'); echo $form->input('Date.date_type_id'); echo $form->input('Date.date'); echo $form->input('Date.details'); ?> So why is this neccessary if there is only that one model Date? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Multilingual Support still not working in RC3
i hoped this got fixed in RC3, but i had to discover, that MAX/MINLENGTH and BETWEEN are still not validating correctly although i did include the following in bootstrap: App::import('Core','Multibyte'); it does not change the normal str functions to mb_str functions i do NOT understand the usage of the "old" normal functions anyway lets say, somebody types a "german" Ä into a form that has a field which requires at least 2 characters. without proper usage of mb_ the form would return OK here, so even for all those american cake people out there, it would make sense to change to the multibyte functions anyway.. does anybody know how to get this to work? am i still missing something? as the multibyte.php and its functions should be already included now i am still at the point from 5 months ago, which means hardcoded changes in the /cake/libs/ folder in order to get it to work BEFORE: function between($check, $min, $max) { $length = strlen($check); if ($length >= $min && $length <= $max) { return true; } else { return false; } } AFTER: function between($check, $min, $max) { $length = mb_strlen($check,'UTF-8');// HACK to get it to work properly!!! if ($length >= $min && $length <= $max) { return true; } else { return false; } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Handling HTML special chars from user generated content ( e.g. forms)
i dont see the reason for changing them to HTML code anyway - as with utf8 they can all be handled and displayed as they originally are. On 28 Aug., 17:46, worthy <[EMAIL PROTECTED]> wrote: > You saved my day. :D > > I was messing with this problem the whole day and never thought it > would be that simple :). > > Thank you so much for this simple solution! > > Greetings > worthy > > On 28 Aug., 17:38, Günther Theilen <[EMAIL PROTECTED]> wrote: > > > Hi, > > > do you use the form helper? > > If so try something like this: > > > $form->input('foo.bar', array('escape' => false)) > > > Regards > > Guenther > > > worthy schrieb: > > > > Another explaining example for the edit form: > > > >http://localhost/regions/edit/15 > > > > data['Regions']['id']=15 > > > data['Regions']['name']='Test ä' > > > > Now when cakephp fills the form with this data the value of the field > > > changes from > > > > 'Test ä' to 'Test ä' > > > > And so the field shows 'Test ä instead of 'Test ä' > > > > Is there any way to tell cakephp not to check for specialchars? > > > > Maybe now there is some help? :P > > > > Greetings > > > worthy > > --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: radio buttons with form helper - lots of problems?
thx for your answers absolutly positive - adding the default value again everything is fine. the white screen i get them sometimes in connection with security component, and after some testing, it IS the security component. @RichardAtHome: the thing is, there are no logs at all! empty.. with debug = 2 and i think i know what is causing it. the checkboxes have their "hidden" input field for a certain purpose. for Cake (and its security component) mainly to recognize it as a transfered form element. as checkboxes (as well as my radio buttons) do not post any value at all if not selected so the radio buttons dont have any hidden fields - therefore submitting a form with unselected radio buttons a) validation will not work on them (as cake thinks they are not present in this form) this is important to know - as it can cause major problems if the content of the radio buttons triggers some things later on. i had validation of some other fields linked to the selection of the radio buttons. well, the problem now was, that none of them were triggered. so i had a bunch of "unvalidated" rows inserted into the database. quite a security issue on some places maybe. b) white screen of death with the security component, as the hash value created for the form field (with the radio group) does not match the transmitted fields anymore. that was the problem i pointed out above. What i did learn: NEVER use radio buttons without hidden field for the default value (hope this gets into cake core some time) use a dummy default (as i did), or chose one of the existing ones as default value. One Question: How can i use the Core Security Component without these white screens? As pointed out above, no error logs, nothing. this is not very convinient at all.. maybe some point there is a die() function invoked but i would like to get a "normal" error page with a message - and not just a dieing cake app :) On 27 Aug., 11:17, RichardAtHome <[EMAIL PROTECTED]> wrote: > What tram said... change the field to an Int. Mysql tinyint datatype > has traditionally been used to store boolean data as MySQL doesn't > have a boolean datatype. > > Alternatively, use a 1 byte char field. > > Or change your options to be > null = Pending (the database default) > 0 = Disapprove > 1 = Approve > > Or use an enum. Note: enums are mysql specific and are not directly > supported by cake. This doesn't mean you can't use them though (cake > treats them as a standard varchar field). There are some behaviours > out there that can help with enums. > > As to the white screen of death, check out the httpd error logs and > the cake error logs (app/tmp/logs/error.log) > > On Aug 26, 11:45 pm, [EMAIL PROTECTED] wrote: > > > oh cmon you dont expect good anwers when you're bashing the fw like that ? > > > cake interprets int(1) as bool , its a design choice. you are welcome > > to update the book.cakephp.org to reflect that. > > > "white screen of death" - sorry im not getting it with your code, you > > sure the radio call is causing it ? > > > On 8/27/08, Mark (Germany) <[EMAIL PROTECTED]> wrote: > > > > oh my gosh > > > cake again.. typical > > > > by using TINYINT(1) it is assumed that you have a checkbox toggle with > > > 0 and 1 as values i guess. > > > anyway, after changing it to TINYINT(2), this automagic correction is > > > no longer active > > > and my value now is -1 in the Database > > > Where in the documentation did i miss that? > > > > Are there more of these automatic corrections where a normal cake user > > > would not assume it? > > > > PS: about the white screen of death - anyway - are there any solutions > > > to it? > > > other than having to use a dummy "default"? > > > > thx mark > > > > On 26 Aug., 23:37, "Mark (Germany)" <[EMAIL PROTECTED]> > > > wrote: > > >> Well - CakePHP and Rapid Development can be two things that dont get > > >> along with each other sometimes.. :) > > >> i try for hours now... > > > >> first of all if you do not set a default value cake crashes completely > > >> - white screen of death all of the sudden: > > >> $form->input('status',array('type'=>'radio','options'=>array(1=>Disapprove', > > > >> 1=>'Approve'),'legend'=>false)); > > > >> so i was forced (i really hate that - if i am forced to workaround > > >> something) to add a dummy "pending" one: > > >> $form->input('status',array('type'=>
Re: radio buttons with form helper - lots of problems?
oh my gosh cake again.. typical by using TINYINT(1) it is assumed that you have a checkbox toggle with 0 and 1 as values i guess. anyway, after changing it to TINYINT(2), this automagic correction is no longer active and my value now is -1 in the Database Where in the documentation did i miss that? Are there more of these automatic corrections where a normal cake user would not assume it? PS: about the white screen of death - anyway - are there any solutions to it? other than having to use a dummy "default"? thx mark On 26 Aug., 23:37, "Mark (Germany)" <[EMAIL PROTECTED]> wrote: > Well - CakePHP and Rapid Development can be two things that dont get > along with each other sometimes.. :) > i try for hours now... > > first of all if you do not set a default value cake crashes completely > - white screen of death all of the sudden: > $form->input('status',array('type'=>'radio','options'=>array(1=>Disapprove', > > 1=>'Approve'),'legend'=>false)); > > so i was forced (i really hate that - if i am forced to workaround > something) to add a dummy "pending" one: > $form->input('status',array('type'=>'radio','options'=>array(0=>'Pending',-1=>Disapprove', > > 1=>'Approve'),'legend'=>false)); > > ok, so far so good, but > > in the second code sample (i tried with both integer -1 0 1 and '-1' > '0' '-1'), the -1 always gets changed to 1 when saved to the database > - i debugged it and found out, that it is (inside of $this->data) > still -1 after validation and - i did not believe it - after having > saved the fields. so cake transformes it wrongly or something when > saving it. > > the DB table setting is: > `status` tinyint(1) NOT NULL default '0' COMMENT '-1 dissap. 1 > approved', > so neg. values should be no problem... > > and the query clearly shows that it is cake's "fault": > UPDATE `role_applications` SET `id` = 2, `status` = 1, `check_text` = > 'somehting', `adminonly_text` = 'whatever', `checked_by` = 1, > `check_date` = '2008-08-26 23:34:29' WHERE `role_applications`.`id` = > 2 > > anyone an idea what is going on? > how can i use negative values for radio buttons then? > > if this goes on, i wont have any project done by the end of next > year.. > mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
radio buttons with form helper - lots of problems?
Well - CakePHP and Rapid Development can be two things that dont get along with each other sometimes.. :) i try for hours now... first of all if you do not set a default value cake crashes completely - white screen of death all of the sudden: $form- >input('status',array('type'=>'radio','options'=>array(1=>Disapprove', 1=>'Approve'),'legend'=>false)); so i was forced (i really hate that - if i am forced to workaround something) to add a dummy "pending" one: $form- >input('status',array('type'=>'radio','options'=>array(0=>'Pending',-1=>Disapprove', 1=>'Approve'),'legend'=>false)); ok, so far so good, but in the second code sample (i tried with both integer -1 0 1 and '-1' '0' '-1'), the -1 always gets changed to 1 when saved to the database - i debugged it and found out, that it is (inside of $this->data) still -1 after validation and - i did not believe it - after having saved the fields. so cake transformes it wrongly or something when saving it. the DB table setting is: `status` tinyint(1) NOT NULL default '0' COMMENT '-1 dissap. 1 approved', so neg. values should be no problem... and the query clearly shows that it is cake's "fault": UPDATE `role_applications` SET `id` = 2, `status` = 1, `check_text` = 'somehting', `adminonly_text` = 'whatever', `checked_by` = 1, `check_date` = '2008-08-26 23:34:29' WHERE `role_applications`.`id` = 2 anyone an idea what is going on? how can i use negative values for radio buttons then? if this goes on, i wont have any project done by the end of next year.. mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best practice: DB table data needed in a view helper?
thx i might actually consider that for getting the information cached file - and if not possible manually through a query the helper still needs to be a helper though but this way there is backup :) if i would just use the element without caching this could be quit a lot of more "server load" to handle as this helper (and therefore the table content) is needed on many pages. On 19 Aug., 00:49, francky06l <[EMAIL PROTECTED]> wrote: > @Mark, > > Kalt suggestion is goof for an element. You could also user an helper > and caching. The helper would check the cached file, if not there or > expired your helper can do a requestAction and cache the results for > future calls. > I use this quite a lot for fetching data for select for example (like > for a category list, not changing every 10 seconds, and avoiding > queries), and manually delete the cache when I update the tables.. > > hth > > On Aug 19, 12:38 am, Kalt <[EMAIL PROTECTED]> wrote: > > > Take a look at the "requestAction" method. > > > And instead of a helper, I think you'd better use an element. > > > On 19 août, 00:06, "Mark (Germany)" <[EMAIL PROTECTED]> > > wrote: > > > > I have a helper which needs the "codecats" table data (20-40 rows) > > > everywhere where it is used. > > > i sure could ask for it in the controller: > > > ->list('all').. > > > and pass it the view > > > there i can again pass it to the helper > > > > but is there > > > a) a way to automatically pass it from the controller to the helper > > > b) directly get the information into the helper (without having to > > > manually query the DB) > > > > i have thought about using some caching or file-exporting (xml) > > > the helper could read out this file again. > > > but - what kind of backup would there be if the file gets lost somehow > > > (as it is in temp folder the max lifetime may be over some time)? > > > or is this a good practive anyway? > > > > thats what is bothering me right now > > > as i do not know how to stick to the MVC pattern > > > > especially because this helper is not bound to specific controllers > > > and may be used quite a lot. > > > so it would be really a huge load of code if i have to do it as > > > described above: controller -> view -> helper > > > > thx > > > mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Best practice: DB table data needed in a view helper?
I have a helper which needs the "codecats" table data (20-40 rows) everywhere where it is used. i sure could ask for it in the controller: ->list('all').. and pass it the view there i can again pass it to the helper but is there a) a way to automatically pass it from the controller to the helper b) directly get the information into the helper (without having to manually query the DB) i have thought about using some caching or file-exporting (xml) the helper could read out this file again. but - what kind of backup would there be if the file gets lost somehow (as it is in temp folder the max lifetime may be over some time)? or is this a good practive anyway? thats what is bothering me right now as i do not know how to stick to the MVC pattern especially because this helper is not bound to specific controllers and may be used quite a lot. so it would be really a huge load of code if i have to do it as described above: controller -> view -> helper thx mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: What happens with CakePHP Cookbook?
and i luckily saved a copy to my hard disk :) before the cookbook crashed On 18 Jul., 09:04, Duncan <[EMAIL PROTECTED]> wrote: > I use Scrapbook:https://addons.mozilla.org/en-US/firefox/addon/427 > to take a snapshot of the all-in-one page every now and then, so I > always have an up-to-date offline version available. > > On Jul 17, 11:27 pm, Ariel Arjona <[EMAIL PROTECTED]> wrote: > > > The other option is to usehttp://book.cakephp.org/complete/3/the-manual > > to see the whole thing. > > > I think this is a good opportunity to express the need of a > > downloadable version of the manual (or at least add the table of > > contents to the above link so it's easier to navigate). Not being a > > cake expert yet the docs are my lifeline and any disruption in the > > access to them seriously impacts my productivity. My apologies for the > > rant. > > > On Jul 17, 6:22 pm, "Marcin Domanski" <[EMAIL PROTECTED]> wrote: > > > > Hey. > > > sorry - we had some problems with the database. > > > We're working on it so it should be back to normal soon. > > > For the time beeing use the search to find the sections (yeah its a > > > pain but its better than nothing :) > > > > -- > > > Marcin Domanskihttp://kabturek.info > > > > On Thu, Jul 17, 2008 at 11:27 PM, august.gresens <[EMAIL PROTECTED]> > > > wrote: > > > > > Yes, I'm noticing this as well - makes it very hard to navigate the > > > > docs. A > > > > > On Jul 17, 2:54 pm, itsnotvalid <[EMAIL PROTECTED]> wrote: > > > >> I don't know if it is just me or not,http://book.cakephp.orgseemsto > > > >> have some problems with "table of contents". Individual pages could be > > > >> reached, but the indexes are all messed up and went missing. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: ACL with multi-group membership?
i had the similar problem and ended up writing my own component/ function for it and it is now hard-coded in each view but this makes it possible to have users in several different groups. although i lost the initial way of ACL Handling.. but coundn't find a better solution On 17 Jul., 17:33, CrazyDave <[EMAIL PROTECTED]> wrote: > Thanks Stinkbug, > > I think I understand the approach you've taken. It does make sense > and might probably be the way to go if CakePHP is probably not going > to go down a similar route. ;) > > Thanks again, > Dave > > On Jul 15, 9:01 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > Not sure if this will help you out or not, but I can explain what I've > > done in our application. I thought about a way to have the same user > > under two different departments. What I really starting thinking > > about it though, I found it wasn't necessary (at least in my case). > > > I have something like this. > > > Aros > > > > Department.1 > > -User.1 > > -User.2 > > Department.2 > > -User.3 > > -User.4 > > > Acos > > > > Department.1 > > -blog > > -page > > Department.2 > > -blog > > -page > > > Now I can give Department.1 (Aro) access to Department.1 (Aco). Now, > > let's say User.1 (Aro) needs access to the same things that Department. > > 2 (Aro) has access to. Because all my Aros are grouped by Departments > > too... Even though User.1 isn't a part of the Department.2 group, I > > can still give User.1 access to the Aco Deparment.2. Now User.1 has > > access to everything that Department.2 has access to. > > > The only time I can think of where this might be a problem is if you > > wanted to give Department.2 (Aro) access to Department.3 (Aco). User. > > 1 (Aro) won't have access to it unless you say it can. It will still > > only have access to Department.2. > > > In your case you could set up a structure like this: > > > Aros > > > > Millennium Falcon > > -Crew > > --Han > > --Chewie > > -Passangers > > --Luke > > --R2D2 > > > Acos > > > > Guns > > Engines > > Lounge > > Cockpit > > > Now Crew (Aro) could have access to everything. Passangers could have > > access to Lounge. And R2D2 could have access to Guns and Engines. > > > Another good way to think about... There can't be more than one of me > > in this world. Having more than one of me would be trouble. I have > > access to my job and my office. If I get fired I shouldn't have > > access to it anymore, but if there were two of me, even though I got > > fired, I might still have access to my job and office. It's bad > > news. The same goes for the ACL. There should never be two Hans... > > there's only one, that can have access to many different things. > > > Hope that's not to confusing. Hope it helps. > > > On Jul 14, 3:34 am, CrazyDave <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I want to use the ACL component in CakePHP and have got things up and > > > running thanks to some blog posts by Mark Story and LemonCake. I do > > > have a query about the ACL and if it's capable of users belong to > > > multiple groups? > > > > I found two previous posts on the subject: > > > >http://groups.google.com/group/cake-php/browse_thread/thread/2c219ca5... > > > >http://groups.google.com/group/cake-php/browse_thread/thread/633e56e4... > > > > Both state that this isn't possible with CakePHP's ACL, has this > > > changed or will this ever change? > > > > For example (taken from phpgacl) something like this where Han is a > > > member of two groups. > > > > Default: DENY ALL > > > Millennium Falcon Passengers > > > |-Crew [ALLOW: ALL] > > > | |-Han > > > | |-Chewie [DENY: Engines] > > > |-Passengers [ALLOW: Lounge] > > > | |-Jedi [ALLOW: Cockpit] > > > | | |-Obi-wan > > > | | |-Luke [ALLOW: Guns] > > > | |-R2D2 > > > | |-C3PO > > > |-Engineers [ALLOW: Engines, Guns] > > > |-Han > > > |-R2D2 > > > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: highslide
oh my gosh i got it to work.. there was just one trailing slash missing... took me hours to get it done.. anyway.. did anybody ever used it - and created some helper class for it. i will try setting up on my own. but with all these conf. possiblities, maybe somebody already put something up. On 17 Jul., 01:45, "Mark (Germany)" <[EMAIL PROTECTED]> wrote: > hi! > did anybody try to use "highslide" along with CakePHP 1.2? > > i tried to get it to run (as usually in all the non-cake apps before) > but besides the fact, that direct links (without the starting / slash) > like "highslide/.." don't work and have to be set relativly to the > root, there might me still other things needed to get it to work. > i failed in the end. > hope somebody has made better experiences with highslide integration > > i just like it (and i dont know what would be the best alternative) > because of the many functions it provide. > as is said, in former projects i used it successfully > > thx, mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
highslide
hi! did anybody try to use "highslide" along with CakePHP 1.2? i tried to get it to run (as usually in all the non-cake apps before) but besides the fact, that direct links (without the starting / slash) like "highslide/.." don't work and have to be set relativly to the root, there might me still other things needed to get it to work. i failed in the end. hope somebody has made better experiences with highslide integration i just like it (and i dont know what would be the best alternative) because of the many functions it provide. as is said, in former projects i used it successfully thx, mark --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP and widgets
thats really a good question i would like to know that mysefl i found out though, that requesting might not be the best... the database querys went up by 30% especially if you get config details and session infos from the Database, they will be requested as often as you use this "requestAction" thing makes sense, because it includes these widgets as n external source reforcing sessionstart etc. as soon as i found out, i started to work with controllers, which get there information from the models dont know if theres a better solution but i dont wanna have 24 querys where 12 are possibly On 13 Jul., 23:01, Steve <[EMAIL PROTECTED]> wrote: > Hey, > > I was wondering what the best approach for creating widgets (type of > elements) with Cake. What I mean by widgets is basically elements that > pull data from something that may not relate to the current controller/ > action the user is in. > > For example, the default layout may have a sidebar of widgets. So when > someone is on the home page of the cake app, the sidebar may load the > following widgets on the left column sidebar as an example: > > top 5 news stories > top 10 videos > random photo > random post > > All of those "widgets" (ie: elements) would be pulling data from > several different models (news from Story, videos from Video, photo > from Photo, and so on). Is requestAction the best approach to > achieving something like this? I heard requestAction is heavy on > resources. Is there another "cake 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: setFlash - IEproblem?
now it works again - probably one of this cache-problems woud have been to weird On 13 Jul., 04:26, "Mark (Germany)" <[EMAIL PROTECTED]> wrote: > Did anyone experience the same thing? > If saved, a post will redirect to the index() > but before that, i use the $this->Session->setFlash('Saved') > > well, in the Firefox and Opera, this message always gets displayed (as > intended) > but in the IE(7) the message only shows up, if the data of the edited > post was changed.. > i needed lots of time to figure that out. > anyway, why and how does the IE do that? > i want to show the SAVED message in both cases - changed made or not... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Question about locales and their correct way of using
all right thx, didn't see that i just saw how the default pages and the scaffolded ones use this long strings but this is probably because they cant access the .po file directly this would be my next question if it is somehow possible to filter out the "new" ones and let them be added in the .po file at the bottom some kind of automatic action so to speak On 30 Jun., 17:54, Joel Perras <[EMAIL PROTECTED]> wrote: > How is this different from what the CakePHP book (http://tinyurl.com/67za2h > ) describes? You can set whatever you want for a msgid. > > -Joel. > > On Jun 28, 4:03 pm, "Mark(germany)" <[EMAIL PROTECTED]> > wrote: > > > I started to translate some of the > > "hello, nice to have you back" oder "This is the Page about Mosquitos" > > into GERMAN, etc. > > > now.. > > first of all, some of the translations can get pretty long - and have > > to be in the source code > > wouldn't it be more logic, to set short names like MESSAGE_HELLO etc > > (like its done with constants in some cms oder oscommerce etc) and > > referring to the .po file - where the complete message is? > > > __(Configure::load() - %s.php not found) > > and > > msgid "Configure::load() - %s.php not found" > > > would be > > __(CONFIG_NOTFOUND) > > and > > msgid "Configure::load() - %s.php not found" > > > this way the content of the transcription can slidly change in the > > original language (eng), without having to adapt it to the other > > languages > > the pages and templates should become smaller - and the .po file stays > > the same. > > > so if you change > > __(Configure::load() - %s.php not found) to __(Configure::load() - > > %s.php cannot be found) > > you usually have to change ALL other language files > > > with my idea you probably stick to this one change in one language > > > what i want to say is that it might be useful to stick to short and > > clear placeholder, so to speak. > > what do you say about that? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
setFlash - IEproblem?
Did anyone experience the same thing? If saved, a post will redirect to the index() but before that, i use the $this->Session->setFlash('Saved') well, in the Firefox and Opera, this message always gets displayed (as intended) but in the IE(7) the message only shows up, if the data of the edited post was changed.. i needed lots of time to figure that out. anyway, why and how does the IE do that? i want to show the SAVED message in both cases - changed made or not... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Question about locales and their correct way of using
I started to translate some of the "hello, nice to have you back" oder "This is the Page about Mosquitos" into GERMAN, etc. now.. first of all, some of the translations can get pretty long - and have to be in the source code wouldn't it be more logic, to set short names like MESSAGE_HELLO etc (like its done with constants in some cms oder oscommerce etc) and referring to the .po file - where the complete message is? __(Configure::load() - %s.php not found) and msgid "Configure::load() - %s.php not found" would be __(CONFIG_NOTFOUND) and msgid "Configure::load() - %s.php not found" this way the content of the transcription can slidly change in the original language (eng), without having to adapt it to the other languages the pages and templates should become smaller - and the .po file stays the same. so if you change __(Configure::load() - %s.php not found) to __(Configure::load() - %s.php cannot be found) you usually have to change ALL other language files with my idea you probably stick to this one change in one language what i want to say is that it might be useful to stick to short and clear placeholder, so to speak. what do you say about that? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---