Re: Am I trying to do the impossible (or impractical)?
Well that kind of worked! I have put: var $hasMany = array( 'Address' => array('className' => 'Address', 'foreignKey' => 'customer_id' ), ); var $belongsTo = array( 'Address' => array('className' => 'Address', 'foreignKey' => 'default_address_id', ), ); I am still using scaffolding while I get the structure of the site sorted, when you view a customers record it will give a link to the default address which is perfect, but where it lists the related addresses it shows lists of letters. The letters are the first letter of each field in the default address. confused? Look here: http://i126.photobucket.com/albums/p91/frenchescapes/CakePHP-therapiddevelopmentphpframe.png . The bottom two records are the addresses that are meant to be linked to the customer. Although this is not a problem because eventually I will not be using scaffolding, just a little confused as to why it is doing it! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Ajax validation vs Javascript validation?
Quick question: I need to validate a form but I don't need to compare any of the fields to the database. Is it better to use ajax validation with the model or javascript validation? and why? --~--~-~--~~~---~--~~ 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 practices for organizing tables?
Hi I've spent a lot of time designing dbs that are cke compliant.. I rather enjoy it.. If you want me to design yours i will.. Tahnk you [EMAIL PROTECTED] On Nov 29, 3:33 pm, BravoFoxtrot <[EMAIL PROTECTED]> wrote: > What are the best practices for organizing tables? > > My scenario is that I want to have a number of common tables and then > create a number of modules (plugins) that share the common tables. I > would like to keep the plugin tables organized in some way. > > For example I have the following common tables: > users > groups > login_history > > I have the following plugin tables: > quizzes > questions > answers > questions_users (HABTM) > > I want to be able to organize questions and answers. I could do this > using a prefix like quiz_questions. The problem with this method is > that it makes for long ugly table/controller/model names especially > for HATBM relationships. And I don't think the bake scripts in 1.2 > handle the relationships properly. > > I'm using postgres so I thought schemas would be a better way to go. > There is a patch herehttps://trac.cakephp.org/ticket/1623to allow > for multiple schemas and it seems to work. The problem is this may > restrict what databases I can run on and all it does is add the schema > to a search path. If two or more schemas contain the same tablename, > I'm not sure this implementation works. --~--~-~--~~~---~--~~ 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: $ajax->submit and JavaScript
At the present time, when a button which is an ajax submit is clicked, control is transferred to the JavaScript that checks for correctly populated required fields. If there is a required field that is not correctly populated, an alert box is displayed. When the alert box is closed, the ajax request proceeds with incorrect data. I want the ajax http request aborted if the JavaScript finds a problem with the data. Peter - On Nov 30, 3:52 pm, "Christopher E. Franklin, Sr." <[EMAIL PROTECTED]> wrote: > Why don't you do the validation on the same page using javascript if > you're going that route. Otherwise, you will have to use the model > validation and let the controller method complete what it needs to. > if($this->Model->create($this->data) && $this->Model->validates()) { > if($this->Model->save($this->data)) { >$this->redirect('/somewhere'); >exit; > } else { > throw new Exception("Could not save the user data!"); > }} else { > > $this->render(); > exit; > > } > > On Nov 30, 3:45 pm, peterhf <[EMAIL PROTECTED]> wrote: > > > How does one execute a JS script before the html request is made and > > halt the request based on some condition in the JS? For instance, I > > wish to check that required fields are correctly populated; if any > > required field is not correctly populated, I want to show an alert and > > return to the page without completing the http request. I am using the > > 'before' option in the submit but have not discovered how to stop the > > request from completing. > > > Thanks in advance for your suggestions. > > > Peter - --~--~-~--~~~---~--~~ 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: Default Admin Routing for Forms in 1.2 Pre Beta
Thanks a lot, people. I'll get to it on Monday and comment on the solution. On Nov 30, 2:34 am, Kalileo <[EMAIL PROTECTED]> wrote: > I have suffered the same problems, but fear not, they are solved: > > There have been a few bugs which are all been fixed in the meantime. > These fixes are already in the svn. Not in trunk though, but in > branches. Take that and it will work again. > > If you have a modern OS, such as Linux, do something like > svn cohttps://svn.cakephp.org/repo/branches/1.2.x.x > cakephp_svn_branches > or better > svn exporthttps://svn.cakephp.org/repo/branches/1.2.x.x > cakephp_svn_branches > > and it will download the latest svn branches code for you to the > subdirectory cakephp_svn_branches > > Alternatively you could search trac for the bugfixes concerning admin > routing and implement them yourself > > HTH > Kalileo > > Bruno Bergher wrote: > > Hi everyone! > > > We just moved an application we developed in 1.2.0.5427 alpha to the > > latest pre beta release. Everything worked fine except for just one > > thing: > > > In admin 'edit' actions, FormHelper is being supplied with wrong > > action URLs. With index, view, add and deletr actions, there's > > absolutely no problem. With 'edit' actions, the form is created > > without our admin path in the URL. Out 'Routing.admin' configuration > > is set to 'publisher'. > > > For example: > > When accessing through the browser URL '/publisher/posts/add', the > > form action is properly set to '/publisher/posts/add'. > > When accessing through the browser URL '/publisher/posts/edit/4', the > > form action is set to '/posts/edit/4', missing the admin portion of > > it. > > > What I have found out so far: > > > In router.php, line 676, if I replace > > $url[$admin] = true; > > with > > $url['admin'] = true; > > it works, while appending 'admin:1' to the URL. > > This is not great news, but might help. > > > If I change my 'Routing.admin' setting to 'admin' (and rename the > > controller action and view filename to admin_), it also works. > > > I believe the problem probably lies in Router::url(), line 700. The > > 'add' action sets $match to true, but the 'edit' action, for reason, > > does not. > > I havo also tried adding a mock id to the url (/publisher/posts/add/4) > > to see if it helps, but with no success. > > > We've been struggling with this for while, and any help would be > > greatly appreciated. > > > Thanks in advance! > > > Best, > > > Bruno --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> > alright it appears that the associations are working correctly, but > > the scaffolding just isn't being generated for notes. oh well I guess hey Luke, any progress? cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Update gone wrong.
On Nov 30, 2007 9:10 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote: > On Nov 30, 2007 7:33 PM, Mech7 <[EMAIL PROTECTED]> wrote: > > It still does not work.. it can't read the cache configuration.. even > > though all it is supposed to do is throw up an error and revert to > > default file caching.. > > Hrm, you have provided me with a clue here. > > I do not have the Configure::write('Cache.disable', true) command in > *my* config.php. So that trigger_error() statement in bootstrap will > never show up. I just checked and it is in cake/app/config/core.php, but I don't use that file at all. My own config/core.php file that is the app directory for my project doesn't have that line in it at all. Interesting... -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Update gone wrong.
On Nov 30, 2007 7:33 PM, Mech7 <[EMAIL PROTECTED]> wrote: > It still does not work.. it can't read the cache configuration.. even > though all it is supposed to do is throw up an error and revert to > default file caching.. Hrm, you have provided me with a clue here. I do not have the Configure::write('Cache.disable', true) command in *my* config.php. So that trigger_error() statement in bootstrap will never show up. Why do you have that in there? As far as I can tell the only cache-related stuff in core/config.php is define(CACHE_CHECK, true|false) Is there documentation out there that says to put Configure::write('Cache.disable', true) in your core.php file? -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: can't upload
Since you are using CakePHP 1.2, I suggest you to try the UploadBehaviour. There should be an article in the bakery. 2007/11/30, Dilbert <[EMAIL PROTECTED]>: > > > > On 30 Nov, 18:35, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > Check the encoding on the form, it must be "multipart/form-data". > > > > create('Model', array('type' => 'file')); ?> > > > > also check what is in > > > > > > > > 2007/11/30, Christopher E. Franklin, Sr. <[EMAIL PROTECTED]>: > > > > > > > > > Well, I guess my first question would be, are you using a browse > > > control to browse for the image on your comp or is it already on the > > > hard drive of the server some where? > > > > > Second, can you post the upload function as well? > > > > > On Nov 30, 8:34 am, Dilbert <[EMAIL PROTECTED]> wrote: > > > > I have an article model with an image field(I don't want to create > > > > another model). > > > > This is the code for admin_add > > > > > > function admin_add() { > > > > if (!empty($this->data)) { > > > > $this->cleanUpFields(); > > > > $this->Article->create(); > > > > if ($this->Article->save($this->data)) { > > > > if (!empty($this->data['Article']['image'])) > > > > { > > > > $fileup=$this->data['Article']['image']; > > > > > > > > $this->Upload->upload('$fileup','../webroot/img/ > > > > uploads/'); > > > > } > > > > $this->Session->setFlash('Article > > > > saved'); > > > > $this->redirect(array('action'=>'index'), null, true);*/ > > > > > > } else { > > > > $this->Session->setFlash('Article not > > > > saved'); > > > > } > > > > } > > > > } > > > > > > The folder uploads is 777. > > > > Where is the problem? > > > > Thank 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: 1.2 Routing question..
Thanks..getting warmer. however why does it put it as a named param in url? if I do: Router::connectNamed(array('project_name')); Router::connect('/projects/:project_name/:action/*', array('controller' => 'projects'), array('project_name' => '[-_a-zA-Z] +')); in view: echo $html->url(array('project_name'=>$projects['Project'] ['cat_name'], 'controller'=>'projects','action'=>'view')).'/'. $projects['ProjectOverview']['slug']; returns: /projects/resales/view/project_name:resales/resales.html what i'm looking for: /projects/resales/view/resales.html or even better - /projects/resales/resales.html // view action /projects/resales/overview.html // overview action /projects/resales/maps.html // map action Thanks again On Nov 30, 5:49 pm, Aaron Shafovaloff <[EMAIL PROTECTED]> wrote: > Router::connectNamed(array('project_name')); > > Router::connect('/project/:project_name/*'); > > That's a start > > On Nov 30, 1:27 pm, chad <[EMAIL PROTECTED]> wrote: > > > How could I achieve routing like so: /project/{project_name}/{action}/ > > * without any hacks in the controller? I have it working with some > > hacks in the controller but would rather make it more dynamic in the > > future and figured Router might help with that. > > > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: can't upload
On 30 Nov, 18:35, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > Check the encoding on the form, it must be "multipart/form-data". > > create('Model', array('type' => 'file')); ?> > > also check what is in > > > > 2007/11/30, Christopher E. Franklin, Sr. <[EMAIL PROTECTED]>: > > > > > Well, I guess my first question would be, are you using a browse > > control to browse for the image on your comp or is it already on the > > hard drive of the server some where? > > > Second, can you post the upload function as well? > > > On Nov 30, 8:34 am, Dilbert <[EMAIL PROTECTED]> wrote: > > > I have an article model with an image field(I don't want to create > > > another model). > > > This is the code for admin_add > > > > function admin_add() { > > > if (!empty($this->data)) { > > > $this->cleanUpFields(); > > > $this->Article->create(); > > > if ($this->Article->save($this->data)) { > > > if (!empty($this->data['Article']['image'])) > > > { > > > $fileup=$this->data['Article']['image']; > > > > > > $this->Upload->upload('$fileup','../webroot/img/ > > > uploads/'); > > > } > > > $this->Session->setFlash('Article > > > saved'); > > > $this->redirect(array('action'=>'index'), null, true);*/ > > > > } else { > > > $this->Session->setFlash('Article not > > > saved'); > > > } > > > } > > > } > > > > The folder uploads is 777. > > > Where is the problem? > > > Thank 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: Can I use model class independently?
> It's too tied into the framework itself to be used independently. I > suggest using something Propel (http://propel.phpdb.org/trac/) if you > want to add ORM to an existing project. Thank you for your advice. I prefer to use cakePHP model as ORM since I am familiar with it. It seems to be convinient for using other ORM as you suggested. Best Wishes Takuo Shiono --~--~-~--~~~---~--~~ 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: mysql_connect() fails although mySql support is enabled.
Maybe it's not loading the mysql extension. Command line php, have a different php.ini from the apache's module. Find it, then look there for mysql.so/mysql.dll You can run in a command line: php -m that will give you the list of extensions loaded by php-cli. 2007/11/29, lynch <[EMAIL PROTECTED]>: > > I think, the mysql extension is installed. > > I tested it with: > > echo PHP_VERSION . ""; > echo "XML:" . extension_loaded('xml') . ""; > echo "imap:" . extension_loaded('imap') . ""; > echo "mysql:" . extension_loaded('mysql') . ""; > echo "iconv:" . extension_loaded('iconv') . ""; > ?> > > and i got the following output. > > 5.2.5 > XML:1 > imap: > mysql:1 > iconv: > > But i still got the same mysql connect error! What could this mean? > > > > --~--~-~--~~~---~--~~ 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: Get a hasAndBelongsToMany colection a controller
Try this $his->User->recursive = 2; $this->set('data', $this->User->read(null, $id)); In the view: pr($data); // <--- data is a bad name :P 2007/11/29, bibi <[EMAIL PROTECTED]>: > > I have a model witch use a hasAndBelongsToMany collection > > class User extends AppModel > { > var $hasAndBelongsToMany = array( > 'Photo' => array('className' => 'Photo', > 'joinTable' => 'photo_users', > 'associationForeignKey' => 'User_id', > 'foreignKey' => 'Photo_id', > 'unique' => true, > 'finderQuery' => '', > 'deleteQuery' => '', > 'insertQuery' => '') > ); > > > I want to get the Photo's User in the user controller... > > class UsersController extends AppController > { > var $uses = array('User','Photo','PhotoUser'); > function view($id) > { > $this->User->setId($id); > $this->set('data', $this->User->read()); > $this->set('photos', findMyPhotos($id) ); > } > > > How can i get my photos from the user controller ? > Best regards > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Update gone wrong.
I have in webroot index.php define ('CAKE_CORE_INCLUDE_PATH', 'C:' . DS .'wamp'. DS .'www'. DS .'cake_1.2'); When i look at the framework even if cache is not configured it should fall back to th default file caching.. But still i have in core.php Cache::config('default', array('engine' => 'File')); Even with: Configure::write('Cache.disable', true); It still does not work.. it can't read the cache configuration.. even though all it is supposed to do is throw up an error and revert to default file caching.. cause if you look in bootstrap.php in the framework.. on line 51: if(Configure::read('Cache.disable') !== true) { $cache = Cache::settings(); if(empty($cache)) { trigger_error('Cache not configured properly. Please check Cache::config(); in APP/config/core.php', E_USER_WARNING); Cache::config('default', array('engine' => 'File')); } } On Nov 29, 6:21 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Nov 29, 2007 11:55 AM, Mech7 <[EMAIL PROTECTED]> wrote: > > > > > Does anybody allready solve this? even with a total new setup this > > problems still occurs.. i opened a ticket but it was closed because > > not enough info? But really how can i provide more if i don't know > > what is the problem :| > > I have no problem running my app in one directory and having cake in > another, so I have no idea what may bewronghere. > > Cache::config('default', array('engine' => 'File')); > > I did this and have no problems. > > Cake core is in Sites/cake > Applications are in Sites/ > > I changed Sites//config/core.php and added a line at the very end of > it > > Cache::config(); > > I changed Sites//webroot/index.php to have this > define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'cake'); > > Everything works just fine. No warnings, etc. > > -- > Chris Hartjes > > My motto for 2007: "Just build it, damnit!" > > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Newbie question: how do i load the javascript helper ?
Don't touch cake/ dir, copy the app_controller.php into app/, then the that one takes precedence, so tweak as needed. 2007/11/30, Eemerge <[EMAIL PROTECTED]>: > > Ok i added that line in cake/app_controller.php and so far so good. > > Thanks for the help :) > > On Nov 30, 11:41 pm, "Christopher E. Franklin, Sr." > <[EMAIL PROTECTED]> wrote: > > My bad, it's at the very end of helpers section which makes no sense > > to me since it should be at the very top. It is also in the > > controllers section: > > --- > > $helpers > > > > Use this variable to have your controller load helpers into its views. > > The HTML helper is automatically loaded, but you can use this variable > > to specify a few others: > > var $helpers = array('Html','Ajax','Javascript'); > > > > Remember that you will need to include the HtmlHelper in the $helpers > > array if you intend to use it. It is normally available by default, > > but if you define $helpers without it, you'll get error messages in > > your views. > > --- > > On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote: > > > > > Thanks for the answer, one more thing though, should i use it in every > > > controller or just the main app controller? > > > > > Christopher E. Franklin, Sr. : i will check again, though i checked > > > several times.maybe it slipped :) > > > > > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote: > > > > > > G'day > > > > > > Hopefully I'm not misunderstanding. > > > > > > In your controller, make sure you have it defined. "var $helpers = > > > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have > > > > for context. > > > > That will work for just Javascript. > > > > If you use any helpers that are not built in, just make sure you put a > > > > copy of the helper is in "app/views/helpers" and then add the name, > > > > just like you did with 'Javascript'. > > > > > > You should now have access.:-) > > > > > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > > > > > > > Sorry to ask such a newbie question, but i didnt find anything about > > > > > it in the manual. Maybe i missed it, but anyway: > > > > > > > how do i load the javascript helper? > > > --~--~-~--~~~---~--~~ 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: Need help with data relations and controlers
You can always add stuff to the array and re-save it with the same id. This overwrites the old data. Is this what you are looking for? $this->data['User']['new_field'] = 2; $this->User->save($this->data); On Nov 30, 4:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I'm very new to cakephp and I'm trying to figure out how related > tables work. Here's my question. Say I have a list of message boards > that have users connected to them in the Calendar model with the > $hasMany variable. Now, say each calendar has a contact field that > holds an email address. Whenever I add a new calendar, I want to also > add a new user from a calendars_controller.php function with the email > address from the contact field of the calendar and the calendar's id > in the calendar_id field of a user. How do I do this? > > I can figure out how to read all of the users associated with a > calendar in the calendars_controller, but I can't for the life of me, > figure out how to add new data in the users table from the > calendar_controller. Anyone have any insight? > > Thanks, Dave --~--~-~--~~~---~--~~ 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: Newbie question: how do i load the javascript helper ?
Ok i added that line in cake/app_controller.php and so far so good. Thanks for the help :) On Nov 30, 11:41 pm, "Christopher E. Franklin, Sr." <[EMAIL PROTECTED]> wrote: > My bad, it's at the very end of helpers section which makes no sense > to me since it should be at the very top. It is also in the > controllers section: > --- > $helpers > > Use this variable to have your controller load helpers into its views. > The HTML helper is automatically loaded, but you can use this variable > to specify a few others: > var $helpers = array('Html','Ajax','Javascript'); > > Remember that you will need to include the HtmlHelper in the $helpers > array if you intend to use it. It is normally available by default, > but if you define $helpers without it, you'll get error messages in > your views. > --- > On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote: > > > Thanks for the answer, one more thing though, should i use it in every > > controller or just the main app controller? > > > Christopher E. Franklin, Sr. : i will check again, though i checked > > several times.maybe it slipped :) > > > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote: > > > > G'day > > > > Hopefully I'm not misunderstanding. > > > > In your controller, make sure you have it defined. "var $helpers = > > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have > > > for context. > > > That will work for just Javascript. > > > If you use any helpers that are not built in, just make sure you put a > > > copy of the helper is in "app/views/helpers" and then add the name, > > > just like you did with 'Javascript'. > > > > You should now have access.:-) > > > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > > > > > Sorry to ask such a newbie question, but i didnt find anything about > > > > it in the manual. Maybe i missed it, but anyway: > > > > > how do i load the javascript helper? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
Hi, > I don't quite get you. that's probably because my English sucks! (I'm a Spanish speaker) > Do you mean something like this if I have a > products table with fieldname: id, productname, cat_id, and I would > need a select element under the product, where I will be able to > select the categories? > > $this->set('categories', $this->Category->generateList(null, null, > null, "{n}.categories.id", "{n}.categories.catname")); > > Do I put this under the Category Controller or Products Controller? If you have all associations set correctly, you can put in the ProductsController: $this->set('categories', $this->Product->Category->generateList(null, null, null, "{n}.Category.id", "{n}.Category.catname")); > Thanks. You're welcome. > On Dec 1, 5:41 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > I you want to use fields from associated tables, use the key/valuePath > > options in Model::generateList(), and set recursive to the apropiate > > value. > > > > 2007/11/30, Dardo Sordi Bogado <[EMAIL PROTECTED]>: > > > > > This is for fields from the same table. I don't understand what you > > > mean with "the aro aco method". > > > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > > Can this solution for fieldname within same table be used with those > > > > that are of different tables? Or do I have to use the aro aco method > > > > for that? > > > > > > Thanks. > > > > > > On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > > > > There are thre ways: > > > > > > > 1. If you are using Model::generateList(), ex: > > > > > > > // generateList ($conditions, $order, $limit, > > > > > $keyPath=, $valuePath) > > > > > $categories = $this->Category->generateList(null, null, null, null, > > > > > '{n}.Category.catname'); > > > > > > > 2. Also you can just set Model::$displayField : > > > > > > > class Category extends AppModel { > > > > > var $name = 'Category'; > > > > > var $displayField = 'catname'; > > > > > > > } > > > > > > > Then, it becomes: > > > > > > > $categories = $this->Category->generateList(); > > > > > > > 3. You can rename colmn catname to name (default displayField). > > > > > > > I think number 2 is best. > > > > > > > Dardo Sordi. > > > > > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > > > > Hi all, > > > > > > > > I am a newbie in cakePHP, and I have created a table as per below. > > > > > > > > I have 3 fields for my categories table, and would like to create a > > > > > > Select form element to insert new categories and link within the > > > > > > table > > > > > > itself(where the parent_id comes from the id). > > > > > > > > Such that it will echo the select option in this manner: > > > > > > catname, where the > > > > > > values > > > > > > of "id" and "catname" are populated from the table below. > > > > > > > > categories table: > > > > > > id > > > > > > catname > > > > > > parent_id > > > > > > > > I have tried some of the ways that will google help, but none seems > > > > > > successful, in which I could only end up with the id instead of > > > > > > catname. > > > > > > > > Please advise. Thanks in advance. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Need help with data relations and controlers
I'm very new to cakephp and I'm trying to figure out how related tables work. Here's my question. Say I have a list of message boards that have users connected to them in the Calendar model with the $hasMany variable. Now, say each calendar has a contact field that holds an email address. Whenever I add a new calendar, I want to also add a new user from a calendars_controller.php function with the email address from the contact field of the calendar and the calendar's id in the calendar_id field of a user. How do I do this? I can figure out how to read all of the users associated with a calendar in the calendars_controller, but I can't for the life of me, figure out how to add new data in the users table from the calendar_controller. Anyone have any insight? Thanks, Dave --~--~-~--~~~---~--~~ 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: Newby questions part 2: custom query for pagination
Implement paginate() and paginateCount() in the model with your custom querys. 2007/11/30, Bram <[EMAIL PROTECTED]>: > > Hi all, > > Here comes part 2 of my newby questions serie. > > I've a model called Company that has multiple ratings. The rating > contains a number from 1 to 5. The rating of the company is calculated > using an avg() on the rating field of all ratings. In the view of 1 > company, I'm doing this with a custom mysql query. In the paginated > listing of companies, I would like to display the rating also and be > able to sort on in. So, what would be the best way to do this using > Cakephp 1.2? I saw a few pointers to changing findAll and such, but I > would like to know what's the best way to do this at the moment. > > Bram > > > > --~--~-~--~~~---~--~~ 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: $ajax->submit and JavaScript
Why don't you do the validation on the same page using javascript if you're going that route. Otherwise, you will have to use the model validation and let the controller method complete what it needs to. if($this->Model->create($this->data) && $this->Model->validates()) { if($this->Model->save($this->data)) { $this->redirect('/somewhere'); exit; } else { throw new Exception("Could not save the user data!"); } } else { $this->render(); exit; } On Nov 30, 3:45 pm, peterhf <[EMAIL PROTECTED]> wrote: > How does one execute a JS script before the html request is made and > halt the request based on some condition in the JS? For instance, I > wish to check that required fields are correctly populated; if any > required field is not correctly populated, I want to show an alert and > return to the page without completing the http request. I am using the > 'before' option in the submit but have not discovered how to stop the > request from completing. > > Thanks in advance for your suggestions. > > Peter - --~--~-~--~~~---~--~~ 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: Accessing data stored on other server
Well, what I am thinking is this: You know how you can display an image on your page from another site? Why not try that? I know it works as long as the folder on the other site is not protected. If it is, and you must get the file through a php page, just put the swf source url as the php page as long as the php page sends the headers to you as the correct mime type. I do this with images all the time to protect them. and in the php page I check the referrer and then send the headers: header("Content-type: {$sql['mime']}"); On Nov 30, 3:01 pm, "Novice Programmer" <[EMAIL PROTECTED]> wrote: > Hello guys, > > actually i have stored some SWFs on one web server...but the index page of > the site is not on that server... > the php page where these swfs will be embedded is on some other server.. > what are the possibilities of using the swfs on other server from this one.. > I guess i can't directly accesses files on the other server directly. Can > some one help? > > -- > Thanks & Regards, > Novice (http://ishuonweb.wordpress.com/). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
$ajax->submit and JavaScript
How does one execute a JS script before the html request is made and halt the request based on some condition in the JS? For instance, I wish to check that required fields are correctly populated; if any required field is not correctly populated, I want to show an alert and return to the page without completing the http request. I am using the 'before' option in the submit but have not discovered how to stop the request from completing. Thanks in advance for your suggestions. Peter - --~--~-~--~~~---~--~~ 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: Newbie question: how do i load the javascript helper ?
My bad, it's at the very end of helpers section which makes no sense to me since it should be at the very top. It is also in the controllers section: --- $helpers Use this variable to have your controller load helpers into its views. The HTML helper is automatically loaded, but you can use this variable to specify a few others: var $helpers = array('Html','Ajax','Javascript'); Remember that you will need to include the HtmlHelper in the $helpers array if you intend to use it. It is normally available by default, but if you define $helpers without it, you'll get error messages in your views. --- On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote: > Thanks for the answer, one more thing though, should i use it in every > controller or just the main app controller? > > Christopher E. Franklin, Sr. : i will check again, though i checked > several times.maybe it slipped :) > > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote: > > > G'day > > > Hopefully I'm not misunderstanding. > > > In your controller, make sure you have it defined. "var $helpers = > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have > > for context. > > That will work for just Javascript. > > If you use any helpers that are not built in, just make sure you put a > > copy of the helper is in "app/views/helpers" and then add the name, > > just like you did with 'Javascript'. > > > You should now have access.:-) > > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > > > > Sorry to ask such a newbie question, but i didnt find anything about > > > it in the manual. Maybe i missed it, but anyway: > > > > how do i load the javascript helper? --~--~-~--~~~---~--~~ 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: Input field read only
I just noticed by your code that you are using 1.1 of cake. Dunno what changes have been made since I have been in that branch but, the array('disabled' => true); works in 1.2... Sorry I didn't notice sooner On Nov 30, 10:48 am, Brian <[EMAIL PROTECTED]> wrote: > I just noticed that none of the parameters being passed in the array > are being used? What would cause that? > > On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > > > this doesn't work either: > > > > inputTag('Employee/start_date', array('size' => '4 > > > 0', 'disabled' => true)) ?> > > > Have you thought about using a hidden field and simply displaying the data? > > > -- > > Chris Hartjes > > > My motto for 2007: "Just build it, damnit!" > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Accessing data stored on other server
Hello guys, actually i have stored some SWFs on one web server...but the index page of the site is not on that server... the php page where these swfs will be embedded is on some other server.. what are the possibilities of using the swfs on other server from this one.. I guess i can't directly accesses files on the other server directly. Can some one help? -- Thanks & Regards, Novice (http://ishuonweb.wordpress.com/). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Newby questions part 2: custom query for pagination
Hi all, Here comes part 2 of my newby questions serie. I've a model called Company that has multiple ratings. The rating contains a number from 1 to 5. The rating of the company is calculated using an avg() on the rating field of all ratings. In the view of 1 company, I'm doing this with a custom mysql query. In the paginated listing of companies, I would like to display the rating also and be able to sort on in. So, what would be the best way to do this using Cakephp 1.2? I saw a few pointers to changing findAll and such, but I would like to know what's the best way to do this at the moment. Bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.2 Routing question..
Router::connectNamed(array('project_name')); Router::connect('/project/:project_name/*'); That's a start On Nov 30, 1:27 pm, chad <[EMAIL PROTECTED]> wrote: > How could I achieve routing like so: /project/{project_name}/{action}/ > * without any hacks in the controller? I have it working with some > hacks in the controller but would rather make it more dynamic in the > future and figured Router might help with that. > > Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Some newbie questions part 1: showing form for a habtm relation
Hi all, I'm baking my first CakePHP project at the moment and I've some newbie questions. I'll ask each question in it's own topic. First of all, I've a model with an habtm relation, let's call this model Company. The related model is called Specialty. I would like to give users the possibility to select which specialties are applicable for a company. I would prefer checkboxes, but I saw somewhere that a select is used by default, that will also be fine for now. Anyway, Could someone explain how to create a form for an habtm relation in CakePHP 1.2.? Bram --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> alright it appears that the associations are working correctly, but > the scaffolding just isn't being generated for notes. oh well I guess hmm, doesn't make sense, I don't this is a bug, it's used to often by too many. Please paste the code for your models in the bin: http://bin.cakephp.org/add/ cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
I don't quite get you. Do you mean something like this if I have a products table with fieldname: id, productname, cat_id, and I would need a select element under the product, where I will be able to select the categories? $this->set('categories', $this->Category->generateList(null, null, null, "{n}.categories.id", "{n}.categories.catname")); Do I put this under the Category Controller or Products Controller? Thanks. On Dec 1, 5:41 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > I you want to use fields from associated tables, use the key/valuePath > options in Model::generateList(), and set recursive to the apropiate > value. > > 2007/11/30, Dardo Sordi Bogado <[EMAIL PROTECTED]>: > > > This is for fields from the same table. I don't understand what you > > mean with "the aro aco method". > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > Can this solution for fieldname within same table be used with those > > > that are of different tables? Or do I have to use the aro aco method > > > for that? > > > > Thanks. > > > > On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > > > There are thre ways: > > > > > 1. If you are using Model::generateList(), ex: > > > > > // generateList ($conditions, $order, $limit, > > > > $keyPath=, $valuePath) > > > > $categories = $this->Category->generateList(null, null, null, null, > > > > '{n}.Category.catname'); > > > > > 2. Also you can just set Model::$displayField : > > > > > class Category extends AppModel { > > > > var $name = 'Category'; > > > > var $displayField = 'catname'; > > > > > } > > > > > Then, it becomes: > > > > > $categories = $this->Category->generateList(); > > > > > 3. You can rename colmn catname to name (default displayField). > > > > > I think number 2 is best. > > > > > Dardo Sordi. > > > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > > Hi all, > > > > > > I am a newbie in cakePHP, and I have created a table as per below. > > > > > > I have 3 fields for my categories table, and would like to create a > > > > > Select form element to insert new categories and link within the table > > > > > itself(where the parent_id comes from the id). > > > > > > Such that it will echo the select option in this manner: > > > > > catname, where the values > > > > > of "id" and "catname" are populated from the table below. > > > > > > categories table: > > > > > id > > > > > catname > > > > > parent_id > > > > > > I have tried some of the ways that will google help, but none seems > > > > > successful, in which I could only end up with the id instead of > > > > > catname. > > > > > > Please advise. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Latest additions to 1.2
Excellent!!! On Nov 17, 9:17 pm, Gwoo <[EMAIL PROTECTED]> wrote: > Several people voiced opinions aboutpluginsand in an effort to make > them more flexible we added the functionality to access models > acrosspluginsand the main application in the current 1.2 branch. Use the > dot notation "Plugin.Model" to access models in the plugin and "Model" > to access the models of the main app. > > To allow us this flexibility we changed how classes are loaded and > instances created. From the initial tests, these changes provide some > nice performance gains while reducing the amount of code needed in > your application. Keep in mind that with greater flexibility, comes > greater responsibility to maintain your applications architecture. > > ClassRegistry::init(); will return an instance of the class from the > registry or create and add it to the registry if it does not exist. > This is particularly useful for models and is used in the current core > code to create the model instances. > > App::import(); will load and cache the location of a file found > anywhere in the cake install. This is used in place of the load* > functions previously found in basics.php. You can see in the current > code that the functions use this class method now. > > The api for these methods are currently in alpha state, but will be > stabilized for beta. You can check out the doc comments for more info. > The online API,http://api.cakephp.orgwill be updated shortly. > > Bake on. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
I you want to use fields from associated tables, use the key/valuePath options in Model::generateList(), and set recursive to the apropiate value. 2007/11/30, Dardo Sordi Bogado <[EMAIL PROTECTED]>: > This is for fields from the same table. I don't understand what you > mean with "the aro aco method". > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > Can this solution for fieldname within same table be used with those > > that are of different tables? Or do I have to use the aro aco method > > for that? > > > > Thanks. > > > > On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > > There are thre ways: > > > > > > 1. If you are using Model::generateList(), ex: > > > > > > // generateList ($conditions, $order, $limit, > > > $keyPath=, $valuePath) > > > $categories = $this->Category->generateList(null, null, null, null, > > > '{n}.Category.catname'); > > > > > > 2. Also you can just set Model::$displayField : > > > > > > class Category extends AppModel { > > > var $name = 'Category'; > > > var $displayField = 'catname'; > > > > > > } > > > > > > Then, it becomes: > > > > > > $categories = $this->Category->generateList(); > > > > > > 3. You can rename colmn catname to name (default displayField). > > > > > > I think number 2 is best. > > > > > > Dardo Sordi. > > > > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > > > > > > > > > Hi all, > > > > > > > I am a newbie in cakePHP, and I have created a table as per below. > > > > > > > I have 3 fields for my categories table, and would like to create a > > > > Select form element to insert new categories and link within the table > > > > itself(where the parent_id comes from the id). > > > > > > > Such that it will echo the select option in this manner: > > > > catname, where the values > > > > of "id" and "catname" are populated from the table below. > > > > > > > categories table: > > > > id > > > > catname > > > > parent_id > > > > > > > I have tried some of the ways that will google help, but none seems > > > > successful, in which I could only end up with the id instead of > > > > catname. > > > > > > > Please advise. Thanks in advance. > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
This is for fields from the same table. I don't understand what you mean with "the aro aco method". 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > Can this solution for fieldname within same table be used with those > that are of different tables? Or do I have to use the aro aco method > for that? > > Thanks. > > On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > > There are thre ways: > > > > 1. If you are using Model::generateList(), ex: > > > > // generateList ($conditions, $order, $limit, > > $keyPath=, $valuePath) > > $categories = $this->Category->generateList(null, null, null, null, > > '{n}.Category.catname'); > > > > 2. Also you can just set Model::$displayField : > > > > class Category extends AppModel { > > var $name = 'Category'; > > var $displayField = 'catname'; > > > > } > > > > Then, it becomes: > > > > $categories = $this->Category->generateList(); > > > > 3. You can rename colmn catname to name (default displayField). > > > > I think number 2 is best. > > > > Dardo Sordi. > > > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > > > > > Hi all, > > > > > I am a newbie in cakePHP, and I have created a table as per below. > > > > > I have 3 fields for my categories table, and would like to create a > > > Select form element to insert new categories and link within the table > > > itself(where the parent_id comes from the id). > > > > > Such that it will echo the select option in this manner: > > > catname, where the values > > > of "id" and "catname" are populated from the table below. > > > > > categories table: > > > id > > > catname > > > parent_id > > > > > I have tried some of the ways that will google help, but none seems > > > successful, in which I could only end up with the id instead of > > > catname. > > > > > Please advise. Thanks in advance. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
alright it appears that the associations are working correctly, but the scaffolding just isn't being generated for notes. oh well I guess On Nov 30, 1:23 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > On 30/11/2007, Luke <[EMAIL PROTECTED]> wrote: > > > > > no that would only allow me to have one note and one item per order... > > I want many items and many notes per order... so I put order_id inside > > each of those tables. > > oh yeah, doh! > > it's even easier then, the issue is most likely cause by cake's > scaffolding assuming alphabetically, eg, 'i' before 'n' orderItem > before orderNote! this is why your associations work when you do: > > class Order extends AppModel > { > var $name = 'Order'; > var $hasMany = array( > 'OrderItem'=>array('dependent'=>true), > 'OrderNote' => array('dependent'=>true) > ); > > } > > hth > > jon > > -- > > jon bennett > w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
Can this solution for fieldname within same table be used with those that are of different tables? Or do I have to use the aro aco method for that? Thanks. On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > There are thre ways: > > 1. If you are using Model::generateList(), ex: > > // generateList ($conditions, $order, $limit, > $keyPath=, $valuePath) > $categories = $this->Category->generateList(null, null, null, null, > '{n}.Category.catname'); > > 2. Also you can just set Model::$displayField : > > class Category extends AppModel { > var $name = 'Category'; > var $displayField = 'catname'; > > } > > Then, it becomes: > > $categories = $this->Category->generateList(); > > 3. You can rename colmn catname to name (default displayField). > > I think number 2 is best. > > Dardo Sordi. > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > Hi all, > > > I am a newbie in cakePHP, and I have created a table as per below. > > > I have 3 fields for my categories table, and would like to create a > > Select form element to insert new categories and link within the table > > itself(where the parent_id comes from the id). > > > Such that it will echo the select option in this manner: > > catname, where the values > > of "id" and "catname" are populated from the table below. > > > categories table: > > id > > catname > > parent_id > > > I have tried some of the ways that will google help, but none seems > > successful, in which I could only end up with the id instead of > > catname. > > > Please advise. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
Got it, Thanks Dardo. On Dec 1, 4:23 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > There are thre ways: > > 1. If you are using Model::generateList(), ex: > > // generateList ($conditions, $order, $limit, > $keyPath=, $valuePath) > $categories = $this->Category->generateList(null, null, null, null, > '{n}.Category.catname'); > > 2. Also you can just set Model::$displayField : > > class Category extends AppModel { > var $name = 'Category'; > var $displayField = 'catname'; > > } > > Then, it becomes: > > $categories = $this->Category->generateList(); > > 3. You can rename colmn catname to name (default displayField). > > I think number 2 is best. > > Dardo Sordi. > > 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > > > > Hi all, > > > I am a newbie in cakePHP, and I have created a table as per below. > > > I have 3 fields for my categories table, and would like to create a > > Select form element to insert new categories and link within the table > > itself(where the parent_id comes from the id). > > > Such that it will echo the select option in this manner: > > catname, where the values > > of "id" and "catname" are populated from the table below. > > > categories table: > > id > > catname > > parent_id > > > I have tried some of the ways that will google help, but none seems > > successful, in which I could only end up with the id instead of > > catname. > > > Please advise. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Aliases in paginate()
found a way you can use sql-alias AS whith paginate > $this->paginate['fields'] = array('Student.id', 'Student.vorname', > 'Student.nachname', ... 'Group.name AS Gruppe'); it works when written between 2 (( do something like this: $this->paginate['fields'] = array('Student.id', 'Student.vorname', 'Student.nachname', ... '((Group.name)) AS Gruppe'); hope this helps ./klaus --~--~-~--~~~---~--~~ 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: Change layout for default error messages and static pages (CakePHP 1.2)
Ahh, nice. Thanks. On Nov 30, 12:08 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > You can use your own PagesController, just copy the one that comes > with cake (in the cake dir) to app/controllers/, then tune as you > wish. > > 2007/11/30, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > > > > The pages controller subclasses the AppController, so you can override > > its layout by setting one in the parent AppController. Of course this > > may mean you need to do things with your other controllers to avoid > > them also being set to the new layout. > > > simon > > > On Nov 30, 6:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > As far as I can see, Cake's static 'pages' (in the pages controller) > > > and the default error pages (empty, not_found, permission_denied) must > > > use the 'default.ctp' layout. Note that neither of these use a user > > > defined controller, so there's no where to define '$this->layout'. > > > > Is there a way to define a separate layout for the static pages and > > > the default error message? > > > > Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
On 30/11/2007, Luke <[EMAIL PROTECTED]> wrote: > > no that would only allow me to have one note and one item per order... > I want many items and many notes per order... so I put order_id inside > each of those tables. oh yeah, doh! it's even easier then, the issue is most likely cause by cake's scaffolding assuming alphabetically, eg, 'i' before 'n' orderItem before orderNote! this is why your associations work when you do: class Order extends AppModel { var $name = 'Order'; var $hasMany = array( 'OrderItem'=>array('dependent'=>true), 'OrderNote' => array('dependent'=>true) ); } hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
I think his tables are ok (he posted them here a couple of messages before). orders: id date customer_name customer_phone customer_etc total order_items: id order_id name description price sku order_notes: order_id note date 2007/11/30, Jon Bennett <[EMAIL PROTECTED]>: > > > do you mean my table names? > > no > > I'm assuming your orders table is: > > Order > - id > - order_item_id > - order_note_id > - created > - modified > > and you have in your order model > > class Order extends AppModel { > var $name = 'Order'; > > var $hasMany = array( > 'OrderNote' => array( > > 'className' => 'OrderNote', > 'dependent' => true, > > ), > > 'OrderItem' => array( > > 'className' => 'OrderItem', > 'dependent' => true, > > ) > ); > } > > is that correct? > > cheers, > > jon > > > -- > > jon bennett > w: http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
no that would only allow me to have one note and one item per order... I want many items and many notes per order... so I put order_id inside each of those tables. On Nov 30, 1:16 pm, "Jon Bennett" <[EMAIL PROTECTED]> wrote: > > do you mean my table names? > > no > > I'm assuming your orders table is: > > Order > - id > - order_item_id > - order_note_id > - created > - modified > > and you have in your order model > > class Order extends AppModel { > var $name = 'Order'; > > var $hasMany = array( > 'OrderNote' => array( > > 'className' => 'OrderNote', > 'dependent' => true, > > ), > > 'OrderItem' => array( > > 'className' => 'OrderItem', > 'dependent' => true, > > ) > ); > > } > > is that correct? > > cheers, > > jon > > -- > > jon bennett > w:http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> do you mean my table names? no I'm assuming your orders table is: Order - id - order_item_id - order_note_id - created - modified and you have in your order model class Order extends AppModel { var $name = 'Order'; var $hasMany = array( 'OrderNote' => array( 'className' => 'OrderNote', 'dependent' => true, ), 'OrderItem' => array( 'className' => 'OrderItem', 'dependent' => true, ) ); } is that correct? cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
do you mean my table names? On Nov 30, 1:09 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > Try defining your model classes whitout the 'order_' prefix, and set > $useTable = 'order_whatever'; in the model. > > 2007/11/30, Luke <[EMAIL PROTECTED]>: > > > > > umm I might have asked the question wrong. here is what I am trying to > > do: > > > I have 3 tables: orders, order_items, and order_notes > > > Orders is full of all of my store's orders. Order items are all the > > items the customer purchased, and order_notes contains all of the > > notes associated with an order. so the tables look like: > > > orders: > > > id > > date > > customer_name > > customer_phone > > customer_etc > > total > > > order_items: > > > id > > order_id > > name > > description > > price > > sku > > > order_notes: > > order_id > > note > > date > > > So it isn't a many-to-many association, it's just two one-to-many > > associates. > > > On Nov 30, 9:17 am, Anupom <[EMAIL PROTECTED]> wrote: > > > Join tables should be named after the tables that will join, in > > > alphabetical order, with underscores in between. As an example, a join > > > table between posts and tags tables should be named posts_tags, not > > > tags_posts. > > > > The default value of the foreign keys used in the join table must be > > > underscored, singular name of the models in relation, suffixed with > > > '_id'. > > > Like, post_id, tag_id. > > > > If you want to override the defaults, you can explicitly define it in > > > the association attribute of the model - > > > > > > class Post extends AppModel > > > { > > > var $name = 'Post'; > > > > var $hasAndBelongsToMany = array( > > > 'Tag' => > > > array('className'=> 'Tag', > > > 'joinTable' => 'tags_posts, //altered the > > > default - posts_tags > > > 'foreignKey' => 'article_id', //altered > > > the default -post_id > > > 'associationForeignKey' => 'category_id' //altered > > > the default - tag_id > > > ) > > > );} > > > > ?> > > > > On Nov 30, 2007 11:12 PM, Jon Bennett <[EMAIL PROTECTED]> wrote: > > > > > > Always best to stick to a A-Z (why can't I think of the correct term > > > > > for that!) > > > > > ALPHABETICAL > > > > > cheers, > > > > > jon > > > > > -- > > > > > jon bennett > > > > w:http://www.jben.net/ > > > > iChat (AIM): jbendotnet Skype: jon-bennett > > > > -- > > > Thanks > > > Anupom > > > Trippert Inc. [http://www.trippert.com] > > > GopherNow. [http://www.gophernow.com/] > > > Homepage. [http://www.anupom.wordpress.com/] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> So it isn't a many-to-many association, it's just two one-to-many > associates. as I stated in my previous reply, the problem is to do with the order in which your foreign keys are listed in the Orders table, and the fact your associations are mapped in a different order. This is why when you swap the order of the associations in your Order model it works. Always best to do everything alphabetically. cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
Try defining your model classes whitout the 'order_' prefix, and set $useTable = 'order_whatever'; in the model. 2007/11/30, Luke <[EMAIL PROTECTED]>: > > umm I might have asked the question wrong. here is what I am trying to > do: > > I have 3 tables: orders, order_items, and order_notes > > Orders is full of all of my store's orders. Order items are all the > items the customer purchased, and order_notes contains all of the > notes associated with an order. so the tables look like: > > orders: > > id > date > customer_name > customer_phone > customer_etc > total > > order_items: > > id > order_id > name > description > price > sku > > order_notes: > order_id > note > date > > So it isn't a many-to-many association, it's just two one-to-many > associates. > > On Nov 30, 9:17 am, Anupom <[EMAIL PROTECTED]> wrote: > > Join tables should be named after the tables that will join, in > > alphabetical order, with underscores in between. As an example, a join > > table between posts and tags tables should be named posts_tags, not > > tags_posts. > > > > The default value of the foreign keys used in the join table must be > > underscored, singular name of the models in relation, suffixed with > > '_id'. > > Like, post_id, tag_id. > > > > If you want to override the defaults, you can explicitly define it in > > the association attribute of the model - > > > > > class Post extends AppModel > > { > > var $name = 'Post'; > > > > var $hasAndBelongsToMany = array( > > 'Tag' => > > array('className'=> 'Tag', > > 'joinTable' => 'tags_posts, //altered the > > default - posts_tags > > 'foreignKey' => 'article_id', //altered > > the default -post_id > > 'associationForeignKey' => 'category_id' //altered > > the default - tag_id > > ) > > );} > > > > ?> > > > > On Nov 30, 2007 11:12 PM, Jon Bennett <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > Always best to stick to a A-Z (why can't I think of the correct term > > > > for that!) > > > > > ALPHABETICAL > > > > > cheers, > > > > > jon > > > > > -- > > > > > jon bennett > > > w:http://www.jben.net/ > > > iChat (AIM): jbendotnet Skype: jon-bennett > > > > -- > > Thanks > > Anupom > > Trippert Inc. [http://www.trippert.com] > > GopherNow. [http://www.gophernow.com/] > > Homepage. [http://www.anupom.wordpress.com/] > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: scaffold error
it outputs "app\controllers\orders_controller.php (line 41)" and an empty yellow box. I am on version 1.2.0.5875 pre-beta On Nov 30, 12:27 pm, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote: > what version? > > Try debug($this->data) in beforeFilter; > > 2007/11/30, Luke <[EMAIL PROTECTED]>: > > > > > I am not sure what I did, but for some reason the edit action isn't > > working in any of my controllers. It keeps telling me "Invalid id for > > Order::edit()". Why would it be doing that? Here is an example > > controller: > > > > class OrderItemsController extends AppController { > > > var $name = 'OrderItems'; > > var $uses = array('OrderItem', 'Order'); > > var $helpers = array('Html', 'Form' ); > > var $scaffold; > > > } > > ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple DBs association
Problem is that I don't know how to set up DataSource, because I cannot do associacion between two diferent databases using only models, can I? there is no field for database config name in associacion array. I just read some information that datasources can make you do assosciacions between files and databases etc (so i guess it is possible to do assocc between two different databases), but i just don't know how. And tempdocs does not covers this for now On 30 Lis, 16:37, gwoo <[EMAIL PROTECTED]> wrote: > there is a lot of information on this google group. You can do > associations across multiple datasources. The only thing that is a > little tricky is the HABTM since a third table is involved. BUt you > can always create a model for that too and specify its db config. That > is also discussed in previous messages to the group. --~--~-~--~~~---~--~~ 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: Newbie question: how do i load the javascript helper ?
Thanks for the answer, one more thing though, should i use it in every controller or just the main app controller? Christopher E. Franklin, Sr. : i will check again, though i checked several times.maybe it slipped :) On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote: > G'day > > Hopefully I'm not misunderstanding. > > In your controller, make sure you have it defined. "var $helpers = > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have > for context. > That will work for just Javascript. > If you use any helpers that are not built in, just make sure you put a > copy of the helper is in "app/views/helpers" and then add the name, > just like you did with 'Javascript'. > > You should now have access.:-) > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > > > Sorry to ask such a newbie question, but i didnt find anything about > > it in the manual. Maybe i missed it, but anyway: > > > how do i load the javascript helper? --~--~-~--~~~---~--~~ 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: XHR calls and an Auth problem - [security risk?]
I checked my application, and I found the origin + fix. In the file routes.php: Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); Router::connect('/sections/', array('controller' => 'sections', 'action' => 'index', 'prefix' => Configure::read('Routing.admin'))); My old file was without the 'prefix' key. That fixed the problem. Any ideas why? On Nov 30, 12:59 pm, AD7six <[EMAIL PROTECTED]> wrote: > On Nov 30, 11:46 am, phpjoy <[EMAIL PROTECTED]> wrote: > > > > > I'm experiencing a VERY weird auth problem, which is a very big > > security risk for my application. > > > When I try to access a page in the admin section directly, I'm being > > redirected to the login page. > > When I try to do the same via an XHR call, the page is loaded! > > > Example: > > When I try to access the URLhttp://localhost/admin/sections/edit/1294 > > I get redirected tohttp://localhost/admin/login > > > When the program accesses the same URL, it loads the page. > > Any ideas why it happens? > > > Here's my auth setup: > > function auth() { > > $this->controller->Auth->userScope = array( > > 'AdminUser.active' => > > '1' ); > > $this->controller->Auth->userModel = 'AdminUser'; > > $this->controller->Auth->loginAction='/' > > .Configure::read('Routing.admin') .'/login/'; > > > $this->controller->Auth->loginRedirect='/' > > .Configure::read('Routing.admin') .'/'; > > > $this->controller->Auth->authorize = false; > > $this->controller->Auth->sessionKey = 'AdminUser'; > > } > > > Here are the headers, checked by FireBug: > > > Response Headers > > == > > DateFri, 30 Nov 2007 10:30:54 GMT > > Server Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e > > mod_autoindex_color PHP/5.2.3 > > X-Powered-ByPHP/5.2.3 > > P3P CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" > > Pragma no-cache > > Cache-Control no-store, no-cache, max-age=0, must-revalidate > > Content-Length 719 > > Keep-Alive timeout=5, max=97 > > Connection Keep-Alive > > Content-Typetext/html > > > Request Headers > > = > > Hostlocalhost > > User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: > > 1.8.1.10) Gecko/20071115 Firefox/2.0.0.10 > > Accept text/xml,application/xml,application/xhtml+xml,text/ > > html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 > > Accept-Language en-us,en;q=0.7,he;q=0.3 > > Accept-Encoding gzip,deflate > > Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive 300 > > Connection keep-alive > > X-Requested-WithXMLHttpRequest > > Refererhttp://localhost/admin/ > > Cookie ProgramName=77254f4fb7cf56b71b28f6708f9a > > Pragma no-cache > > Cache-Control no-cache > > > If I request it through an HTTP data proxy, it doesn't load. Here are > > the headers: > > Response Headers > > == > > DateFri, 30 Nov 2007 10:43:57 GMT > > Server Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8e > > mod_autoindex_color PHP/5.2.3 > > X-Powered-ByPHP/5.2.3 > > P3P CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" > > Pragma no-cache > > Cache-Control no-store, no-cache, max-age=0, must-revalidate > > Locationhttp://localhost/admin/login/ > > Content-Length 0 > > Keep-Alive timeout=5, max=95 > > Connection Keep-Alive > > Content-Typetext/html > > > Request Headers > > > > Hostlocalhost > > User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: > > 1.8.1.10) Gecko/20071115 Firefox/2.0.0.10 > > Accept */* > > Accept-Language en-us,en;q=0.7,he;q=0.3 > > Accept-Encoding gzip,deflate > > Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 > > Keep-Alive 300 > > Connection keep-alive > > Refererhttp://localhost/admin/ > > Cookie ProgramName=bc904aec5ff06a2d12bb6f334fde97ab > > > How can I make Auth check XHR calls? > > I doubt the Auth component cares how it receives a call, it's probably > an app specific problem (if not provide a sample application which > demonstrates the problem). Try having a look and investigatively debug > the auth class, or stick some calls to $this-log($aVar); in your code > to see if it´s bypassing the Auth class, or calling it and succeeding > etc. > > hth, > > AD --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: scaffold error
what version? Try debug($this->data) in beforeFilter; 2007/11/30, Luke <[EMAIL PROTECTED]>: > > I am not sure what I did, but for some reason the edit action isn't > working in any of my controllers. It keeps telling me "Invalid id for > Order::edit()". Why would it be doing that? Here is an example > controller: > > class OrderItemsController extends AppController { > > var $name = 'OrderItems'; > var $uses = array('OrderItem', 'Order'); > var $helpers = array('Html', 'Form' ); > var $scaffold; > > } > ?> > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.2 Routing question..
How could I achieve routing like so: /project/{project_name}/{action}/ * without any hacks in the controller? I have it working with some hacks in the controller but would rather make it more dynamic in the future and figured Router might help with that. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
It is, just pass array('disabled' => "disabled") as the options array. 2007/11/30, Brian <[EMAIL PROTECTED]>: > > I understand how to do readonly with straight HTML and this should be > a simple and easy thing to do within Cake. Is it not? > Brian > > On Nov 30, 12:48 pm, Brian <[EMAIL PROTECTED]> wrote: > > I just noticed that none of the parameters being passed in the array > > are being used? What would cause that? > > > > On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > > > > > > > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > > > > > this doesn't work either: > > > > > > inputTag('Employee/start_date', array('size' => '4 > > > > 0', 'disabled' => true)) ?> > > > > > Have you thought about using a hidden field and simply displaying the > > > data? > > > > > -- > > > Chris Hartjes > > > > > My motto for 2007: "Just build it, damnit!" > > > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard- Hide quoted text - > > > > - Show quoted text - > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How To Create Select Options for Fields Within Same Table
There are thre ways: 1. If you are using Model::generateList(), ex: // generateList ($conditions, $order, $limit, $keyPath=, $valuePath) $categories = $this->Category->generateList(null, null, null, null, '{n}.Category.catname'); 2. Also you can just set Model::$displayField : class Category extends AppModel { var $name = 'Category'; var $displayField = 'catname'; } Then, it becomes: $categories = $this->Category->generateList(); 3. You can rename colmn catname to name (default displayField). I think number 2 is best. Dardo Sordi. 2007/11/30, Joyce <[EMAIL PROTECTED]>: > > Hi all, > > I am a newbie in cakePHP, and I have created a table as per below. > > I have 3 fields for my categories table, and would like to create a > Select form element to insert new categories and link within the table > itself(where the parent_id comes from the id). > > Such that it will echo the select option in this manner: > catname, where the values > of "id" and "catname" are populated from the table below. > > categories table: > id > catname > parent_id > > I have tried some of the ways that will google help, but none seems > successful, in which I could only end up with the id instead of > catname. > > Please advise. Thanks in advance. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Change layout for default error messages and static pages (CakePHP 1.2)
You can use your own PagesController, just copy the one that comes with cake (in the cake dir) to app/controllers/, then tune as you wish. 2007/11/30, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > > The pages controller subclasses the AppController, so you can override > its layout by setting one in the parent AppController. Of course this > may mean you need to do things with your other controllers to avoid > them also being set to the new layout. > > simon > > On Nov 30, 6:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > As far as I can see, Cake's static 'pages' (in the pages controller) > > and the default error pages (empty, not_found, permission_denied) must > > use the 'default.ctp' layout. Note that neither of these use a user > > defined controller, so there's no where to define '$this->layout'. > > > > > > Is there a way to define a separate layout for the static pages and > > the default error message? > > > > > > Thanks in advance! > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How To Create Select Options for Fields Within Same Table
Hi all, I am a newbie in cakePHP, and I have created a table as per below. I have 3 fields for my categories table, and would like to create a Select form element to insert new categories and link within the table itself(where the parent_id comes from the id). Such that it will echo the select option in this manner: catname, where the values of "id" and "catname" are populated from the table below. categories table: id catname parent_id I have tried some of the ways that will google help, but none seems successful, in which I could only end up with the id instead of catname. Please advise. Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How do I access variables set in App Controller in View?
Just what I was looking for! Thanks! Here's my login fcn so it may help someone down the road: function login() { if(empty($this->data) == false) { if(($user = $this->User->validateLogin($this->data['User'])) == true) { //I am saving the user object to the session. Must use the Session helper to access in views or controllers $user = $this->User->findById($user['id']); $this->Session->write('CurrentUser', $user); $this->Session->setFlash('You\'ve successfully logged in.'); $this->redirect('accounts/myconnectnotes'); exit(); } else { $this->Session->setFlash('Sorry, the information you\'ve entered is incorrect.'); $this->redirect('failed'); exit(); } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
My Models are causing recursive issues
My setup Blogs - hasMany Posts - hasAndBelongsToMany Accounts Post - belongsTo Blog - belongsTo Account -hasMany Note Note - belongsTo Post - belongsTo Account Account - hasMany Post - hasMany Note - hasAndBelongsToMany Blog The issue comes when I am in Posts and I do a recursive = 2, which I think should pull the post information, the note information and the account information associated with the note. However, gets the list of note_id's and queries the post tables for the note_id's. This example has 4 notes SELECT Post.id, Post.title, Post.text, Post.created, Post.modified, Post.blog_id, Post.account_id, Post.ip FROM cake_posts Post WHERE Post.id = 10 SELECT Post.id, Post.title, Post.text, Post.created, Post.modified, Post.blog_id, Post.account_id, Post.ip FROM cake_posts Post WHERE Post.id = 11 SELECT Post.id, Post.title, Post.text, Post.created, Post.modified, Post.blog_id, Post.account_id, Post.ip FROM cake_posts Post WHERE Post.id = 12 SELECT Post.id, Post.title, Post.text, Post.created, Post.modified, Post.blog_id, Post.account_id, Post.ip FROM cake_posts Post WHERE Post.id = 13 Then it does the same to the accounts SELECT Account.id, Account.username, Account.first_name, Account.last_name, Account.email, Account.profile_pic FROM cake_accounts Account WHERE Account.id = 10 SELECT Account.id, Account.username, Account.first_name, Account.last_name, Account.email, Account.profile_pic FROM cake_accounts Account WHERE Account.id = 11 SELECT Account.id, Account.username, Account.first_name, Account.last_name, Account.email, Account.profile_pic FROM cake_accounts Account WHERE Account.id = 12 SELECT Account.id, Account.username, Account.first_name, Account.last_name, Account.email, Account.profile_pic FROM cake_accounts Account WHERE Account.id = 13 What am I doing wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
I understand how to do readonly with straight HTML and this should be a simple and easy thing to do within Cake. Is it not? Brian On Nov 30, 12:48 pm, Brian <[EMAIL PROTECTED]> wrote: > I just noticed that none of the parameters being passed in the array > are being used? What would cause that? > > On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > > > > > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > > > this doesn't work either: > > > > inputTag('Employee/start_date', array('size' => '4 > > > 0', 'disabled' => true)) ?> > > > Have you thought about using a hidden field and simply displaying the data? > > > -- > > Chris Hartjes > > > My motto for 2007: "Just build it, damnit!" > > > @TheKeyboard -http://www.littlehart.net/atthekeyboard- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > this doesn't work either: > > inputTag('Employee/start_date', array('size' => '4 > 0', 'disabled' => true)) ?> > Have you thought about using a hidden field and simply displaying the data? -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Change layout for default error messages and static pages (CakePHP 1.2)
The pages controller subclasses the AppController, so you can override its layout by setting one in the parent AppController. Of course this may mean you need to do things with your other controllers to avoid them also being set to the new layout. simon On Nov 30, 6:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > As far as I can see, Cake's static 'pages' (in the pages controller) > and the default error pages (empty, not_found, permission_denied) must > use the 'default.ctp' layout. Note that neither of these use a user > defined controller, so there's no where to define '$this->layout'. > > > Is there a way to define a separate layout for the static pages and > the default error message? > > > Thanks in advance! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
I just noticed that none of the parameters being passed in the array are being used? What would cause that? On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > > > > this doesn't work either: > > > inputTag('Employee/start_date', array('size' => '4 > > 0', 'disabled' => true)) ?> > > Have you thought about using a hidden field and simply displaying the data? > > -- > Chris Hartjes > > My motto for 2007: "Just build it, damnit!" > > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
On Nov 30, 2007 1:46 PM, Brian <[EMAIL PROTECTED]> wrote: > > What I'm trying to do is have an input box with a JS calendar tool > that the user can only use the calendar tool to select the properly > formatted date. http://www.cs.tut.fi/~jkorpela/forms/readonly.html That might help, and you might be doing something as silly as setting the 'disabled' => true value in the wrong array... -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
What I'm trying to do is have an input box with a JS calendar tool that the user can only use the calendar tool to select the properly formatted date. On Nov 30, 12:44 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On Nov 30, 2007 1:29 PM, Brian <[EMAIL PROTECTED]> wrote: > > > > > this doesn't work either: > > > inputTag('Employee/start_date', array('size' => '4 > > 0', 'disabled' => true)) ?> > > Have you thought about using a hidden field and simply displaying the data? > > -- > Chris Hartjes > > My motto for 2007: "Just build it, damnit!" > > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
this doesn't work either: inputTag('Employee/start_date', array('size' => '4 0', 'disabled' => true)) ?> On Nov 30, 11:39 am, "Christopher E. Franklin, Sr." <[EMAIL PROTECTED]> wrote: > 'disabled' => true (without the single quotes) > > On Nov 30, 9:30 am, Brian <[EMAIL PROTECTED]> wrote: > > > > > How do I get an input field to be readonly? > > > I have tried > > inputTag('Employee/start_date', array('size' => '4 > > 0', 'READONLY' => 'readonly')) ?> > > and > > inputTag('Employee/start_date', array('size' => '4 > > 0', 'disabled' => 'true')) ?>- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Change layout for default error messages and static pages (CakePHP 1.2)
As far as I can see, Cake's static 'pages' (in the pages controller) and the default error pages (empty, not_found, permission_denied) must use the 'default.ctp' layout. Note that neither of these use a user defined controller, so there's no where to define '$this->layout'. Is there a way to define a separate layout for the static pages and the default error message? Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
scaffold error
I am not sure what I did, but for some reason the edit action isn't working in any of my controllers. It keeps telling me "Invalid id for Order::edit()". Why would it be doing that? Here is an example controller: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
umm I might have asked the question wrong. here is what I am trying to do: I have 3 tables: orders, order_items, and order_notes Orders is full of all of my store's orders. Order items are all the items the customer purchased, and order_notes contains all of the notes associated with an order. so the tables look like: orders: id date customer_name customer_phone customer_etc total order_items: id order_id name description price sku order_notes: order_id note date So it isn't a many-to-many association, it's just two one-to-many associates. On Nov 30, 9:17 am, Anupom <[EMAIL PROTECTED]> wrote: > Join tables should be named after the tables that will join, in > alphabetical order, with underscores in between. As an example, a join > table between posts and tags tables should be named posts_tags, not > tags_posts. > > The default value of the foreign keys used in the join table must be > underscored, singular name of the models in relation, suffixed with > '_id'. > Like, post_id, tag_id. > > If you want to override the defaults, you can explicitly define it in > the association attribute of the model - > > class Post extends AppModel > { > var $name = 'Post'; > > var $hasAndBelongsToMany = array( > 'Tag' => > array('className'=> 'Tag', > 'joinTable' => 'tags_posts, //altered the > default - posts_tags > 'foreignKey' => 'article_id', //altered > the default -post_id > 'associationForeignKey' => 'category_id' //altered > the default - tag_id > ) > );} > > ?> > > On Nov 30, 2007 11:12 PM, Jon Bennett <[EMAIL PROTECTED]> wrote: > > > > > > > > Always best to stick to a A-Z (why can't I think of the correct term for > > > that!) > > > ALPHABETICAL > > > cheers, > > > jon > > > -- > > > jon bennett > > w:http://www.jben.net/ > > iChat (AIM): jbendotnet Skype: jon-bennett > > -- > Thanks > Anupom > Trippert Inc. [http://www.trippert.com] > GopherNow. [http://www.gophernow.com/] > Homepage. [http://www.anupom.wordpress.com/] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Input field read only
'disabled' => true (without the single quotes) On Nov 30, 9:30 am, Brian <[EMAIL PROTECTED]> wrote: > How do I get an input field to be readonly? > > I have tried > inputTag('Employee/start_date', array('size' => '4 > 0', 'READONLY' => 'readonly')) ?> > and > inputTag('Employee/start_date', array('size' => '4 > 0', 'disabled' => 'true')) ?> --~--~-~--~~~---~--~~ 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: can't upload
Check the encoding on the form, it must be "multipart/form-data". create('Model', array('type' => 'file')); ?> also check what is in 2007/11/30, Christopher E. Franklin, Sr. <[EMAIL PROTECTED]>: > > Well, I guess my first question would be, are you using a browse > control to browse for the image on your comp or is it already on the > hard drive of the server some where? > > Second, can you post the upload function as well? > > On Nov 30, 8:34 am, Dilbert <[EMAIL PROTECTED]> wrote: > > I have an article model with an image field(I don't want to create > > another model). > > This is the code for admin_add > > > > function admin_add() { > > if (!empty($this->data)) { > > $this->cleanUpFields(); > > $this->Article->create(); > > if ($this->Article->save($this->data)) { > > if (!empty($this->data['Article']['image'])) > > { > > $fileup=$this->data['Article']['image']; > > $this->Upload->upload('$fileup','../webroot/img/ > > uploads/'); > > } > > $this->Session->setFlash('Article > > saved'); > > $this->redirect(array('action'=>'index'), null, true);*/ > > > > } else { > > $this->Session->setFlash('Article not > > saved'); > > } > > } > > } > > > > The folder uploads is 777. > > Where is the problem? > > Thank 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 -~--~~~~--~~--~--~---
Input field read only
How do I get an input field to be readonly? I have tried inputTag('Employee/start_date', array('size' => '4 0', 'READONLY' => 'readonly')) ?> and inputTag('Employee/start_date', array('size' => '4 0', 'disabled' => 'true')) ?> --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
Join tables should be named after the tables that will join, in alphabetical order, with underscores in between. As an example, a join table between posts and tags tables should be named posts_tags, not tags_posts. The default value of the foreign keys used in the join table must be underscored, singular name of the models in relation, suffixed with '_id'. Like, post_id, tag_id. If you want to override the defaults, you can explicitly define it in the association attribute of the model - array('className'=> 'Tag', 'joinTable' => 'tags_posts, //altered the default - posts_tags 'foreignKey' => 'article_id', //altered the default -post_id 'associationForeignKey' => 'category_id' //altered the default - tag_id ) ); } ?> On Nov 30, 2007 11:12 PM, Jon Bennett <[EMAIL PROTECTED]> wrote: > > > Always best to stick to a A-Z (why can't I think of the correct term for > > that!) > > ALPHABETICAL > > > cheers, > > jon > > -- > > jon bennett > w: http://www.jben.net/ > iChat (AIM): jbendotnet Skype: jon-bennett > > > > -- Thanks Anupom Trippert Inc. [http://www.trippert.com] GopherNow. [http://www.gophernow.com/] Homepage. [http://www.anupom.wordpress.com/] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Newbie question: how do i load the javascript helper ?
It is in the helpers section of the manual ;) On Nov 30, 8:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > Sorry to ask such a newbie question, but i didnt find anything about > it in the manual. Maybe i missed it, but anyway: > > how do i load the javascript helper? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> Always best to stick to a A-Z (why can't I think of the correct term for > that!) ALPHABETICAL cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
> Does cake not allow multiple "hasMany" associations? for some reason > it is only rendering scaffolding for the first of the two I'm putting > in here: > > class Order extends AppModel { >var $name = 'Order'; > >var $hasMany = array( > 'OrderNote' => array( > >'className' => 'OrderNote', >'dependent' => true, > > ), > > 'OrderItem' => array( > >'className' => 'OrderItem', >'dependent' => true, > > ) > ); > } > > if I switch the two and make OrderItem first, then that shows up in > the scaffolding. What's the deal?? I think scaffolding works by matching the order of the foreign keys in your db table with your assocaitions. Always best to stick to a A-Z (why can't I think of the correct term for that!) and you'll go no wrong (as you've proved!) cheers, jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: can't upload
Well, I guess my first question would be, are you using a browse control to browse for the image on your comp or is it already on the hard drive of the server some where? Second, can you post the upload function as well? On Nov 30, 8:34 am, Dilbert <[EMAIL PROTECTED]> wrote: > I have an article model with an image field(I don't want to create > another model). > This is the code for admin_add > > function admin_add() { > if (!empty($this->data)) { > $this->cleanUpFields(); > $this->Article->create(); > if ($this->Article->save($this->data)) { > if (!empty($this->data['Article']['image'])) > { > $fileup=$this->data['Article']['image']; > $this->Upload->upload('$fileup','../webroot/img/ > uploads/'); > } > $this->Session->setFlash('Article > saved'); > $this->redirect(array('action'=>'index'), null, true);*/ > > } else { > $this->Session->setFlash('Article not saved'); > } > } > } > > The folder uploads is 777. > Where is the problem? > Thank 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: Search box
I have always had favorable results making a searches_controller model and view. This way, if you want to search for different things, say, search the website, search the documentation, search the code, then it scales very well because all your searches are pointed at one controller. This makes it very scalable for me. I can have advanced search page, search boxes etc. Plus you get to use the highlighter and if you are using mysql, you can make it return the search ranking so you can replace it with stars (or sprinkles if you prefer). On Nov 30, 9:47 am, José Pablo Orozco Marín <[EMAIL PROTECTED]> wrote: > Cool! im a newbee too :) > > sendami escribió: > > > > > I'm using cake 1.1. Are there big differences between 1.1 and 1.2? > > I'm totally a newbee. I just started cake two weeks ago. > > I recognized that many people are using cake 1.2. > > I'll try the version and your code. > > Anyway, thank you very much for your reply. > > > On Nov 29, 7:50 pm, José Pablo Orozco Marín <[EMAIL PROTECTED]> > > wrote: > > >> Which version of cakephp are you using? > >> Normally for me works the following 3 lines of code using cakephp 1.2 > > >> uses('sanitize'); > >> $sanitize = new Sanitize(); > >> $this->cleanData = $sanitize->clean( $this->data ); > > >> sendami escribió: > > >>> I got an error message like below. > > >>> Fatal error: Call to undefined method Sanitize::clean() in C:\AppServ > >>> \www\app\controllers\cms_categories_controller.php on line 18 > > >>> ant the line 18 is below. > > >>> $this->cleanData = $sanitize->clean( $this->data ); > > >>> What I have to do? > > >>> On Nov 27, 5:26 pm, Josoroma <[EMAIL PROTECTED]> wrote: > > I clean a little bit the code :) > This works for me, but my question is: > Where do i have toi clean the data for thissearch, here in the > controller or inside the model? > > function index() { > > $this->Benchlink->recursive = 0; > > uses('sanitize'); > $sanitize = new Sanitize(); > > $this->set('findUrlNotCleaned', > trim($this->data['formFind'] > ['find']) ); > > $this->cleanData = $sanitize->clean( $this->data ); > > $findUrl = low( > trim($this->cleanData['formFind']['find']) ); > > if ( $findUrl != '' ) { > > $this->set('benchlinks', > $this->paginate('Benchlink', > array("LOWER(`Benchlink`.`url`) LIKE '%" . $findUrl . "%'"))); > > } else { > > $this->set('benchlinks', $this->paginate()); > > } > > } > > >> -- > > >> - > > >> José Pablo Orozco Marín > >> [EMAIL PROTECTED] > > >> Tel. +506 820-7280 > > >> Por favor, visite mi pasión:http://www.SukiaLogic.com/-Hide quoted text - > > >> - Show quoted text - > > -- > > - > > José Pablo Orozco Marín > [EMAIL PROTECTED] > > Tel. +506 820-7280 > > Por favor, visite mi pasión:http://www.SukiaLogic.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: multiple "hasMany"?
does nobody know or is it impossible or what? On Nov 29, 3:39 pm, Luke <[EMAIL PROTECTED]> wrote: > Does cake not allow multiple "hasMany" associations? for some reason > it is only rendering scaffolding for the first of the two I'm putting > in here: > > class Order extends AppModel { >var $name = 'Order'; > >var $hasMany = array( > 'OrderNote' => array( > >'className' => 'OrderNote', >'dependent' => true, > > ), > > 'OrderItem' => array( > >'className' => 'OrderItem', >'dependent' => true, > > ) > ); > > } > > if I switch the two and make OrderItem first, then that shows up in > the scaffolding. What's the deal?? --~--~-~--~~~---~--~~ 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: Newbie question: how do i load the javascript helper ?
G'day Hopefully I'm not misunderstanding. In your controller, make sure you have it defined. "var $helpers = array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have for context. That will work for just Javascript. If you use any helpers that are not built in, just make sure you put a copy of the helper is in "app/views/helpers" and then add the name, just like you did with 'Javascript'. You should now have access.:-) On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote: > Sorry to ask such a newbie question, but i didnt find anything about > it in the manual. Maybe i missed it, but anyway: > > how do i load the javascript helper? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
FormWizard snippet for Cake 1.1
G'day Sorry, I'm new to cake and have been scaling hills for the past few weeks. I have read all the entries I can find and am still missing something on how it hooks up and works. I have to use Cake 1.1 for this, no choice I have a project where I use four forms "modelinfo","productinfo","custinfo" and "review". I took the FormWizard snippet from cakeforge and have been trying to implement it. I have the following structure. app/controller/component/wizard.php: - contains the actual component as downloaded. app/controller/wizard_controller.php: = // code start array("pages","modelinfo","productinfo", "custinfo","review")); $this->FormWizard->initWizard($ways); } } I put the following in each view that I use: submit("Previous Step",array("name"=>"previous")); echo $html->submit("Next Step",array("name"=>"next")); ?> The end result is that at first that I stay on the same page when using Previous/Next. I realize I'm not using it right, misunderstood something, but cannot find any info that helps me see how I've got it wrong. Can anyone please point me in the right direction, I've been on a tight timeline for this project and have had lots of hurdles so far. Thanks... -- ldb --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Newbie question: how do i load the javascript helper ?
Sorry to ask such a newbie question, but i didnt find anything about it in the manual. Maybe i missed it, but anyway: how do i load the javascript helper? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
can't upload
I have an article model with an image field(I don't want to create another model). This is the code for admin_add function admin_add() { if (!empty($this->data)) { $this->cleanUpFields(); $this->Article->create(); if ($this->Article->save($this->data)) { if (!empty($this->data['Article']['image'])) { $fileup=$this->data['Article']['image']; $this->Upload->upload('$fileup','../webroot/img/ uploads/'); } $this->Session->setFlash('Article saved');$this- >redirect(array('action'=>'index'), null, true);*/ } else { $this->Session->setFlash('Article not saved'); } } } The folder uploads is 777. Where is the problem? Thank 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: cake + php5 = bad performance?
On Nov 29, 2007 10:25 AM, powtac <[EMAIL PROTECTED]> wrote: > > We did some benchmarks (not with cake) and figured out, that hard > objectorientated code in PHP5 is slower than PHP4! Ah yes, the famous 'PHP 5 is slower than PHP 4' argument. Whatever. Chances are the bottleneck in your application is going to be talking to whatever data source you're using, whether it's a database or remote web service. PHP 5 isn't the problem: crappy code by developers who don't know what they are doing is the problem. -- Chris Hartjes My motto for 2007: "Just build it, damnit!" @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cake + php5 = bad performance?
> Code with very much object orientated code. Almost everything was an > object and extended an other object... No code with only functions... ermm, isn't the whole point of an MVC framework that you shouldn't have stray functions littered throughout your code, everything is encapsulated in some form or another. j -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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 + php5 = bad performance?
Code with very much object orientated code. Almost everything was an object and extended an other object... No code with only functions... --~--~-~--~~~---~--~~ 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: Search box
Cool! im a newbee too :) sendami escribió: > I'm using cake 1.1. Are there big differences between 1.1 and 1.2? > I'm totally a newbee. I just started cake two weeks ago. > I recognized that many people are using cake 1.2. > I'll try the version and your code. > Anyway, thank you very much for your reply. > > On Nov 29, 7:50 pm, José Pablo Orozco Marín <[EMAIL PROTECTED]> > wrote: > >> Which version of cakephp are you using? >> Normally for me works the following 3 lines of code using cakephp 1.2 >> >> uses('sanitize'); >> $sanitize = new Sanitize(); >> $this->cleanData = $sanitize->clean( $this->data ); >> >> sendami escribió: >> >> >> >> >> >> >>> I got an error message like below. >>> >>> Fatal error: Call to undefined method Sanitize::clean() in C:\AppServ >>> \www\app\controllers\cms_categories_controller.php on line 18 >>> >>> ant the line 18 is below. >>> >>> $this->cleanData = $sanitize->clean( $this->data ); >>> >>> What I have to do? >>> >>> On Nov 27, 5:26 pm, Josoroma <[EMAIL PROTECTED]> wrote: >>> I clean a little bit the code :) This works for me, but my question is: Where do i have toi clean the data for thissearch, here in the controller or inside the model? function index() { $this->Benchlink->recursive = 0; uses('sanitize'); $sanitize = new Sanitize(); $this->set('findUrlNotCleaned', trim($this->data['formFind'] ['find']) ); $this->cleanData = $sanitize->clean( $this->data ); $findUrl = low( trim($this->cleanData['formFind']['find']) ); if ( $findUrl != '' ) { $this->set('benchlinks', $this->paginate('Benchlink', array("LOWER(`Benchlink`.`url`) LIKE '%" . $findUrl . "%'"))); } else { $this->set('benchlinks', $this->paginate()); } } >> -- >> >> - >> >> José Pablo Orozco Marín >> [EMAIL PROTECTED] >> >> Tel. +506 820-7280 >> >> Por favor, visite mi pasión:http://www.SukiaLogic.com/- Hide quoted text - >> >> - Show quoted text - >> > > > > > -- - José Pablo Orozco Marín [EMAIL PROTECTED] Tel. +506 820-7280 Por favor, visite mi pasión: http://www.SukiaLogic.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Multiple DBs association
there is a lot of information on this google group. You can do associations across multiple datasources. The only thing that is a little tricky is the HABTM since a third table is involved. BUt you can always create a model for that too and specify its db config. That is also discussed in previous messages to the group. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake 1.2 isUnique validation
@MrTufty: The code I posted above should work with both operations (updating and inserting). That's why the code checks if the id is set in the model (hence it's working with an existing row then, and checks all other rows for duplicates of the to-update value). On Nov 30, 2:49 pm, MrTufty <[EMAIL PROTECTED]> wrote: > Good solutions Richard, nice one. > > You may want to look into specifying the 'on' part of the validation > rule, which allows you to set whether the validation is done on > creating a new record, or updating an existing one. I'm not sure how, > if at all, that would tie into the code you've provided here. > > On Nov 30, 9:43 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > If anyone else is looking for some drop in code to handle unique > > validation, here's what I came up with. > > > This is a generic function you can drop into your app_model: > > > /** > > * checks is the field value is unqiue in the table > > * note: we are overriding the default cakephp isUnique test as the > > original appears to be broken > > * > > * @param string $data Unused ($this->data is used instead) > > * @param mnixed $fields field name (or array of field names) to > > validate > > * @return boolean true if combination of fields is unique > > */ > > > function checkUnique($data, $fields) { > > > if (!is_array($fields)) { > > > $fields = array($fields); > > > } > > > foreach($fields as $key) { > > > $tmp[$key] = $this->data[$this->name][$key]; > > > } > > > if (isset($this->data[$this->name][$this->primaryKey])) { > > > $tmp[$this->primaryKey] = > > "<>".$this->data[$this->name][$this->primaryKey]; > > > } > > > return $this->isUnique($tmp, false); > > > } > > > } > > > and is used in your model validate: > > > var $validate = array( > > "name"=>array( > > "unique"=>array( > > "rule"=>array("checkUnique", array("name", > > "institution_id")), > > "message"=>"A contact with that name > > already exists for that > > institution" > > ) > > > ) > >); > > > It will handle single or multiple fields. e.g. In the example above, > > the combination of name AND instution_id must be unique. > > > It also handles the 'edit' gotcha too. > > > Thanks for all your help :-) > > > On Nov 30, 6:35 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > > Thanks for the additional feedback. > > > > I'd already discovered the 'edit' gotcha and created a workaround > > > similar to Involution's. --~--~-~--~~~---~--~~ 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 practices for organizing tables?
I think I'll use prefixes. I forgot about the $useTable variable. I remember reading about it now that you mention it. thanks for the reply. --~--~-~--~~~---~--~~ 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: bake function, Fatal Error, Call to undefined function mysql_connect()...
> Are you suggesting that the problems you are having installing/ > configuring php cli are somehow cake's fault? Of course not, its my wrong configured/installed php (so its my fault :) ), but i was so keen on working with acl and now i still working on cli. ok... i keep on invastigating... --~--~-~--~~~---~--~~ 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: Search box
I'm using cake 1.1. Are there big differences between 1.1 and 1.2? I'm totally a newbee. I just started cake two weeks ago. I recognized that many people are using cake 1.2. I'll try the version and your code. Anyway, thank you very much for your reply. On Nov 29, 7:50 pm, José Pablo Orozco Marín <[EMAIL PROTECTED]> wrote: > Which version of cakephp are you using? > Normally for me works the following 3 lines of code using cakephp 1.2 > > uses('sanitize'); > $sanitize = new Sanitize(); > $this->cleanData = $sanitize->clean( $this->data ); > > sendami escribió: > > > > > > > I got an error message like below. > > > Fatal error: Call to undefined method Sanitize::clean() in C:\AppServ > > \www\app\controllers\cms_categories_controller.php on line 18 > > > ant the line 18 is below. > > > $this->cleanData = $sanitize->clean( $this->data ); > > > What I have to do? > > > On Nov 27, 5:26 pm, Josoroma <[EMAIL PROTECTED]> wrote: > > >> I clean a little bit the code :) > >> This works for me, but my question is: > >> Where do i have toi clean the data for thissearch, here in the > >> controller or inside the model? > > >> function index() { > > >> $this->Benchlink->recursive = 0; > > >> uses('sanitize'); > >> $sanitize = new Sanitize(); > > >> $this->set('findUrlNotCleaned', > >> trim($this->data['formFind'] > >> ['find']) ); > > >> $this->cleanData = $sanitize->clean( $this->data ); > > >> $findUrl = low( trim($this->cleanData['formFind']['find']) > >> ); > > >> if ( $findUrl != '' ) { > > >> $this->set('benchlinks', > >> $this->paginate('Benchlink', > >> array("LOWER(`Benchlink`.`url`) LIKE '%" . $findUrl . "%'"))); > > >> } else { > > >> $this->set('benchlinks', $this->paginate()); > > >> } > > >> } > > -- > > - > > José Pablo Orozco Marín > [EMAIL PROTECTED] > > Tel. +506 820-7280 > > Por favor, visite mi pasión:http://www.SukiaLogic.com/- Hide quoted text - > > - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: email component - smtp auth (SOLVED?)
Seems like it would be better to change the default value to CRLF, it's also used in header section where CRLF is mandatory too. >From rfc821: HELO MAIL FROM: RCPT TO: DATA On Nov 30, 12:33 pm, Gorka <[EMAIL PROTECTED]> wrote: > Changed $this->_newLine from "\n" to "\r\n" and mail started to work. > The CRLF thing applies to the whole email, and not just the ending > "CRLF.CRLF"... I should have slept a bit more before reading the > dmtplf doc! > > Anyway, if it is mandatory to end lines with CRLF and not just CR, > shouldn't _newLine have a default value of CRLF? > > On 30 nov, 12:11, Gorka <[EMAIL PROTECTED]> wrote: > > > My fault... I was starting an SMTP connection on localhost, which is > > of course whitelisted. Solved. > > > Still mail wasn't delivered, so I updated the email component to the > > latest nightly build and now I'm getting a "451 > > Seehttp://pobox.com/~djb/docs/smtplf.html"; SMTP error. Before the update > > the log file for qmail was showing the same error, but now Cake knows > > it was rejected. Far as I can tell, though, the SMTP send code in > > email component looks ok to me, ending the connection with a "LF.LF": > > > if (!$this->__sendData($this->__header . "\r\n" . $this->__message . > > "\r\n\r\n\r\n.\r\n")) { > > > On 28 nov, 18:34, atomic <[EMAIL PROTECTED]> wrote: > > > > Just a quick guess: > > > You are sending from a whitelistened ip and don't need to auth on your > > > test system / on your testsystem SMTP Auth is disabled ? > > > > On Nov 28, 12:47 pm, Gorka <[EMAIL PROTECTED]> wrote: > > > > > In fact, on the test server I get a "503 You are already > > > > authenticated" error message. > > > > > On 27 nov, 16:17, atomic <[EMAIL PROTECTED]> wrote: > > > > > > Afaik this fix is already comitted in the latest nightly builds. > > > > > What do you mean with "they still don't seem to arrive". > > > > > > Is mail delivered correctly to your MTA but does not reach recipient ? > > > > > Do you have access to MTA logs ? > > > > > > On Nov 26, 7:04 pm, Gorka <[EMAIL PROTECTED]> wrote: > > > > > > > I had this same issue, the server was responding "235 GO AHEAD" ans > > > > > > not "OKauthenticated". This fixed the error on send, though emails > > > > > > still don't seem to arrive. > > > > > > > On 29 oct, 21:35, atomic <[EMAIL PROTECTED]> wrote: > > > > > > > > I had some problems sending mail using smtp auth. > > > > > > > MTA (postfix) always told me "lost connection after auth" > > > > > > > > Theemailcomponent is testing for "OKAuthenticated" > > > > > > > which seems not RFC compliant to me, so i changend testing > > > > > > > for return value into "235". > > > > > > > >email.php line 744: > > > > > > > if (stristr($response, '235') === false) > > > > > > > > This should match most common used MTA. > > > > > > > > Regards, > > > > > > > Andreas- Ocultar texto de la cita - > > > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > > - Mostrar texto de la cita - --~--~-~--~~~---~--~~ 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 form helper without model?
What controller is your form calling ? Usually a form is submited, so where do you submit it ?: You can use any name for the 'model' i guess as long as you have controller to handle it .. On Nov 30, 2:14 pm, avairet <[EMAIL PROTECTED]> wrote: > Hi everybody, > > I'm looking for a trick to use a form without a model. > My form doesn't save POST'ed variables in a table, it just save them > in session to simply display on another page. > > But when I make "$form->create(null);", all field's names contain the > name of the current model, like "data[Model][Fieldname]" in the HTML > form... > > How avoid this? I would juste have something like "data[Fieldname]"... > > For example (where current model is "Magazine"): > $form->create(null); > $form->input('Rubrique'); > $form->end('Valider'); > > And the HTML result is: > > Rubrique > id="MagazineRubrique" /> > > > > And what I want ("Magazine" model never appear): > > Rubrique > div> > > > > Thank's in advance and excuse me for my simple frenchy English! > > Avairet --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Cake 1.2 isUnique validation
Good solutions Richard, nice one. You may want to look into specifying the 'on' part of the validation rule, which allows you to set whether the validation is done on creating a new record, or updating an existing one. I'm not sure how, if at all, that would tie into the code you've provided here. On Nov 30, 9:43 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > If anyone else is looking for some drop in code to handle unique > validation, here's what I came up with. > > This is a generic function you can drop into your app_model: > > /** > * checks is the field value is unqiue in the table > * note: we are overriding the default cakephp isUnique test as the > original appears to be broken > * > * @param string $data Unused ($this->data is used instead) > * @param mnixed $fields field name (or array of field names) to > validate > * @return boolean true if combination of fields is unique > */ > > function checkUnique($data, $fields) { > > if (!is_array($fields)) { > > $fields = array($fields); > > } > > foreach($fields as $key) { > > $tmp[$key] = $this->data[$this->name][$key]; > > } > > if (isset($this->data[$this->name][$this->primaryKey])) { > > $tmp[$this->primaryKey] = > "<>".$this->data[$this->name][$this->primaryKey]; > > } > > return $this->isUnique($tmp, false); > > } > > } > > and is used in your model validate: > > var $validate = array( > "name"=>array( > "unique"=>array( > "rule"=>array("checkUnique", array("name", > "institution_id")), > "message"=>"A contact with that name already > exists for that > institution" > ) > > ) >); > > It will handle single or multiple fields. e.g. In the example above, > the combination of name AND instution_id must be unique. > > It also handles the 'edit' gotcha too. > > Thanks for all your help :-) > > On Nov 30, 6:35 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > Thanks for the additional feedback. > > > I'd already discovered the 'edit' gotcha and created a workaround > > similar to Involution's. --~--~-~--~~~---~--~~ 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: bake function, Fatal Error, Call to undefined function mysql_connect()...
On Nov 30, 2:07 pm, lynch <[EMAIL PROTECTED]> wrote: > Will i ever come back to cakephp? :) Are you suggesting that the problems you are having installing/ configuring php cli are somehow cake's fault? --~--~-~--~~~---~--~~ 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: bake function, Fatal Error, Call to undefined function mysql_connect()...
@ Chris HartjesI reinstalled it and i got a error after the mak install. Installing PHP SAPI module: apache2handler /usr/share/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apache2/ build/libtool' libphp5.la /usr/lib/apache2 /usr/share/apache2/build/libtool --mode=install cp libphp5.la /usr/lib/ apache2/ cp .libs/libphp5.so /usr/lib/apache2/libphp5.so cp .libs/libphp5.lai /usr/lib/apache2/libphp5.la libtool: install: warning: remember to run `libtool --finish /usr/ share/php-5.2.5/libs' chmod 755 /usr/lib/apache2/libphp5.so apxs:Error: Config file /etc/apache2/httpd2-prefork.conf not found. make: *** [install-sapi] Error 1 And i still got the line. > PHP 4.4.0 (cli) (built: Dec 10 2005 15:39:24) Will i ever come back to cakephp? :) --~--~-~--~~~---~--~~ 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: Facing problem on Joining table using HABTM
More details are as below: on the view Test size checkboxMultiple('Service.Size', $sizes_list) ?> Test types checkboxMultiple('Service.Group', $groups_list) ?> Test Payments checkboxMultiple('Service.Payment', $payments_list) ?> And the name of the table must be groups_services,services_sizes and joining table is sizes_groups_payments. Fields for the tables groups_services service_id group_id services_sizes service_id size_id On joining table service_id size_id group_id payment_id. These are all the things thats made on this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Using form helper without model?
Hi everybody, I'm looking for a trick to use a form without a model. My form doesn't save POST'ed variables in a table, it just save them in session to simply display on another page. But when I make "$form->create(null);", all field's names contain the name of the current model, like "data[Model][Fieldname]" in the HTML form... How avoid this? I would juste have something like "data[Fieldname]"... For example (where current model is "Magazine"): $form->create(null); $form->input('Rubrique'); $form->end('Valider'); And the HTML result is: Rubrique And what I want ("Magazine" model never appear): Rubrique Thank's in advance and excuse me for my simple frenchy English! Avairet --~--~-~--~~~---~--~~ 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: Facing problem on Joining table using HABTM
More details are as below: on the view DogSizes checkboxMultiple('Service.Size', $sizes_list) ?> DogGroup_Types checkboxMultiple('Service.Group', $groups_list) ?> Payments_Types checkboxMultiple('Service.Payment', $payments_list) ?> And the name of the table must be groups_services,services_sizes and joining table is sizes_groups_payments. Fields for the tables groups_services service_id group_id services_sizes service_id size_id On joining table service_id size_id group_id payment_id. These are all the things thats made on this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---