Re: CakePHP memcache Cache engine questions.
You probably want to call $this->SomeModelName->find('first', in controller, right? ;) --~--~-~--~~~---~--~~ 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's going on with www.cakephp.org?
When I saw some public reactions on recent team fork, first of all, I was surprised people thinks CakePHP aims to its grave. Then, I was surprised by amount of blogs who actually thinks CakePHP will die. Well, not just core developers, all tens of thousands of monthly cake downloaders and users, we all can just laugh. CakePHP doesn't need to draw an attention in any way; we just thought you will enjoy undead cake, because every single body from this community is very important to us and when we saw you're sad, we had to do something asap to put a smile on your face. Here you go - something to laugh at, but then BACK TO WORK, it is just funny design and one .po file. Although, made by 2 front CakePHP developers for you. That doesn't happen often to have them working on a joke to comfort you and wipe your tears out, you know ;) --~--~-~--~~~---~--~~ 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: Is it possible to put the vendors folder outside of cake?
# app/config/bootstrap.php (CakePHP >= 1.2) --~--~-~--~~~---~--~~ 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: Auth problem with '/' and "You are not authorized to access that location."
Url '/' points by default routes to PagesController::display(), so you should call either a) in PagesController::beforeFilter(): parent::beforeFilter(); $this->Auth->allow('display'); or b) in AppController::beforeFilter(): if ($this->name == 'Pages') { $this->Auth->allow('display'); } Your usage $this->Auth->allow('/') is wrong, this is not valid argument. --~--~-~--~~~---~--~~ 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: Poll: what do you hate about CakePHP?
> A bug, is a bug, is a bug. Feel free to repeat it indefinitely. To me, bug is a bug only if a) others are able to reproduce it and b) it is not a feature. I think you are bug, a bug, a bug, because you don't work for me. Now decide if you'll close it as wontfix, worksforme or needmoreinfo. --~--~-~--~~~---~--~~ 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: cakeapp.com
At least urls /pages/home and /test.php would deserve little something ;) --~--~-~--~~~---~--~~ 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: Related Models are an instance of AppModel
Well, debugging of it is not so hard. Start here https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/class_registry.php#L139 If I was you, I would double check filesystem permissions first - to be sure webserver can access model classes, AND is able to write to all subfolders of app/tmp and all existing files in there. --~--~-~--~~~---~--~~ 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: Translation issue
See my comment here http://groups.google.com/group/cake-php/browse_thread/thread/b477f59240d739fa/3f2a8764042fc470 --~--~-~--~~~---~--~~ 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: Related Models are an instance of AppModel
Instances of AppModel are created when cake can not find model class (feature for fast prototyping or access to tables without need of model). That could be caused by several things - improper filesystem permissions for model files, mispelled filenames or class names, disabled debug and improper cached info about paths to classes in app/ tmp/cache/persistent folder after playing with bootstrap.php: $modelPaths, after removing some symlink if used... --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
> If so - why it's like that? Is it some backward compatibility? Because > it's seems a little bit weird. I am not The One who rules whole world, my friend. And I don't like general 'why' questions too :) because I am not mindreader to be sure why it seems weird to you. Names of subfolders in app/locale folder are also not language shortcuts. If you will read my previous post carefully, you will notice word localeFallback in there - one of things which will be adressed by future releases of CakePHP, so stay tuned. > > > $pages = $this->ArticleVersion->ArticlePage->find('all', > > > > It sounds to me like you are doing it in ArticleVersion::beforeFind() > > instead of AppModel::beforeFind(), or your custom > > ArticlePage::beforeFind() is not calling parent::beforeFind(). Could > > you confirm that? > > I definitely have this AppModel::beforeFilter and have no beforeFilter > in ArticleVersion now (tried with explicit call parent::beforeFilter > in ArticleVersion::beforeFilter but it was no difference). Please, read my answer thoroughly. You are calling find() method of ArticlePage model, but still talking about changes in ArticleVersion model. And even worse: about not existing model's callback. --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
> Question: Why App.locales is better place for locales? I get it why > Config.language is a bad place. But is App.locales because there's > some convention I don't know about? Or maybe just Your ideaof place to > store this stuff? App.locales is not used by CakePHP core and just sounds reasonable/ self-explainable to me. > Now I did sth. like this: > ... > Configure::write('App.locales', > array_unique( >array_merge(Configure::read('App.locales'), >array(Configure::read > ('Config.language') ) >) > ) > ); > It's not to elegant but does what I need to be done: App.locales is an > array for sure, firs locale in App.localse array is the same as > Config.language (language which is current application language) Once again: language and locale are different things and you should not mix language and locale codes together like that. Language is 2 characters string from Configure/Session 'Config.language', initialized by autodetection or forced by application code. Locale identifier used by TranslateBehavior is longer, see L10n:: $__l10nCatalog (keys locale/localeFallback) and TranslateBehavior::_getLocale(). > > In AppModel::beforeFind() would be useful to check > > > $this->Behaviors->attached('Translate') && > > $this->Behaviors->enabled('Translate') > > Can You tell me why I should do that? Nothing important, just to initialize $locale property on models only if necessary by this snippet of code. One never knows when things like that could start biting in large applications. > I don't think that beforeFind is a good place to set the locale field, > because ... > $pages = $this->ArticleVersion->ArticlePage->find('all', > array( 'conditions' => array > ( 'ArticlePage.article_version_id'=> $article_version_id ), >'order' => 'ArticlePage.id') > ); > ArticlePage seemed to have string in a locale field and no translation > problem occured once again. > > Does it have something to do with model chain? It sounds to me like you are doing it in ArticleVersion::beforeFind() instead of AppModel::beforeFind(), or your custom ArticlePage::beforeFind() is not calling parent::beforeFind(). Could you confirm 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Translating static pages
Depends on your needs. If you need to translate whole static pages and your translators are able to translate them (means: not going to break some code in these views), then I would vote for using Controller:: $viewPath, like: class PagesController extends AppController { function beforeRender() { parent::beforeRender(); $this->viewPath .= '-' . Configure::read('Config.language'); } } and manage separate set of static pages in app/views/pages-en like folders. --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
In AppModel::beforeFind() would be useful to check $this->Behaviors->attached('Translate') && $this->Behaviors->enabled('Translate') --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
Instead of AppModel contructor, I would vote for AppModel::beforeFind () - and one thing to keep in mind: locale for translation you're looking for should be first in locale array. --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
> > > There's ArticleVersion model, which have this fields: id, name: > > > varchar, introduction:text, created:datetime. > > > > I've defined to name and introduction fields to be translatable: > > > var $actsAs = array('Translate' => array('name', 'introduction')); > > > Table for ArticleVersion model should not contain fields 'name' and > > 'introduction', these fields are virtual. > > I'd love too. But I'm not creating new App with i18n, I'm trying to > make existing App to be i18n'ed, > So I need to leave this fields because they suppose to be my default > translation as long, as translations are not present. I can imagine some solution where you will name these virtual fields like 'tr_name', but it will require to go through whole app and alter all find's called with option 'fields'... But it is Hic Sunt Leones area - TranslateBehavior was not supposed to work that way. Good news for you is that features lists for CakePHP 1.3 and 2.0 are not closed yet, so everyone is welcome open enhancement ticket at thechaw.com or express himself at http://groups.google.com/group/cake-php/browse_thread/thread/134b180ce477b9ef/12f97d91695be484 :-) Migration of existing data to i18n table is easy in shell, like var $uses = array('ArticleVersion'); function main() { if ($this->ArticleVersion->hasField('name') && $this- >ArticleVersion->hasField('introduction')) { $I18n =& $this->ArticleVersion->translateModel(); $this->ArticleVersion->unbindTranslation(); $data = $this->ArticleVersion->find('all', array('fields' => array('id', 'name', 'introduction'))); //use either foreach, or saveAll() somehow to save data through $I18n model //drop name and introduction fields in schema and clear tmp/ cache/models content } $this->out('Done.'); } > > Fastest possible way is save introduction as empty string in Quick add > > operation. > > I wanted to avoid that. When I add another field to be translatable - > need to update the Quick add operation, and > supply those translations to all elements (like I described in comment > above). Real problem is that in 1.2, behaviors are still pretty limited in sense what they can do with model, like changes in schema property. So handling default values for virtual fields, if can not be generalized in behavior to satisfy everyone, is still work for some simple beforeSave() implementation in model or AppModel. > > From controller, $this->ArticleVersion->locale = array('pol') should > > do the trick, > > I think my question should have been "But I don't know how to make > $locale variable an array globally?" ;) > > Yes, It seems to be the only way. > But It's rather $this->ArticleVersion->locale = array( Configure::read > ('Config.language') ); No, that's wrong. a) 'Config.language' in Configure singleton or session is not supposed to hold locale, it is for language (see maps in L10n class). b) 'Config.language' has to be string, it is used by i18n functions __* () > Do you think overriding the constructor in AppModel like this: >function __construct($id=null, $table=null, $ds=null) { > parent::__construct($id, $table, $ds); > $this->locale = array( Configure::read('Config.language') ); >} > Is save? Yes, but see my previous note. Call Configure::write('App.locales', array('pol', 'eng')); in bootstrap.php and use 'App.locales' in AppModel constructor. > and as a bonus: it reads those original > fields (that which should be virtual, but can't be in my case) when > there's no translation. But I don't feel comfortable when messing with > modules Ii don't completely understand :S I am just saying how is 'default translation' supposed to work currently. Usage by some way not covered in test cases is on your own risc now, and for future too :-) --~--~-~--~~~---~--~~ 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: Feedback from TranslateBehavior creator needed
> There's ArticleVersion model, which have this fields: id, name: > varchar, introduction:text, created:datetime. > > I've defined to name and introduction fields to be translatable: > var $actsAs = array('Translate' => array('name', 'introduction')); Table for ArticleVersion model should not contain fields 'name' and 'introduction', these fields are virtual. > Quick adding a new ArticleVersion is made by filling just name field > and submitting, and introduction doesn't need to be fulfilled. > ... > It returns no rows, because there's `I18n__introduction`.`locale` = > 'pol' in where statement, and the introtuction field is't saved in > Quick add operation. Fastest possible way is save introduction as empty string in Quick add operation. > But I don't know how to make $locale variable an array? >From controller, $this->ArticleVersion->locale = array('pol') should do the trick, although purpose of possibility to pass array of locales is - handle cases, where one wants record(s) preferrably in some locale, but if this translation doesn't exist, provide fallback locale (s) to use. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP validates invalid data
or $form->create('Users' instead of 'User' --~--~-~--~~~---~--~~ 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: CakePHP validates invalid data
> Array > ( > [Users] => Array It should be 'User', so it tells me you're using $form->input ('Users.email' instead of 'User.email' etc in view. --~--~-~--~~~---~--~~ 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: Poll: what do you hate about CakePHP?
'field' => 'title' --~--~-~--~~~---~--~~ 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: Poll: what do you hate about CakePHP?
> To get all the translations for all the languages is a nightmare. Solution exists. $this->Article->Behaviors->attach('Translate', array('title' => 'Title')); $article = $this->Article->find('first'); You'll get title for returned article in current locale, and also result of 'hasMany Title' association without condition on locale (therefore all existing titles of this article). Another approach would be (using the same sql queries): $this->Article->Behaviors->attach('Translate', array('title')); $I18nModel =& $this->Article->translateModel(); $article = $this->Article->find('first'); $titles = $I18nModel->find('all', array( 'conditions' => array( 'model' => 'Article', 'foreign_key' => $article['Article']['id'] ) )); --~--~-~--~~~---~--~~ 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: Translate Behavior
$label = __('Title', true); echo $form->input('Post.title.cze', array('type' => 'text', 'label' => $label . ' (cze)')); echo $form->input('Post.title.eng', array('type' => 'text', 'label' => $label . ' (eng)')); --~--~-~--~~~---~--~~ 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: Translate Behaviour and associations models
Reason is - behavior callbacks are not called on associated models. For possible solution see http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b/e46edc4db31164a5 --~--~-~--~~~---~--~~ 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 Translate Behaviour in Firefox and Internet Explorer (country code)
If following code at top of app/config/bootstrap.php doesn't show same results in both your browsers, it could be some bug in l10n autodetection - could you check that? App::import('Core', 'i18n'); $I18n =& I18n::getInstance(); $I18n->l10n->get(); die($I18n->l10n->locale); If it shows same locale all the time, then confirm you are not setting Configure::write('Config.language', ...) or $this->SomeModel->locale = ... somewhere in your code, please. --~--~-~--~~~---~--~~ 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: 1.2.2.8120 and "Undefined variable: html"
> class TestController extends Controller { Guess what is wrong in this line. --~--~-~--~~~---~--~~ 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: Little performance trick on cake 1.1.x
In short, you are looking for places where PHP5 constant and functions get_class(), get_class_vars() and get_class_methods() are used (php5 is case sensitive in their result, php4 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Little performance trick on cake 1.1.x
You discovered one of many workarounds which are necessary for PHP4. It is just one of many things which will make PHP5 only CakePHP much faster. --~--~-~--~~~---~--~~ 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: Performance different between cakephp 1.1 and 1.2
First of all, get rid of PHP Warnings > 2009-04-12 09:15:46 Warning: Warning (2): unlink(E:\AppServ\www > \project\workspace\jkchem\app\tmp\cache\persistent > \cake_core_core_paths) [function.unlink]: Permission denied in [CORE > \cake\libs\file.php, line 279] because it seems webserver doesn't have enough permissions to delete file in cache you probably copied over manually. Then resolve your mistake in code > 2009-04-12 09:25:16 Debug: Notice (8): Undefined variable: > title in [APP\views\elements\breadcrumb.ctp, line 27] and then come back to confirm if that helped, please. --~--~-~--~~~---~--~~ 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: l10n in cakephp > can't get app to switch language
> I have created two test languages in: > /app/locale/eng/LC_MESSAGES/default.php > /app/locale/fre/LC_MESSAGES/default.php php extension is reason. CakePHP assumes there plaintext .po (or preferrable binary .mo) files. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: What do you develop in (ide, text editor, etc.)?
I switched from Eclipse 3.4 and PDT2 to Netbeans 6.5 this week as well. --~--~-~--~~~---~--~~ 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 set current time for local computer
TimeHelper methods can use $userOffset. Another option (not proper/smart in your case, because it would affect time/date php functions globally, therefore also created/modified stored in db) would be date_default_timezone_set() for php >= 5.2 or date.timezone in php.ini --~--~-~--~~~---~--~~ 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 core is throwing unlink warnings
On Feb 28, 6:05 pm, RyOnLife wrote: > Lovely... I went to try this out and the warnings have vanished as > mysteriously as they first appeared. I've got this thread bookmarked and > will update again as they come back. Ok. If anyone will see this issue again, join us in #cake...@freenode please so we can chat about it in realtime. --~--~-~--~~~---~--~~ 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 core is throwing unlink warnings
I've never seen this issue before, and it is hard to reproduce it in test case if it misbehaves randomly... Try one thing, please: in cake/libs/file.php in File::delete() replace clearstatcache(); with clearstatcache(true); and let us know if that helps. --~--~-~--~~~---~--~~ 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: translate behavior
In doubts how to use something, read test cases - they're not only proving that old bugs are away, but also showing how are things supposed to be used. https://trac.cakephp.org/browser/branches/1.2.x.x/cake/tests/cases/libs/model/behaviors/translate.test.php#L305 Read this method - it deletes few translations first, and then reads translated db content using array $locale. --~--~-~--~~~---~--~~ 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: translate behavior
For 'fallback' translations, set model's $locale property to array of locales instead of string - if translation for field(s) and 1st locale in array will not be found, other ones will be tried. As of notice that returned data are using fallback locale (means - not first one in $locale array), there is currently no way how you can determine this fact (except for asking model for data with string $locale first and if it fails, try it again with array $locale), but we will probably remove this limitation in future. --~--~-~--~~~---~--~~ 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: Rendering a view without layout
$this->autoLayout = false; (in controller) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: AuthComponent doesn't work with scaffolding!
Well, and what exactly is 'not pretty' at your solution? Except for fact that it doesn't care about value in var $scaffold of current controller, off course... --~--~-~--~~~---~--~~ 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: New Cake site
If SecurityComponent is used by controller (include it in var $components is everything you need to do), security tokens are added by FormHelper automatically. Usage of SecurityComponent is highly proposed, because it blackholes request when some hidden field was modified or some fields were added/ removed in browser. --~--~-~--~~~---~--~~ 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: New Cake site
With SecurityComponent, forms contains hidden fields with security tokens. --~--~-~--~~~---~--~~ 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: New Cake site
a) use SecurityComponent b) turn debug off --~--~-~--~~~---~--~~ 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: Auth Redirect
AppController extends Controller { ... function beforeFilter() { $this->Auth->autoRedirect = false; ... } UsersController extends AppController { function login() { if ($user = $this->Auth->user()) { $url = ... $this->redirect($url); } } } --~--~-~--~~~---~--~~ 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: Timezone
Answer for display of correct date/time is here: http://api.cakephp.org/search.php?query=userOffset Scaffolding doesn't use TimeHelper. --~--~-~--~~~---~--~~ 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: Auth Broken.
Are you using scaffolding? --~--~-~--~~~---~--~~ 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: showing error after installation
I wonder why are you uploading content of app/tmp folders from your winblows development machine to unix 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: CakePHP error after uploading to server
First of all, 1.2 stable is out of kitchen. Second, read either these error messages, or documentation about installation of CakePHP. I think if you will make your app/tmp and subfolders writable for webserver, you will be just fine. --~--~-~--~~~---~--~~ 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: the Gift of 1.2 Final
Congratulations, CakePHP core team! I feel like Christmas started right now, and I really can't stop smiling :) Merry Christmas, CakePHP community! --~--~-~--~~~---~--~~ 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: Thoughts on this blog post?
I think he just likes ZF over CakePHP, don't panic. --~--~-~--~~~---~--~~ 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: More then 1 .po file for i18n/l10n
xxx.mo (or xxx.po) and yyy.mo (or yyy.po) __d('xxx', 'blabla'); or __d('yyy', 'blabla'); instead of __('blabla') --~--~-~--~~~---~--~~ 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: store i18n data in database
So, you are looking for web based editor of gettext files. I am not aware of anything what can be easily used in cake app, but fast googling told me there are some projects which one could learn from, like GGTT, phpTranslator, PHPTrans, Pootle... Do not blame me, if they will not suit your needs ;) --~--~-~--~~~---~--~~ 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: multiple custom error messages for a single validation rule - is it possible ?
> P.S as an added note can you please post an example with custom > validation where the error message is in the VIEWS and NOt in the > MODEL ? Or even better http://book.cakephp.org/view/133/Multiple-Rules-per-Field --~--~-~--~~~---~--~~ 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: multiple custom error messages for a single validation rule - is it possible ?
> Yes several rules per field was the way to go > > But my custom validation would contact a remote server and then > display an error message appropriately > > So I thought I would save on those remote calls if for single > validation rule I had the facility for displaying different error > messages > > Also I tried $this->invalidate('field', 'Error message') in my custom > validation function but only the default error message still displays If you will invalidate field val1 from inside validation method val1() AND return false, your custom message will be overwritten with default one, specified in your validation rule. You might want to implement beforeValidate() callback in your model instead of validation rule, like: function beforeValidate() { if (your condition) { $this->invalidate('val1', 'Custom error message'); return false; } return true; } With this code, and echo $form->input('val1'); // field input and error or echo $form->error('val1'); // field error in view, your custom error message will be displayed. > P.S as an added note can you please post an example with custom > validation where the error message is in the VIEWS and NOt in the > MODEL ? http://book.cakephp.org/view/198/options-error --~--~-~--~~~---~--~~ 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: multiple custom error messages for a single validation rule - is it possible ?
Why not have several validation rules for one field? var $validate = array( 'val1' => array( 'required' => array( 'rule' => VALID_NOT_EMPTY, 'required' => true, 'allowEmpty' => false, 'last' => true, 'message' => '' ), 'format' => array( 'rule' => array('val1'), 'last' => true, 'message' => 'yyy' ), 'is_unique' => array( 'rule' => array('isUnique'), 'message' => 'z' ), . ), . ); If this 'generic' and proposed approach is not good for you, you can allways (from model) call $this->invalidate('field', 'Error message'), but keep in mind that error messages are better to keep in views, then in models ('M' layer doesn't need to know about messages for humans, they are supposed to live in human interface - 'V' layer of MVC app). --~--~-~--~~~---~--~~ 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: clear cache
You can achieve same effect by function admin_clear_cache() { $cachePaths = array('js', 'css', 'menus', 'views', 'persistent', 'models'); foreach($cachePaths as $config) { clearCache(null, $config); } } --~--~-~--~~~---~--~~ 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: clear cache
> Cache::clear(); Above command clears content cached by selected cache engine. If you want to clear view cache, call clearCache(); --~--~-~--~~~---~--~~ 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: Difference between read and find
David C. Zentgraf is right. Besides other things, it allows things like if ($this->ModelName->read(..., $id)) { $this->ModelName->set(...); instead of usual $this->ModelName->id = $id; if ($this->ModelName->exists(true)) { $this->ModelName->create(...); --~--~-~--~~~---~--~~ 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: Helpers specific to certain themes
App::import('View', 'Theme'); class AdvancedThemeView extends ThemeView { function __construct(&$controller) { parent::__construct($controller); switch ($this->theme) { ... $this->helpers[] = ... --~--~-~--~~~---~--~~ 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: Custom views based on action parameters?
$this->render('view_name') is correct way and it is up to you which view name you will pass to render() method. Another way would be override render() action in your controller (and call parent method with an argument from it). --~--~-~--~~~---~--~~ 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: Getting global variables from Database in cakePHP
For example, you can - load necessary settings from db when you need them - load all settings once and use Configure::store() (also called from afterSave callback of this model), Configure::load() (called from bootstrap) and then Configure::read() where necessary - same approach as 2nd one, but with Cache::write()/read() --~--~-~--~~~---~--~~ 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: cannot inherit from undefined class appcontroller
If you have beforeFilter() method in your GroupsController (extending AppController), do you call parent::beforeFilter() from it? --~--~-~--~~~---~--~~ 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: internazionalization | gettext not working on production server: any idea?
Not enough info to tell you what is wrong there - turn debug on for a moment, there is more then a chance cake will report what is wrong. Btw - cake does not use gettext, it just uses same .po and .mo file format. --~--~-~--~~~---~--~~ 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: Passing arguments to "add" action
debug($this->passedArgs); My point is - I do not think it is necessary to use named argument for your need. --~--~-~--~~~---~--~~ 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: Passing arguments to "add" action
CONTROLLER: function add($patient_id = null) { if (empty($this->data)) { if (!empty($patient_id)) { $this->data['YourModelName']['patient_id'] = $patient_id; } } else { ... } ... } FORM: echo $form->create('YourModelName'); echo $form->hidden('patient_id'); LINK calling add() action for first time: echo $html->link('New record', array( 'controller' => 'your_controller', 'action' => 'add', // <- patient id passed as an argument to add() action )); --~--~-~--~~~---~--~~ 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: Behaviours and Parent/Child Self-Joins
Linas: Note #1: you are off topic Note #2: see http://groups.google.com/group/cake-php/browse_thread/thread/9b7e60900269643b/560dfd225009f5aa?show_docid=560dfd225009f5aa --~--~-~--~~~---~--~~ 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: Help with TranslateBehavior needed.
Nice hint :-) It is not intended behavior by design, it is just way how current implementation works. Anyway - you're not first one who brought this question up, so I think we will keep it working this way (related test case will be added soon), so you can rely on it without worries. --~--~-~--~~~---~--~~ 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: Help with TranslateBehavior needed.
It is price for performance and as simple db query as possible. If you need to know (with multiple preferred locales set) which translatios are missed, you will have to bind hasMany associations for translated fields, like var $actsAs = array('Translate' => array( 'title' => 'Titles', 'abstract' => 'Abstracts', 'text' => 'Texts' )); or $this->Service->bindTranslation(array( 'title' => 'Titles', 'abstract' => 'Abstracts', 'text' => 'Texts' ), false); and then explore returned data for these associations. Better would be validate translated data before saving (to have all fields translated, or saved with empty|default string), off course. Fact that record with missed translation is not returned (when single locale is set) is intended behavior. --~--~-~--~~~---~--~~ 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: Problems with translations and related models
It is not fault of TranslateBehavior - usage of behaviors on associated models is tricky a little bit. Let me show you one of solutions (requires CakePHP 1.2 revision > 7644) which as an addition implements golden rule of good cakes: fat model. I will follow your solution with 2 tables, although it is solvable by self-relations in one table. Note that I'll not bind hasMany association 'Names' for translated field 'name', I will set recursive to -1 and request only necessary subset of fields. Queries optimization is generally smart and with Translatebehavior, this rule should be printed as bold and gold. Model Subcategory is pretty obvious: class Subcategory extends AppModel { var $name = 'Subcategory'; var $belongsTo = 'Category'; var $actsAs = array('Translate' => 'name'); } Model Category will define new find method, which will: - optimize query for categories - fetch subcategories (hasMany records are fetched in extra query anyway and this way we will have them translated) - reindex categories array with Category.id - reindex subcategories array and group it by Subcategory.category_id - merge both arrays class Category extends AppModel { var $name = 'Category'; var $hasMany = 'Subcategory'; var $actsAs = array('Translate' => 'name'); var $_findMethods = array('translated' => true); function _findTranslated($state, $query, $results = array()) { if ($state == 'before') { return array_merge($query, array( 'fields' => array('id', 'name'), 'recursive' => -1 )); } elseif ($state == 'after') { if (empty($results)) { return $results; } $ids = Set::extract($results, '{n}.Category.id'); $data = $this->Subcategory->find('all', array( 'conditions' => array( 'Subcategory.category_id' => $ids ), 'fields' => array('id', 'category_id', 'name'), 'recursive' => -1 )); if (empty($data)) { return $results; } $data = Set::combine( $data, '{n}.Subcategory.id', '{n}.Subcategory', '{n}.Subcategory.category_id' ); $insert = array(); foreach ($data as $category_id => $subcategories) { $insert[$category_id] = array('Subcategory' => $subcategories); } $results = Set::combine($results, '{n}.Category.id', '{n}'); $results = Set::pushDiff($results, $insert); return $results; } } } In your CategoriesController: $this->set('categories', $this->Category->find('translated)); And that's all. If you will debug($categories) in view, you will find out that numeric indexes of arrays will contain PK values - it is necessary for merging them by Set::pushDiff(), like: Array ( [1] => Array ( [Category] => Array ( [id] => 1 [modified] => 2008-09-22 12:19:06 [created] => 2008-09-22 12:18:51 [locale] => en [name] => English category ) [Subcategory] => Array ( [1] => Array ( [id] => 1 [category_id] => 1 [modified] => 2008-09-22 12:19:32 [created] => 2008-09-22 12:19:32 [locale] => en [name] => English SUBcategory 1 ) [2] => Array ( [id] => 2 [category_id] => 1 [modified] => 2008-09-22 12:19:32 [created] => 2008-09-22 12:19:32 [locale] => en [name] => English SUBcategory 2 ) ) ) ) For iteration in views it doesn't matter imho... Now you can replace view code foreach ($categories as $category) { if ($category['Subcategory']) { with new version ('Subcategory' will be set only for categories with some subcategories) foreach ($categories as $category) { if (isset($category['Subcategory'])) { and you should be fine. Enjoy your cake! --~--~-~--~~~---~--~~ 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: Getting the session user_id, when login
Correct way how to obtain id of logged-in user (in controller) is $this->Auth->user('id'). Btw, correct way how to access session variables is through SessionComponent or SessionHelper. --~--~-~--~~~---~--~~ 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: Alternatives path for elements, components...
Little warning: paths to PHP classes (controllers, components, models...) are cached in tmp/cache folder, so cake have to traverse over all (app, custom and core) dirs only once. This rule doesn't apply for views/elements/ layouts. --~--~-~--~~~---~--~~ 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: Alternatives path for elements, components...
Try set $viewPaths to folder with subdir 'elements'. --~--~-~--~~~---~--~~ 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: How do I Dynamically Create a Model?
or even better: $Model =& new AppModel(array('name' => 'TimeSheet', 'table' => '2008_time_sheets')); --~--~-~--~~~---~--~~ 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: How do I Dynamically Create a Model?
$Model =& new AppModel(false, '2008_time_sheets'); --~--~-~--~~~---~--~~ 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: Alternatives path for elements, components...
> So I ask me if this feature if only limited to models, controllers > and views? If really it's limited to these three folders, could it be > extended to components, elements...? Read Configure::__loadBootstrap() - don't be afraid to read code, it is just piece of cake :) --~--~-~--~~~---~--~~ 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: Trouble with the translate function "__()"
- if you have your translations in several files like users.po/mo, posts.po/mo etc, just use proper 'text domain' as 1st argument of __d() function - if you have them in one file default.po/mo, allways use __d('default', ... Split translated texts to several files is not best solution for every project - I would propose to execute 'cake extract', select option 'save to one file', then create binary default.mo file with PoEdit, and see size of this binary file. I'm pretty sure that it's a way better to load one few_kB file, instead of seek and load 2-3 files (I doubt that your view will use translations from one text domain only). Also - from my perspective, usage of __() function is quite expensive - it uses debug_backtrace() inside (so cake knows where it was called from and can determine proper text domain). I would suggest to use __d() instead - if you know text domain used for this text idiom, off course. Also - in production, allways use binary files .mo instead of plaintext .po - they are smaller, faster, and for example - if text domain is 'users', it looks for translation files in order (until one of them is found): users.mo default.mo users.po default.po core.mo core.po >From above - if you're calling __('Username') from app/views/users/ login.ctp and you're using plaintext users.po file, EVERY call __() uses debug_backtrace() inside, and in first occurence of __() in this view seeks for users.mo, default.mo and THEN it finds && loads users.po (any later attempt to translate something from text domain 'users' - if translation is found in already parsed translations for proper text domain - will not cause searching of translation files, off course, cake reuses them). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: setting the base url for url language support
Chowsapal is right. Just little advice for you: read test case for router, it is an excellent source for learning. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Trouble with the translate function "__()"
It is not cake issue, it is Zend problem with debug_backtrace() used so deep. Try echo $form->input('username',array('label' => __d('users', 'Username',true))); 'users' means that this translation should be searched in users.mo/po, so if you have one file with all translations named default.po/mo, replace 'users' with 'default' and you should be fine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: i18n translation in db tables - how to do this like Symfony?
> I tried to set ['Article']=>['locale'] in my form in the view and in > $this->data but it did not work. You have to change (in controller) $this->Article->locale property. It defaults to null (autodetection), but you can set it to any locale string - see L10n::$__l10nMap ($locale => $language) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: /~username/ installation
> can anyone tell me if this has been there all along? Come on Tarique, you don't need anybody for exploring cakedocs project... https://cakeforge.org/plugins/scmsvn/viewcvs.php?rev=141&root=cakedocs&view=rev I am sure that you and your programmers are not reading manual (or watching changes in it) 'so often', but this part was in there when you created post in your blog, so from my perspective there is no excuse for you ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: /~username/ installation
http://manual.cakephp.org/chapter/installing Regards to your programmers! ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: /~username/ installation
RewriteBase /~username/ (btw described in manual) was not a solution? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using generateFieldNames with $actsAs (1.2 version)
'manually' means (for example): echo $form->inputs(array( 'title' => array('type' => 'string'), 'body' => array('type' => 'text') )); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using generateFieldNames with $actsAs (1.2 version)
a) Controller::generateFieldNames() is deprecated method in 1.2 b) I agree with you that TranslateBehavior is first candidate crying for missing callback loadInfo() or something similar 1.2 is not finished, we will see ;) Right now only way is: add inputs for translated fields (to view) manually - you have to decide between text and textarea anyway ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakex html inside controller
> i want to have only ONE code logic for addUser, thats why i use innerHTML to add the html code within the addUser-div only if its necessary. Do you understand what does this code? link('Add new item', '/phases/formAdd/', array('update' => 'add')); ?> It renders link, which will cause that rendered content will be not dropped, but it will be grabbed and with response->assign() assigned to innerHTML property of element with 'add' id. So only markup you should add (besides of this link) is There are other possible ways, for example create CakeX plugin, which will utilize afterRender() callback, get content of output buffer and 'append' it somewhere (instead of 'assign')... You're in CakePHP community now, so I think that CakeX does it's job well - it brings new people here ;) BUT: it is better to use another JS library with CakePHP (I prefer jQuery). I understand your position - you're familiar with xajax already and you want to utilize this knowledge as much as possible... But you should know that xajax philosophy, request flow etc is in conflict with CakePHP and CakeX code have to deal with those incompatibilities internally... With some exceptions, I am using CakeX _only_ for simple things, where I want to use beauty of xajaxResponse methods and xajax plugins - and I propose to you exactly same thing. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakex html inside controller
Well, not everything what is possible is automatically right. My propose is NOT keep any html content in controller - it is work for view. You're imho looking for link('Add new item', '/phases/formAdd/', array('update' => 'add')); ?> BTW: xajax is a great library, but it is aiming to people without php framework, as it does dispatching, basic sanitize etc. One of reasons why was CakeX written and published is: take some people from xajax community to CakePHP world ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Architecture point of view
I am not aware of any uml -> cakephp_code conversion tool. But talking about umbrello (uml.sf.net), if something like http://tech.motion-twin.com/php_php2xmi.html is possible, then it is just question of time and amount of people who will need it - and also some smart person with spared time who will sit down and 'just build it, damnit'... Maybe just plain integration with cake's command-line shells (bake) would be nice && quite easy way. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: model validation and error messages in Cake 1.2
My personal opinion is that not everything what is possible is also automatically right. I understand benefits of error messages in model, but those benefits are gone just in moment you will (for example): --- let anyone else touch your code - you can be sure they will modify messages in your models instead of adding 'error' => 'Custom message' to your inputs/errTags (or turning 'error' => true to 'error' => 'Custom message'. And I don't know how you, but I don't want anyone touch my validation rules in model ;) --- want to turn your app to multilanguage one. So you will modify your model's code, or implement some model's behavior, or customize some helper, or anything from above WITH i18n of custom messages... ...or anything else just because of wrong decision, which seemed like smart way ;) I hope you see at least one point now. From my point of view: you may say anything you want, but validation of data and error messages for humans are related, but they doesn't belong to same place. It is user who cares about stupid-proof text messages what goes wrong. With your philosophy - I am sure that you will surely end with tootip messages in model also, after your app will grow or be used by non-techs... IMHO fact that mariano is not doing it in examples of multiple validation rules in his article at bakery is for a reason. Just my 2 cents. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Best practice - multipage Form
It is matter of personal taste, off course. With FormWizardComponent all multi-page-form-requests are calling only one public method of controller. Also 'ways' in FormWizard are quite usable - for example: // ways used in InstallerController array( 'install' => array(' _installStart', '_checkFSPermissions', '_checkOrSetDbConfig', '_checkOrMakeDbStructure', '_installApp', '_recap' ), 'upgrade' => array( '_upgradeStart' '_fetchUpgradePackage', '_upgradeApp', '_recap' ) ) All of above functionality is handled by _only_ public method: InstallerController::admin_index(). -- if app is not installed yet, controller switches way to 'install' -- if app is installed and not current, controller uses way 'upgrade' -- if app is installed and current, method admin_index() just renders informational view Sure, with FormWizard every 'step' requires implement one view and 2 methods, but you don't have to care about session at all, you can use different models in different steps of your wizard (and obtain collected data any time you need them), you can easily switch 'ways', clear steps (reset wizard)... ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Router::parseExtensions();
I just found out that doc comments on mentioned method are on 15 lines (and implementation of this method is on 7 lines) of source code. Many thanks to cake developers for writing _important_ things to doc comments, even for 7-line methods. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Router::parseExtensions();
Calling Router::parseExtensions() without arguments allows _all_extensions. Try something like Router::parseExtensions('html', 'rss', 'xml'); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Switching based on browser type
First of all - if you're implementing constructor in your controller, then you have to call parent::__construct() in it. You're right - you don't have to use theming - switching of layout is good enough in most cases. But why are you switching layout in constructor instead of beforeRender() callback? And also: why not use RequestHandlerComponent::isMobile() method? ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Switching based on browser type
Possible solution for cake 1.2 could be: a) in AppController var $components = array('RequestHandler'); b) in AppController::beforeRender() switch theme in dependency of result of $this->RequestHandler->isMobile() c) let router parse extensions by call Router::parseExtensions() in app/config/routes.php That's all. Now: a) requests from mobile devices can be rendered with theme another then default b) you can call your actions like example.com/controller/action.xml (or any other supported or user-defined content type extension) and browser will obtain proper headers and rendered content will use layout and view from 'xml' subfolder (if proper views/layout exist) For 1.1 you should use ThemeView from cakeforge.org (in 1.2 it is in core) and either use 1.1 cake's built-in webservices support, or parse $this->params['url']['url'] for extension, alter $this->layoutPath and $this->viewPath in controller and send proper headers from layouts for non-html content types. I am sure there are another ways how to solve your problem, but this is way I am using. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Advice on powering a high-traffic site
Fine-tuning cake app? Do You mean besides good practices in php programming in general? - use some opcode cache - use view caching (and caching of data) as much as possible - don't query db for data you don't need - use persistent models if possible - use only those components ('components' in general sense) of your app you really need in during of every request Etc etc. Or even better: ask Cake Software Foundation for review of your application. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake php 1.2 pagination with custom query
I think that https://trac.cakephp.org/changeset/5248 could be answer for your question. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---