Re: Routing - Using a column other than Id
Exactly like you would an ID. You just except a string instead of an integer, when writing the regex. Even then you can do it with basic routing. // Link $html->link('Title', array('controller' => 'posts', 'action' => 'view', $slug)); // Action function view($slug) { } On Jan 14, 10:53 pm, Robin Thomas wrote: > Hi.. > > I am new to cake php. Here is my task. > > Present URL : > > www.example.com/post/view/1 { where '1' is the Id of the post. } > > I want to use a column other than Id(a column called URL) to be > passed for SEO. > > www.example.com/post/view/my-first-post {where my-first-post is > the value of the URL column in my table } > > How can I map this ? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How to saveField without affecting modified
Use the models updateAll method! From what I can read from the source, this method does not change the modified column. This method is also used by the counterCache update method, and the counterCache does not change the modified column, so give it a try. See: updateAll(array $fields, array $conditions) at http://book.cakephp.org/view/75/Saving-Your-Data Enjoy, John On Jan 15, 5:20 am, Alfred Pakenham wrote: > Hi, > I'm sure I have seen this somewhere, but can't remember where. How do I save > a field and make sure that modified is not changed? > For example I have a view column in my posts table, in my view action I do > this after finding the post: > $views = $post['Post']['views'] + 1; > $this->Post->id = $post['Post']['id']; > $this->Post->saveField('views', $views); > > Now, I understand that modifying a record and not wanting to affect modified > field may sound odd, but there are rare cases when you want to do that, > yet many more when you want standard behavior. The only solution I have > found so far is to directly use query, which understandably I would like to > avoid. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)
What you want is Virtual Fields! Virtual fields is one of the new features in CakePHP 1.3 and is there to solve your EXACT problem. http://cakephp.lighthouseapp.com/projects/42648/13-new-features-virtual-fields On Jan 14, 3:04 pm, John Andersen wrote: > As far as I know, there is no solution! > But my suggestion was that formatting for presentation is not a good > thing to do at the database level, but in CakePHP is performed in the > view. > That way you have all the possibilities to use the date not only for > presentation but also for processing (comparision, different > presentations, etc.) > Anyway, as soon as you use a function in the database query, the alias > you assign it goes outside the model array and you can only get it > back in by using afterFind callback method. > Somebody please correct me if I am wrong on this :) > Enjoy, > John > > On Jan 14, 2:48 pm, codef0rmer wrote: > > > @John Andersen: thx but there has to be a solution instead of > > formatting in view file > > > @Azril Nazli: :-( no luck... it says, sql query error. here is the > > below query: > > SELECT `GenderSalutation`.`name`, `User`.`first_name`, > > `User`.`middle_name`, `User`.`last_name`, `User`.`address`, DATE_FORMAT > > (User.created, '%d') AS User.created, `User`.`mobile`, `User`.`dob`, > > `User`.`experience` FROM `users` AS `User` LEFT JOIN > > `gender_salutations` AS `GenderSalutation` ON > > (`User`.`gender_salutation_id` = `GenderSalutation`.`id`) WHERE > > `User`.`email` = 'amit.2006...@gmail.com' LIMIT 1 > > > SQL Error: 1064: You have an error in your SQL syntax; check the > > manual that corresponds to your MySQL server version for the right > > syntax to use near '.created > > > Any other solution... please help Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Routing - Using a column other than Id
Hi.. I am new to cake php. Here is my task. Present URL : www.example.com/post/view/1 { where '1' is the Id of the post. } I want to use a column other than Id(a column called URL) to be passed for SEO. www.example.com/post/view/my-first-post {where my-first-post is the value of the URL column in my table } How can I map this ? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HATBM relations + aggregate functions
Hello, try this :- $this->Demo->paginate= array('fields'=>array('You fields','sum(amount)')); $this->Demo->paginate('Demo'); Regards, Amit Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Controller Actions
Hello Dave, You can use:- $c_class=get_class(); $c_methods = get_class_methods($c_class); $c_methods will give you an array of all the methods of the current class. Regards, Amit Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
adding multiple translations in i18n table for single record
Hi All, I am having trouble trying to add multiple translations for a single record, basically I have the follwing setup: tables: [content] [i18n] now I want to be able to add multiple translations for a single record so i have the following; [content][record 1] [i18n][en-gb] [i18n][fr-fr] the only way i can acheive this is by creating a new record in the main table each time which completely defeats the purpose. Coul Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Controller Actions
Does anyone know how to get a list of all the actions in the controller? Not all actions in all controllers, just the current controller being accessed. Thanks Dave Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Slow Response when using Email Component
One of possible cases - slow SMTP server. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CakePHP 1.2.5 HTML Code in Form Fields
Never mind. I had any over-rigorous form data cleanup in the before_filter of my app_controller.php. On Jan 14, 11:25 pm, Dewald Pretorius wrote: > Hope someone can help me with this issue. When I enter HTML code in a > text or textarea field and submit, the HTML code is somewhere > automatically stripped out by CakePHP. > > At the very top of my controller function (just after !empty($this- > data) and before any validation or my own cleanup is done), I echo > $this->data['Model']['field'] as well as $_POST['data']['Model'] > ['field']. > > The HTML code that I entered on the form is in the $_POST array, but > it is absent in the $this->data array. > > Any ideas? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP 1.2.5 HTML Code in Form Fields
Hope someone can help me with this issue. When I enter HTML code in a text or textarea field and submit, the HTML code is somewhere automatically stripped out by CakePHP. At the very top of my controller function (just after !empty($this- data) and before any validation or my own cleanup is done), I echo $this->data['Model']['field'] as well as $_POST['data']['Model'] ['field']. The HTML code that I entered on the form is in the $_POST array, but it is absent in the $this->data array. Any ideas? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to saveField without affecting modified
Hi, I'm sure I have seen this somewhere, but can't remember where. How do I save a field and make sure that modified is not changed? For example I have a view column in my posts table, in my view action I do this after finding the post: $views = $post['Post']['views'] + 1; $this->Post->id = $post['Post']['id']; $this->Post->saveField('views', $views); Now, I understand that modifying a record and not wanting to affect modified field may sound odd, but there are rare cases when you want to do that, yet many more when you want standard behavior. The only solution I have found so far is to directly use query, which understandably I would like to avoid. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
ah - screwed up my auth/login!
i didnt know until i was notified about this bug somehow people get a white screen of death while trying to log in doesnt matter if it is successfull (after one reload they are then logged in) or if they fail the authentication the auth component seems to work - returns true or false on login() i traced it down to sth right between the end of beforeFilter() and the current login() method in users controller but what is happening there? the login() method is not invoked anymore the beforeFilter one finished, though and then it suddendly stops - no error/warning, no log content, nothing totally clueless here and since i dont know when it happened i cant even go back in svn without a real mess... it used to work a few days ago - i am sure of that. anyone an idea how i could track it down to its source? thx in advance Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
ACL Question
I get this error as soon as i login Could not find AclComponent. Please include Acl in Controller::$components. [CORE/cake/libs/controller/components/auth.php, line 378] Fatal error: Call to a member function check() on a non-object in /home4/public_html/cake/libs/controller/components/auth.php on line 480 But I am not using ACL, nor do I want to. Cant seem to figure out where this is coming from or why. Any ideas? No idea where to start Thanks Dave Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Pagination Sorting on 2 or More Columns
When paginating data in a view, is there a relatively straightforward way to sort a table of data on 2 or more columns...such as last name, then first name? Or, on a derived column, such as age, after being derived from date of birth? Thanks, David Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Unable to save related table information
Hi, thanks for your suggestion. I tried it but I am still having the same problem. Nadal wrote: > > Hi, koala kid > Try to add 'foreignKey' It can cause your problem. > class Rental extends AppModel > { >var $name = 'Rental'; > >var $hasOne = array( >'Rate' => array( >'className'=> 'Rate', >'foreignKey' => 'rental_id', >'dependent'=> true >) >); >var $belongsTo = array( >'Location' => array( >'className' => 'Location', >'foreignKey' => 'rental_id', >'fields'=> 'city' >) >); > > } > ?> > > Then $this->Rental->saveAll($this->data); should be work.:-P > > class Rate extends AppModel > { >var $name = 'Rate'; > >var $belongsTo = array( >'Rentals' => array( >'className'=> 'Rate', >'foreignKey' => 'rental_id', >'dependent'=> true >) > > } > > > koala kid wrote: >> >> Hi all, >> >> using ORM for the first time and I'm having trouble getting my >> associations all worked out. I'm unable to get my associated table data >> to save.Here's a basic overview of my models: >> >> Locations -> Parent >> Rentals -> Belongs to Locations >> Rates -> Belongs to Rentals >> >> My code looks like this: >> >> > class Rental extends AppModel >> { >>var $name = 'Rental'; >> >>var $hasOne = array( >>'Rate' => array( >>'className'=> 'Rate', >>'dependent'=> true >>) >>); >>var $belongsTo = array( >>'Location' => array( >>'className' => 'Location', >>'fields'=> 'city' >>) >>); >> >> } >> ?> >> >> class Rate extends AppModel >> { >>var $name = 'Rate'; >> >>var $belongsTo = 'Rentals'; >> >> } >> >> And my save looks like this: >> >> $this->Rental->saveAll($this->data) >> >> However only data to the Rental table is being saved and not to the Rate >> table. Can anyone tell me what I am missing. I don't have a controller >> for Rates as there are no direct functions to run against them, does this >> matter? >> >> >> Thanks. >> > > -- View this message in context: http://old.nabble.com/Unable-to-save-related-table-information-tp27153345p27170148.html Sent from the CakePHP mailing list archive at Nabble.com. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Unable to save related table information
Thanks for your input. It looks like below. I think I may have the Model name in the wrong place?? I'm using: echo $form->create('Rental', array('type' => 'file', 'action' => 'edit')); to create the form. Array ( [Rental] => Array ( [id] => 60 [rental_code] => code [location_id] => 37 [rental_agent] => a...@gmail.com [rental_meta_title] => meta title [rental_meta_desc] => meta desc [rental_meta_tags] => meta kewords [rental_short_title] => location title [rental_short_desc] => location desc [rental_title] => prop title [rental_location] => prop location desc [rental_description] => prop desc [rental_features] => feature list [rental_reviews] => review link [rental_availability] => availability link [rental_gallery] => slideshow link [rental_weather] => weather widget [rental_extra_info] => extra info [Rate/s1_title] => 1 [Rate/s1_day] => [Rate/s1_week] => [Rate/s1_month] => [Rate/s2_title] => [Rate/s2_day] => [Rate/s2_week] => [Rate/s2_month] => [Rate/s3_title] => [Rate/s3_day] => [Rate/s3_week] => [Rate/s3_month] => [Rate/s4_title] => [Rate/s4_day] => [Rate/s4_week] => [Rate/s4_month] => [Rate/extra_info] => [rental_short_thumb] => holder.gif ) ) John Andersen-6 wrote: > > How does your data look like before the saveAll statement? > Enjoy, >John > > On Jan 14, 12:41 am, koala kid wrote: >> Hi all, >> >> using ORM for the first time and I'm having trouble getting my >> associations >> all worked out. I'm unable to get my associated table data to save.Here's >> a >> basic overview of my models: >> >> Locations -> Parent >> Rentals -> Belongs to Locations >> Rates -> Belongs to Rentals >> >> My code looks like this: >> >> > class Rental extends AppModel >> { >> var $name = 'Rental'; >> >> var $hasOne = array( >> 'Rate' => array( >> 'className' => 'Rate', >> 'dependent' => true >> ) >> ); >> var $belongsTo = array( >> 'Location' => array( >> 'className' => 'Location', >> 'fields' => 'city' >> ) >> ); >> >> } >> >> ?> >> >> class Rate extends AppModel >> { >> var $name = 'Rate'; >> >> var $belongsTo = 'Rentals'; >> >> } >> >> And my save looks like this: >> >> $this->Rental->saveAll($this->data) >> >> However only data to the Rental table is being saved and not to the Rate >> table. Can anyone tell me what I am missing. I don't have a controller >> for >> Rates as there are no direct functions to run against them, does this >> matter? >> >> Thanks. >> -- >> View this message in >> context:http://old.nabble.com/Unable-to-save-related-table-information-tp2715... >> Sent from the CakePHP mailing list archive at Nabble.com. > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php?hl=en > > -- View this message in context: http://old.nabble.com/Unable-to-save-related-table-information-tp27153345p27170133.html Sent from the CakePHP mailing list archive at Nabble.com. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: highest traffic cakePHP 1.2 sites?
Oh I also forgot, Hotscripts runs Cake. http://hotscripts.com On Jan 14, 12:19 am, Matt Bianco wrote: > It's a German car pooling / ride sharing platform:www.mitfahrgelegenheit.de > Thanks to cake we can easily do our roll outs to other countries > (e.g.www.pamemazi.grwhere we are already live), others will follow in the > next weeks. > > On 13 Jan., 13:41, Jon Bennett wrote: > > > > We serve >35M PVs (>2M visits) per month. > > > Who/what is 'we'? > > > j > > > -- > > jon bennett -www.jben.net-blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Lost a couple of hours on whitespace after a closing "?>" php tag
http://www.milesj.me/blog/read/71/PHP-Pro-Tip-Dont-Close-Your-PHP-Documents-With On Jan 14, 8:19 am, keymaster wrote: > Bingo ! > > Thank you. > > Surprisingly, there were quite a few cake files in the core with > trailing white spaces, as well. > > I opened a ticket in lighthouse on this, attached David's shell, and > suggested perhaps they may want to include this shell as part of the > regular test run: > > http://cakephp.lighthouseapp.com/projects/42648/tickets/201-shell-for... > > Thanks again for taking the time to respond, Brendon. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Validation with 'on' key is not working in CakePHP 1.2.5?
Using CakePHP 1.2.5 and it seems the 'on' key option is broken. In the following code defined in my model, var $validate = array( 'original_domain' => array( 'domainRule1' => array( 'rule' => array('checkUnique', 'original_domain'), 'on'=>'create', 'message' => 'The original domain field already exists.' ) ) ); If the 'on' key is set, my custom validation will never be called. Removing it and my validation will be called. I tried all combination like 'on'=>'edit', 'on'=>'add' and it just seems as soon as 'on' key is introduced to the rule, that rule will be called at all. I want my validation to be enforced during a record creation. To get around this problem, I add a controllerAction variable in my model and have it set in my controller's beforeFilter(). Just wonder if this is just my issue or a CakePHP bug. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Slow Response when using Email Component
I've been having a little bit of a problem with my app when using the Email component. I have a simple "Contact" form with around 8-10 fields. When the user submits the form, the data is stored in the database as well as sending out an email to the admin that a submission has been made. For some reason, the submission of the form takes about 10-15 seconds to be processed. If I remove the $this->Email->send(); is it basically instantaneous. Any ideas? I'll past my controller logic below. function add() { $show_form = true; if (!empty($this->data)) { $this->ClientInquery->create(); if ($this->ClientInquery->save($this->data)) { $this->Session->setFlash('Your inquery has been sent! Someone from our studio should contact you within 1-2 business days.', 'flash_message'); $show_form = false; $this->set('ClientInquery', $this->data); //send email to admin as reminder $this->Email->reset(); $this->Email->to = 'ad...@gmail.com'; $this->Email->subject = "Photography Inquery - " . $this->data['ClientInquery']['name']; $this->Email->template = "photography_inquery"; $this->Email->from = "no-re...@gmail.com"; $this->Email->sendAs = 'html'; // because we like to send pretty mail $this->Email->send(); } else { $this->Session->setFlash('Your inquery has not been sent! Please fix errors.', 'flash_message'); } } $this->set('show_form', $show_form); } As I said. It's very basic and the problem goes away when I simply remove the $this->Email->send(). Any ideas? -Jesse Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
the getColumnType() is making me think there is something with the data and either your model or your database. can you show us both your model and database scheme for this table? On Jan 14, 3:02 pm, MrDevin wrote: > Thanks, > This is a good idea. I am at home now I will try changing my > controller in the morning. (posting from Germany) > But I think that this has more to do with the Model which is called > Datum but at this poin I am willing to try anything so i will give it > a shot. > > On Jan 14, 6:43 pm, scs wrote: > > > could calling your control data be a conflict with cakephp? > > > On Jan 14, 11:37 am, MrDevin wrote: > > > > First of all thanks for your insight and taking the time to help. :D > > > > if $this->data['Datum'] is as follows: > > > [code] > > > Array > > > ( > > > [0] => Array > > > ( > > > [id] => 173 > > > [form_id] => 208 > > > [field_id] => 56 > > > [user_id] => 1 > > > [bool_val] => 0 > > > ) > > > > [1] => Array > > > ( > > > [id] => 174 > > > [form_id] => 208 > > > [field_id] => 64 > > > [user_id] => 1 > > > [bool_val] => 0 > > > ) > > > > ) > > > [/code] > > > > I get the same error. > > > > to give a bit more info I have done more testing and this is what has > > > turned up > > > > [EDIT] > > > > So I did as one Poster on stackoverflow suggested and this is what I > > > got when putting "debug($model);" on cake/libs/model/model.php (line > > > 949): > > > > cake/libs/model/model.php (line 949) > > > > data //this being what debug() returns > > > > Fatal error: Call to a member function getColumnType() on a non- > > > object in /cake/libs/model/model.php on line 950 > > > > I might see what is wrong my model name is Datum or datum.php not data > > > I have no obvious solution in my head, this is a bit deep in Cake for > > > me. Any Suggestions? > > > > In "view" method with the same debug statement it outputs "Datum" and > > > not "data" like I get from my "edit" method. Just in case that is > > > helpful to anyone. > > > > Thanks:) > > > > On Jan 14, 5:16 pm, John Andersen wrote: > > > > > I stand corrected :) > > > > The only other issue I see, is that your edit array does not start > > > > from 0! > > > > Could your view be made to not include the id as the array key? Like: > > > > > [code] > > > > echo $form->hidden('Datum.[].id', array('value' => $field_datum > > > > ['id'])); > > > > [/code] > > > > > I am grasping for straw here :D > > > > Enjoy, > > > > John > > > > > On Jan 14, 5:47 pm, MrDevin wrote: > > > > > > When I do the following in my "edit" method > > > > > > [code] > > > > > $this->Datum->saveAll($this->data) > > > > > [/code] > > > > > > I get one new row in the "data" table with all of the columns empty. > > > > > > reference:http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with... > > > > > > On Jan 14, 3:55 pm, John Andersen wrote: > > > > > > > It seems a little odd to me that you are using: > > > > > > > [code] > > > > > > $this->Datum->saveAll($this->data['Datum']) > > > > > > [/code] > > > > > > > I would assume that the correct form (the one I always use) is: > > > > > > > [code] > > > > > > $this->Datum->saveAll($this->data) > > > > > > [/code] > > > > > > > so that the model, when processing the data, can recognise the model > > > > > > to which the data belongs! > > > > > > Enjoy, > > > > > > John Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
HATBM relations + aggregate functions
Hi, i have some problems with cakephp paginator helper. i have two tables with HATBM relation, contributions and details. in the last one i have an amount field (decimal). i would like to get the sum(amount) in my paginate resultset. i try to bind model but it doesnt work for me. i need your advices.. thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Multiple Account Types
I have an application I am trying to build. I have ACL setup and I have the following groups. -Admin -Merchants -Users I want to be able to signup all users by selecting what group they belong to and enter a username and pass for them. Then once they are registered they can edit there account. Merchant accounts will be different from users accounts and will use different database tables. How would I go about setting up authentication for users and merchants while keeping there account data tied to their login info so if there login gets deleted their profile gets deleted? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
Thanks, This is a good idea. I am at home now I will try changing my controller in the morning. (posting from Germany) But I think that this has more to do with the Model which is called Datum but at this poin I am willing to try anything so i will give it a shot. On Jan 14, 6:43 pm, scs wrote: > could calling your control data be a conflict with cakephp? > > On Jan 14, 11:37 am, MrDevin wrote: > > > > > First of all thanks for your insight and taking the time to help. :D > > > if $this->data['Datum'] is as follows: > > [code] > > Array > > ( > > [0] => Array > > ( > > [id] => 173 > > [form_id] => 208 > > [field_id] => 56 > > [user_id] => 1 > > [bool_val] => 0 > > ) > > > [1] => Array > > ( > > [id] => 174 > > [form_id] => 208 > > [field_id] => 64 > > [user_id] => 1 > > [bool_val] => 0 > > ) > > > ) > > [/code] > > > I get the same error. > > > to give a bit more info I have done more testing and this is what has > > turned up > > > [EDIT] > > > So I did as one Poster on stackoverflow suggested and this is what I > > got when putting "debug($model);" on cake/libs/model/model.php (line > > 949): > > > cake/libs/model/model.php (line 949) > > > data //this being what debug() returns > > > Fatal error: Call to a member function getColumnType() on a non- > > object in /cake/libs/model/model.php on line 950 > > > I might see what is wrong my model name is Datum or datum.php not data > > I have no obvious solution in my head, this is a bit deep in Cake for > > me. Any Suggestions? > > > In "view" method with the same debug statement it outputs "Datum" and > > not "data" like I get from my "edit" method. Just in case that is > > helpful to anyone. > > > Thanks:) > > > On Jan 14, 5:16 pm, John Andersen wrote: > > > > I stand corrected :) > > > The only other issue I see, is that your edit array does not start > > > from 0! > > > Could your view be made to not include the id as the array key? Like: > > > > [code] > > > echo $form->hidden('Datum.[].id', array('value' => $field_datum > > > ['id'])); > > > [/code] > > > > I am grasping for straw here :D > > > Enjoy, > > > John > > > > On Jan 14, 5:47 pm, MrDevin wrote: > > > > > When I do the following in my "edit" method > > > > > [code] > > > > $this->Datum->saveAll($this->data) > > > > [/code] > > > > > I get one new row in the "data" table with all of the columns empty. > > > > > reference:http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with... > > > > > On Jan 14, 3:55 pm, John Andersen wrote: > > > > > > It seems a little odd to me that you are using: > > > > > > [code] > > > > > $this->Datum->saveAll($this->data['Datum']) > > > > > [/code] > > > > > > I would assume that the correct form (the one I always use) is: > > > > > > [code] > > > > > $this->Datum->saveAll($this->data) > > > > > [/code] > > > > > > so that the model, when processing the data, can recognise the model > > > > > to which the data belongs! > > > > > Enjoy, > > > > > John Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Eclipse + PDT 2.1 - How to include the Cake core application
On 1/14/2010 12:03 PM, hasentopf wrote: Can anyone explain how I can include the Cake core application in my projects??? Many thanks! I'm using Build id: 20090920-1017. Project -> PHP Include PATH -> Libraries -> Add External Source Folder... -> select Core location -> Done. HTH. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Accessing Parent Record Data
On 1/14/2010 8:08 AM, emptywalls wrote: That did it! Thanks so much! Took a little figuring out, but I see what ya did there. After you get a hang of the Containable behavior you'll never use anything else. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Tags HATBM Tags?
I will not state whether it is a good or a bad idea! Rather I would like to ask the question: Do you have a need for this relationship Tag HABTM Tag? In other words, what are the reason/requirement for making this solution? If you can answer the above, and your solution solves it, then it is a good idea :) Enjoy, John On Jan 14, 8:47 pm, Ian R wrote: > Hey! So ideally, in the whole Posts, Users, Tags model, I'd like to > have Tags which are "related to" other Tags. This seems simple enough > though I haven't gotten it working quite yet. > > I've set up a "tags_tags" table with fields id, tag1_id and tag2_id... > and in my Tag model I've set these as the $hasAndBelongsToMany[Tag] > foreignKey and associationForeignKey. I'm not really sure what else > I'll need to do, but here's my issue: > > This self-referencing seems a little convoluted (though mostly > straightforward), and I haven't found any reference in these archives > or on the internet anywhere, really. SOMETIMES :) when I have an > interesting idea like this and can't find evidence that it has already > been thought of, it turns out that it's not such a great idea. So, > basically, is this a stupid idea? Tags HABTM Tags? > > thanks! > Ian Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
could calling your control data be a conflict with cakephp? On Jan 14, 11:37 am, MrDevin wrote: > First of all thanks for your insight and taking the time to help. :D > > if $this->data['Datum'] is as follows: > [code] > Array > ( > [0] => Array > ( > [id] => 173 > [form_id] => 208 > [field_id] => 56 > [user_id] => 1 > [bool_val] => 0 > ) > > [1] => Array > ( > [id] => 174 > [form_id] => 208 > [field_id] => 64 > [user_id] => 1 > [bool_val] => 0 > ) > > ) > [/code] > > I get the same error. > > to give a bit more info I have done more testing and this is what has > turned up > > [EDIT] > > So I did as one Poster on stackoverflow suggested and this is what I > got when putting "debug($model);" on cake/libs/model/model.php (line > 949): > > cake/libs/model/model.php (line 949) > > data //this being what debug() returns > > Fatal error: Call to a member function getColumnType() on a non- > object in /cake/libs/model/model.php on line 950 > > I might see what is wrong my model name is Datum or datum.php not data > I have no obvious solution in my head, this is a bit deep in Cake for > me. Any Suggestions? > > In "view" method with the same debug statement it outputs "Datum" and > not "data" like I get from my "edit" method. Just in case that is > helpful to anyone. > > Thanks:) > > On Jan 14, 5:16 pm, John Andersen wrote: > > > I stand corrected :) > > The only other issue I see, is that your edit array does not start > > from 0! > > Could your view be made to not include the id as the array key? Like: > > > [code] > > echo $form->hidden('Datum.[].id', array('value' => $field_datum > > ['id'])); > > [/code] > > > I am grasping for straw here :D > > Enjoy, > > John > > > On Jan 14, 5:47 pm, MrDevin wrote: > > > > When I do the following in my "edit" method > > > > [code] > > > $this->Datum->saveAll($this->data) > > > [/code] > > > > I get one new row in the "data" table with all of the columns empty. > > > > reference:http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with... > > > > On Jan 14, 3:55 pm, John Andersen wrote: > > > > > It seems a little odd to me that you are using: > > > > > [code] > > > > $this->Datum->saveAll($this->data['Datum']) > > > > [/code] > > > > > I would assume that the correct form (the one I always use) is: > > > > > [code] > > > > $this->Datum->saveAll($this->data) > > > > [/code] > > > > > so that the model, when processing the data, can recognise the model > > > > to which the data belongs! > > > > Enjoy, > > > > John Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
First of all thanks for your insight and taking the time to help. :D if $this->data['Datum'] is as follows: [code] Array ( [0] => Array ( [id] => 173 [form_id] => 208 [field_id] => 56 [user_id] => 1 [bool_val] => 0 ) [1] => Array ( [id] => 174 [form_id] => 208 [field_id] => 64 [user_id] => 1 [bool_val] => 0 ) ) [/code] I get the same error. to give a bit more info I have done more testing and this is what has turned up [EDIT] So I did as one Poster on stackoverflow suggested and this is what I got when putting "debug($model);" on cake/libs/model/model.php (line 949): cake/libs/model/model.php (line 949) data //this being what debug() returns Fatal error: Call to a member function getColumnType() on a non- object in /cake/libs/model/model.php on line 950 I might see what is wrong my model name is Datum or datum.php not data I have no obvious solution in my head, this is a bit deep in Cake for me. Any Suggestions? In "view" method with the same debug statement it outputs "Datum" and not "data" like I get from my "edit" method. Just in case that is helpful to anyone. Thanks:) On Jan 14, 5:16 pm, John Andersen wrote: > I stand corrected :) > The only other issue I see, is that your edit array does not start > from 0! > Could your view be made to not include the id as the array key? Like: > > [code] > echo $form->hidden('Datum.[].id', array('value' => $field_datum > ['id'])); > [/code] > > I am grasping for straw here :D > Enjoy, > John > > On Jan 14, 5:47 pm, MrDevin wrote: > > > When I do the following in my "edit" method > > > [code] > > $this->Datum->saveAll($this->data) > > [/code] > > > I get one new row in the "data" table with all of the columns empty. > > > reference:http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with... > > > On Jan 14, 3:55 pm, John Andersen wrote: > > > > It seems a little odd to me that you are using: > > > > [code] > > > $this->Datum->saveAll($this->data['Datum']) > > > [/code] > > > > I would assume that the correct form (the one I always use) is: > > > > [code] > > > $this->Datum->saveAll($this->data) > > > [/code] > > > > so that the model, when processing the data, can recognise the model > > > to which the data belongs! > > > Enjoy, > > > John > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
RE: create a link with conditions to filter index action
Thanks, Jon, that's perfect. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Jon Bennett Sent: 14 January 2010 15:07 To: cake-php@googlegroups.com Subject: Re: create a link with conditions to filter index action hi Ben, Used named parameters: $html->link($category_name, array( 'controller'=>'Blogs', 'action'=>'index', 'category_id'=>3, 'tag_id'=>4 )); public function index() { extract($this->params['named']); $conditions = array(); if (isset($category_id)) $conditions['Blog']['category_id'] = $category_id; if (isset($tag_id)) $conditions['Blog']['tag_id'] = $tag_id; // etc } hth Jon -- jon bennett - www.jben.net - blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Lost a couple of hours on whitespace after a closing "?>" php tag
Bingo ! Thank you. Surprisingly, there were quite a few cake files in the core with trailing white spaces, as well. I opened a ticket in lighthouse on this, attached David's shell, and suggested perhaps they may want to include this shell as part of the regular test run: http://cakephp.lighthouseapp.com/projects/42648/tickets/201-shell-for-testing-enclosed-remove-trailing-white-space-after-closing-php-tags Thanks again for taking the time to respond, Brendon. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
I stand corrected :) The only other issue I see, is that your edit array does not start from 0! Could your view be made to not include the id as the array key? Like: [code] echo $form->hidden('Datum.[].id', array('value' => $field_datum ['id'])); [/code] I am grasping for straw here :D Enjoy, John On Jan 14, 5:47 pm, MrDevin wrote: > When I do the following in my "edit" method > > [code] > $this->Datum->saveAll($this->data) > [/code] > > I get one new row in the "data" table with all of the columns empty. > > reference:http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with... > > On Jan 14, 3:55 pm, John Andersen wrote: > > > It seems a little odd to me that you are using: > > > [code] > > $this->Datum->saveAll($this->data['Datum']) > > [/code] > > > I would assume that the correct form (the one I always use) is: > > > [code] > > $this->Datum->saveAll($this->data) > > [/code] > > > so that the model, when processing the data, can recognise the model > > to which the data belongs! > > Enjoy, > > John > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Custom Query
Hi! Id like to filter my videos by tags. The video must have all of the tags, and I want to sort the result by count on the stats table. I've got a working version without stats allthought this is not working with paginate. $searchTerms = array('Tag1','Tag2'); $numCount = count($searchTerms); $contain = array('FilterTag','TagsVideo'); $this->Video->bindModel(array('hasOne'=>array( 'TagsVideo', 'FilterTag'=>array( 'className'=>'Tag', 'foreignKey'=>false, 'type'=>'INNER', 'conditions'=>array( 'FilterTag.id = TagsVideo.tag_id', 'FilterTag.name' => $searchTerms ) ) ) ) ); $newest = $this->Video->find('all',array('contain' => $contain, 'order' => 'Video.created DESC', 'group' => array( 'Video.id', 'Video.title HAVING COUNT(FilterTag.name) = ' . $numCount ), 'limit' => $limit, 'conditions' => array('Video.published' => 1) ) ); Here is my custom query which is working. Is there a way to use cakephp core functions to achieve this? SELECT `Video`.*, `TagsVideo`.*, `FilterTag`.`id`, `FilterTag`.`name`, Stat.hits FROM `mp_videos` AS `Video` LEFT JOIN (SELECT COUNT(*) as hits, mp_stats.video_id, mp_stats.channel_id FROM mp_stats WHERE mp_stats.channel_id = ". $channelid." GROUP BY mp_stats.video_id ) as Stat ON Stat.video_id = Video.id INNER JOIN `mp_tags_videos` AS `TagsVideo` ON (`TagsVideo`.`video_id` = `Video`.`id`) INNER JOIN `mp_tags` AS `FilterTag` ON (`FilterTag`.`id` = `TagsVideo`.`tag_id` AND `FilterTag`.`name` IN (" . $tags .")) WHERE Video.published = 1 GROUP BY Video.id, Video.title HAVING COUNT (*) = ".$numCount." ORDER BY hits DESC LIMIT " . $limit; Thanks for any help and hints, sucram Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
When I do the following in my "edit" method [code] $this->Datum->saveAll($this->data) [/code] I get one new row in the "data" table with all of the columns empty. reference: http://teknoid.wordpress.com/2008/10/27/editing-multiple-records-with-saveall/ On Jan 14, 3:55 pm, John Andersen wrote: > It seems a little odd to me that you are using: > > [code] > $this->Datum->saveAll($this->data['Datum']) > [/code] > > I would assume that the correct form (the one I always use) is: > > [code] > $this->Datum->saveAll($this->data) > [/code] > > so that the model, when processing the data, can recognise the model > to which the data belongs! > Enjoy, > John > > On Jan 14, 3:07 pm, MrDevin wrote: > > > > > This is also posted on stackoverflow if you would like to see it with > > syntax highlighting and > > such.http://stackoverflow.com/questions/2063703/cakephp-saveall-fatal-erro... > > > So I am creating a form builder. Users will login and then fillout the > > forms that Admins have created. I am using saveAll() in my > > "data_controller" "add" method. > > > This works fine and and looks like this: > > > //debug($this->data); prints the following > > //app/controllers/data_controller.php (line 21) > > > Array > > ( > > [Datum] => Array > > ( > > [0] => Array > > ( > > [bool_val] => 1 > > [field_id] => 56 > > [form_id] => 208 > > [user_id] => 1 > > ) > > > [1] => Array > > ( > > [bool_val] => 0 > > [field_id] => 64 > > [form_id] => 208 > > [user_id] => 1 > > ) > > > ) > > > ) > > // data_controller.php > > // the add method is like this > > function add() { > > debug($this->data); > > if (!empty($this->data) ) { > > $this->Datum->create(); > > if ($this->Datum->saveAll($this->data['Datum'])) { > > $this->Session->setFlash(__('The Datum has been saved', > > true)); > > $this->redirect(array('action'=>'index')); > > } else { > > $this->Session->setFlash(__('The Datum could not be saved. > > Please, try again.', true)); > > } > > } > > $forms = $this->Datum->Form->find('list'); > > $fields = $this->Datum->Field->find('list'); > > $users = $this->Datum->User->find('list'); > > $statuses = $this->Datum->Status->find('list'); > > $this->set(compact('forms', 'fields', 'users', 'statuses')); > > } > > > So that works fine and creates a series of new entries in the "data" > > table of my MySQL database. My error comes when I try to use "saveAll > > ()" in my "edit" method. I have googled and googled and googled with > > no luck. All of the articles say that my data structure should be > > correct, or that is how I am understanding them. > > > So here is my view. It loops through to output checkboxes and other > > form elements but we will just look at a simple check box only > > example. > > > //field_view_datum.ctp > > > //debug($field_datum); > > switch ($field['Type']['name']) { > > > case "check box" : > > echo ""; > > echo $form->label($field['FieldName'][0]['name']); > > echo $form->hidden('Datum.'.$field_datum['id'].'.id', array > > ('value' => $field_datum['id'])); > > echo $form->hidden('Datum.'.$field_datum['id'].'.form_id', > > array('value' => $formID)); > > echo $form->hidden('Datum.'.$field_datum['id'].'.field_id', > > array('value' => $field['id'])); > > echo $form->hidden('Datum.'.$field_datum['id'].'.user_id', > > array('value' => $userID)); > > $booly = ($field_datum['bool_val'] == 0) ? false : true; > > $options = array('checked' => $booly); > > echo $form->checkbox('Datum.'.$field_datum['id'].'.bool_val', > > $options); > > > echo ""; > > break; > > > My view will output the following HTML to the browser. > > > > > Field One > > > > > > > > > > > > > checked="checked" name="data[Datum][164][bool_val]"/> > > > > > > Field Two > > > > > > > > > > > > > > > > > So then when I submit the form I get the following error: > > > Fatal error: Call to a member function getColumnType() on a non- > > object in /cake/libs/model/model.php on line 949 > > > The data I am passing and my controller method look like this: > > > //debug($this->data['Datum']); prints the following > > app/controllers/data_controller.php (line 39) > > > Array > > ( > > [164] => Array > > ( > > [id] => 164 > >
Re: Lost a couple of hours on whitespace after a closing "?>" php tag
With this shell task by David Persson: http://bin.cakephp.org/nick/davidpersson/page:1 :) On Jan 14, 9:21 am, keymaster wrote: > Spent more time on this bug than I should have, but ... > > I had a problem which I tracked down to two non-printable characters > of whitespace, inserted at the beginning of data sent to the client, > as a response to an ajax operation. > > Now, where would *you* look to find how two unprintable characters > crept their way into AJAX response text? > > I had a feeling there must be some white space after a closing tag, > somewhere. > > But *where*? > > And when did the problem start - I hadn't tested that operation in a > while? > > Which changed files should I limit the search to? > > So, with no choice left, I went back far into SVN to find the last > working version, then worked my way forward with a binary search to > see in which revision those characters started appearing. > > I finally located the revision, then eyeballed the changed files, and > presto, there it was -- extra lines after the closing "?>" php tag in > one of the files. > > Now, how can this be prevented in the future? > > I can configure my editor to automatically clean trailing whitespace > on each line before saving, but not blank lines after the closing > tag... > > Even if I made it a habit of removing all closing "?>" tags, as many > people recommend, there will be times when this will be forgotten. > > Here is an interesting post on the > subject:http://choosetheforce.blogspot.com/2008/05/should-you-close-that-php-... > > How do people deal with this major royal pain in the rear? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: create a link with conditions to filter index action
hi Ben, Used named parameters: $html->link($category_name, array( 'controller'=>'Blogs', 'action'=>'index', 'category_id'=>3, 'tag_id'=>4 )); public function index() { extract($this->params['named']); $conditions = array(); if (isset($category_id)) $conditions['Blog']['category_id'] = $category_id; if (isset($tag_id)) $conditions['Blog']['tag_id'] = $tag_id; // etc } hth Jon -- jon bennett - www.jben.net - blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: saveAll() producing Fatal Error
It seems a little odd to me that you are using: [code] $this->Datum->saveAll($this->data['Datum']) [/code] I would assume that the correct form (the one I always use) is: [code] $this->Datum->saveAll($this->data) [/code] so that the model, when processing the data, can recognise the model to which the data belongs! Enjoy, John On Jan 14, 3:07 pm, MrDevin wrote: > This is also posted on stackoverflow if you would like to see it with > syntax highlighting and > such.http://stackoverflow.com/questions/2063703/cakephp-saveall-fatal-erro... > > So I am creating a form builder. Users will login and then fillout the > forms that Admins have created. I am using saveAll() in my > "data_controller" "add" method. > > This works fine and and looks like this: > > //debug($this->data); prints the following > //app/controllers/data_controller.php (line 21) > > Array > ( > [Datum] => Array > ( > [0] => Array > ( > [bool_val] => 1 > [field_id] => 56 > [form_id] => 208 > [user_id] => 1 > ) > > [1] => Array > ( > [bool_val] => 0 > [field_id] => 64 > [form_id] => 208 > [user_id] => 1 > ) > > ) > > ) > // data_controller.php > // the add method is like this > function add() { > debug($this->data); > if (!empty($this->data) ) { > $this->Datum->create(); > if ($this->Datum->saveAll($this->data['Datum'])) { > $this->Session->setFlash(__('The Datum has been saved', > true)); > $this->redirect(array('action'=>'index')); > } else { > $this->Session->setFlash(__('The Datum could not be saved. > Please, try again.', true)); > } > } > $forms = $this->Datum->Form->find('list'); > $fields = $this->Datum->Field->find('list'); > $users = $this->Datum->User->find('list'); > $statuses = $this->Datum->Status->find('list'); > $this->set(compact('forms', 'fields', 'users', 'statuses')); > } > > So that works fine and creates a series of new entries in the "data" > table of my MySQL database. My error comes when I try to use "saveAll > ()" in my "edit" method. I have googled and googled and googled with > no luck. All of the articles say that my data structure should be > correct, or that is how I am understanding them. > > So here is my view. It loops through to output checkboxes and other > form elements but we will just look at a simple check box only > example. > > //field_view_datum.ctp > //debug($field_datum); > switch ($field['Type']['name']) { > > case "check box" : > echo ""; > echo $form->label($field['FieldName'][0]['name']); > echo $form->hidden('Datum.'.$field_datum['id'].'.id', array > ('value' => $field_datum['id'])); > echo $form->hidden('Datum.'.$field_datum['id'].'.form_id', > array('value' => $formID)); > echo $form->hidden('Datum.'.$field_datum['id'].'.field_id', > array('value' => $field['id'])); > echo $form->hidden('Datum.'.$field_datum['id'].'.user_id', > array('value' => $userID)); > $booly = ($field_datum['bool_val'] == 0) ? false : true; > $options = array('checked' => $booly); > echo $form->checkbox('Datum.'.$field_datum['id'].'.bool_val', > $options); > > echo ""; > break; > > My view will output the following HTML to the browser. > > > Field One > > > > > > checked="checked" name="data[Datum][164][bool_val]"/> > > > Field Two > > > > > > > > > So then when I submit the form I get the following error: > > Fatal error: Call to a member function getColumnType() on a non- > object in /cake/libs/model/model.php on line 949 > > The data I am passing and my controller method look like this: > > //debug($this->data['Datum']); prints the following > app/controllers/data_controller.php (line 39) > > Array > ( > [164] => Array > ( > [id] => 164 > [form_id] => 208 > [field_id] => 56 > [user_id] => 1 > [bool_val] => 1 > ) > > [165] => Array > ( > [id] => 165 > [form_id] => 208 > [field_id] => 64 > [user_id] => 1 > [bool_val] => 1 > ) > > ) > > //data_controller.php > > function edit($formid = null) { > debug($this->data['Datum']); > if (!e
RE: create a link with conditions to filter index action
That's great, thanks for your help! I guess if I wanted the option of additional parameters I could do something like: $html->link($category_name,array('controller'=>'Blogs', 'action'=>'index', null, 5)); function index($category_id = null, $tag_id = null) Does that look right? Also, do you know if this will work with pagination and habtm relationships? After some googling this morning around my problem, I came across this a few times as a kind of known issue, so wondered if perhaps it was related? My categories and tags are in habtm reference tables. Thanks again for the advice. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Jeremy Burns Sent: 14 January 2010 14:20 To: cake-php@googlegroups.com Subject: Re: create a link with conditions to filter index action If you are only ever going to filter for category_id, you could do this: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 3)); Then change you index function to: function index($category_id = null) ...and then check for a non null value later in your code when you do your data extraction. Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 14 Jan 2010, at 10:47, nyahoo wrote: > Hi All, > > I hope someone can help me with what I think is a simple question that > I just haven't wrapped my head round yet. (I'm new to CakePHP). > > I want to create a link that requests the index action of my blog > (which is paginated), but at the same time passes it a condition, like > category_id=2 or something like that, so that I can have a list of > categories to the right of my blog index that reloads the page with > just that categories blogs. This seems like a straightforward idea to > me, but I don't seem to be able to get the syntax right. I can do > limits and orders but not conditions. Can anyone help me please? > > Some examples: > > This works: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 'limit'=>2)); > > This doesn't work: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 'conditions'=>'Blog.category_id=3')); > > My controller code: > function index() { > $this->Blog->recursive = 0; > $this->set('blogs', $this->paginate()); } > > Thanks for any advice in advance! > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com To > unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this > cake-php+group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Lost a couple of hours on whitespace after a closing "?>" php tag
Spent more time on this bug than I should have, but ... I had a problem which I tracked down to two non-printable characters of whitespace, inserted at the beginning of data sent to the client, as a response to an ajax operation. Now, where would *you* look to find how two unprintable characters crept their way into AJAX response text? I had a feeling there must be some white space after a closing tag, somewhere. But *where*? And when did the problem start - I hadn't tested that operation in a while? Which changed files should I limit the search to? So, with no choice left, I went back far into SVN to find the last working version, then worked my way forward with a binary search to see in which revision those characters started appearing. I finally located the revision, then eyeballed the changed files, and presto, there it was -- extra lines after the closing "?>" php tag in one of the files. Now, how can this be prevented in the future? I can configure my editor to automatically clean trailing whitespace on each line before saving, but not blank lines after the closing tag... Even if I made it a habit of removing all closing "?>" tags, as many people recommend, there will be times when this will be forgotten. Here is an interesting post on the subject: http://choosetheforce.blogspot.com/2008/05/should-you-close-that-php-tag.html How do people deal with this major royal pain in the rear? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: create a link with conditions to filter index action
If you are only ever going to filter for category_id, you could do this: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 3)); Then change you index function to: function index($category_id = null) ...and then check for a non null value later in your code when you do your data extraction. Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 14 Jan 2010, at 10:47, nyahoo wrote: > Hi All, > > I hope someone can help me with what I think is a simple question that > I just haven't wrapped my head round yet. (I'm new to CakePHP). > > I want to create a link that requests the index action of my blog > (which is paginated), but at the same time passes it a condition, like > category_id=2 or something like that, so that I can have a list of > categories to the right of my blog index that reloads the page with > just that categories blogs. This seems like a straightforward idea to > me, but I don't seem to be able to get the syntax right. I can do > limits and orders but not conditions. Can anyone help me please? > > Some examples: > > This works: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 'limit'=>2)); > > This doesn't work: > $html->link($category_name,array('controller'=>'Blogs', > 'action'=>'index', 'conditions'=>'Blog.category_id=3')); > > My controller code: > function index() { > $this->Blog->recursive = 0; > $this->set('blogs', $this->paginate()); > } > > Thanks for any advice in advance! > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
create a link with conditions to filter index action
Hi All, I hope someone can help me with what I think is a simple question that I just haven't wrapped my head round yet. (I'm new to CakePHP). I want to create a link that requests the index action of my blog (which is paginated), but at the same time passes it a condition, like category_id=2 or something like that, so that I can have a list of categories to the right of my blog index that reloads the page with just that categories blogs. This seems like a straightforward idea to me, but I don't seem to be able to get the syntax right. I can do limits and orders but not conditions. Can anyone help me please? Some examples: This works: $html->link($category_name,array('controller'=>'Blogs', 'action'=>'index', 'limit'=>2)); This doesn't work: $html->link($category_name,array('controller'=>'Blogs', 'action'=>'index', 'conditions'=>'Blog.category_id=3')); My controller code: function index() { $this->Blog->recursive = 0; $this->set('blogs', $this->paginate()); } Thanks for any advice in advance! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Waiting for www.example.com
I am building a site which is in cakephp 1.2. The problem i am facing is in the server as well as in the localhost. Whenever i try to load a page the spends a lot of time in "waiting for www.example.com", but page eventually loads. I have put debug to "2" and checked dat the query execution is taking about 0.5 seconds. But a lot of time is taken is just "waiting for www.example.com". The same problem is in localhost also. Once the "waiting for www.example.com" phase is over then, the page does not takes much of time. Need help badly and fast. Any help is greatly appreciated. Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Unable to save related table information
Hi, koala kid Try to add 'foreignKey' It can cause your problem. array( 'className'=> 'Rate', 'foreignKey' => 'rental_id', 'dependent'=> true ) ); var $belongsTo = array( 'Location' => array( 'className' => 'Location', 'foreignKey' => 'rental_id', 'fields'=> 'city' ) ); } ?> Then $this->Rental->saveAll($this->data); should be work.:-P class Rate extends AppModel { var $name = 'Rate'; var $belongsTo = array( 'Rentals' => array( 'className'=> 'Rate', 'foreignKey' => 'rental_id', 'dependent'=> true ) } koala kid wrote: > > Hi all, > > using ORM for the first time and I'm having trouble getting my > associations all worked out. I'm unable to get my associated table data to > save.Here's a basic overview of my models: > > Locations -> Parent > Rentals -> Belongs to Locations > Rates -> Belongs to Rentals > > My code looks like this: > > class Rental extends AppModel > { >var $name = 'Rental'; > >var $hasOne = array( >'Rate' => array( >'className'=> 'Rate', >'dependent'=> true >) >); >var $belongsTo = array( >'Location' => array( >'className' => 'Location', >'fields'=> 'city' >) >); > > } > ?> > > class Rate extends AppModel > { >var $name = 'Rate'; > >var $belongsTo = 'Rentals'; > > } > > And my save looks like this: > > $this->Rental->saveAll($this->data) > > However only data to the Rental table is being saved and not to the Rate > table. Can anyone tell me what I am missing. I don't have a controller for > Rates as there are no direct functions to run against them, does this > matter? > > > Thanks. > -- View this message in context: http://old.nabble.com/Unable-to-save-related-table-information-tp27153345p27156458.html Sent from the CakePHP mailing list archive at Nabble.com. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
saveAll() producing Fatal Error
This is also posted on stackoverflow if you would like to see it with syntax highlighting and such. http://stackoverflow.com/questions/2063703/cakephp-saveall-fatal-error-call-to-a-member-function-getcolumntype So I am creating a form builder. Users will login and then fillout the forms that Admins have created. I am using saveAll() in my "data_controller" "add" method. This works fine and and looks like this: //debug($this->data); prints the following //app/controllers/data_controller.php (line 21) Array ( [Datum] => Array ( [0] => Array ( [bool_val] => 1 [field_id] => 56 [form_id] => 208 [user_id] => 1 ) [1] => Array ( [bool_val] => 0 [field_id] => 64 [form_id] => 208 [user_id] => 1 ) ) ) // data_controller.php // the add method is like this function add() { debug($this->data); if (!empty($this->data) ) { $this->Datum->create(); if ($this->Datum->saveAll($this->data['Datum'])) { $this->Session->setFlash(__('The Datum has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Datum could not be saved. Please, try again.', true)); } } $forms = $this->Datum->Form->find('list'); $fields = $this->Datum->Field->find('list'); $users = $this->Datum->User->find('list'); $statuses = $this->Datum->Status->find('list'); $this->set(compact('forms', 'fields', 'users', 'statuses')); } So that works fine and creates a series of new entries in the "data" table of my MySQL database. My error comes when I try to use "saveAll ()" in my "edit" method. I have googled and googled and googled with no luck. All of the articles say that my data structure should be correct, or that is how I am understanding them. So here is my view. It loops through to output checkboxes and other form elements but we will just look at a simple check box only example. //field_view_datum.ctp "; echo $form->label($field['FieldName'][0]['name']); echo $form->hidden('Datum.'.$field_datum['id'].'.id', array ('value' => $field_datum['id'])); echo $form->hidden('Datum.'.$field_datum['id'].'.form_id', array('value' => $formID)); echo $form->hidden('Datum.'.$field_datum['id'].'.field_id', array('value' => $field['id'])); echo $form->hidden('Datum.'.$field_datum['id'].'.user_id', array('value' => $userID)); $booly = ($field_datum['bool_val'] == 0) ? false : true; $options = array('checked' => $booly); echo $form->checkbox('Datum.'.$field_datum['id'].'.bool_val', $options); echo ""; break; My view will output the following HTML to the browser. Field One Field Two So then when I submit the form I get the following error: Fatal error: Call to a member function getColumnType() on a non- object in /cake/libs/model/model.php on line 949 The data I am passing and my controller method look like this: //debug($this->data['Datum']); prints the following app/controllers/data_controller.php (line 39) Array ( [164] => Array ( [id] => 164 [form_id] => 208 [field_id] => 56 [user_id] => 1 [bool_val] => 1 ) [165] => Array ( [id] => 165 [form_id] => 208 [field_id] => 64 [user_id] => 1 [bool_val] => 1 ) ) //data_controller.php function edit($formid = null) { debug($this->data['Datum']); if (!empty($this->data) ) { if ($this->Datum->saveAll($this->data['Datum'])) { $this->Session->setFlash(__('The Datum has been saved', true)); $this->redirect(array('controller' => 'forms', 'action'=>'index')); } else { $this->Session->setFlash(__('The Datum could not be saved. Please, try again.', true)); $this->redirect(array('controller' => 'forms', 'action'=>'view', 'id' => '$formid')); } } } Any help that you can give would be much apriciated I have done tons of searching and not found the correct answer. Sorry if this post is a bit long winded. Thanks, Devin Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questio
Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)
As far as I know, there is no solution! But my suggestion was that formatting for presentation is not a good thing to do at the database level, but in CakePHP is performed in the view. That way you have all the possibilities to use the date not only for presentation but also for processing (comparision, different presentations, etc.) Anyway, as soon as you use a function in the database query, the alias you assign it goes outside the model array and you can only get it back in by using afterFind callback method. Somebody please correct me if I am wrong on this :) Enjoy, John On Jan 14, 2:48 pm, codef0rmer wrote: > @John Andersen: thx but there has to be a solution instead of > formatting in view file > > @Azril Nazli: :-( no luck... it says, sql query error. here is the > below query: > SELECT `GenderSalutation`.`name`, `User`.`first_name`, > `User`.`middle_name`, `User`.`last_name`, `User`.`address`, DATE_FORMAT > (User.created, '%d') AS User.created, `User`.`mobile`, `User`.`dob`, > `User`.`experience` FROM `users` AS `User` LEFT JOIN > `gender_salutations` AS `GenderSalutation` ON > (`User`.`gender_salutation_id` = `GenderSalutation`.`id`) WHERE > `User`.`email` = 'amit.2006...@gmail.com' LIMIT 1 > > SQL Error: 1064: You have an error in your SQL syntax; check the > manual that corresponds to your MySQL server version for the right > syntax to use near '.created > > Any other solution... please help Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Disable model refresh?
Hello, I'm using Cake with Postgres and am having problems with how long it takes to refresh the model caches on each request. Postgres doesn't have "describe tablename" like MySQL, so Cake works out the schema by doing a series of queries on the Postgres system tables, and that's what's taking a long time (eg. 20 queries each taking half a second). I'd like to tell Cake to only update the model caches when running in debug level 2 (rather than 1). Or, to be able to set a flag in the configuration like $update_model_caches = true; I've had a bit of a search on here but can't find anything. Any help would be very much appreciated! Cheers, Rangi Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: DATE_FORMAT in fields does not return formatted date under proper Key (Model Name)
@John Andersen: thx but there has to be a solution instead of formatting in view file @Azril Nazli: :-( no luck... it says, sql query error. here is the below query: SELECT `GenderSalutation`.`name`, `User`.`first_name`, `User`.`middle_name`, `User`.`last_name`, `User`.`address`, DATE_FORMAT (User.created, '%d') AS User.created, `User`.`mobile`, `User`.`dob`, `User`.`experience` FROM `users` AS `User` LEFT JOIN `gender_salutations` AS `GenderSalutation` ON (`User`.`gender_salutation_id` = `GenderSalutation`.`id`) WHERE `User`.`email` = 'amit.2006...@gmail.com'LIMIT 1 SQL Error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.created Any other solution... please help Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Form helper causing unwanted html to appear in IE but not firefox
Ah many thanks John :-) This works perfectly, although still a little bit messy in IE but i think thats an issue with the image we've used as the form button. Cheers! ~Bailey On Jan 14, 10:38 am, John Andersen wrote: > I am sure that this is not a good idea! > You are creating 7 forms with the same id-name! Suggest you move the > form creation outside the loop and make your submit button provide the > correct duty id. > > [code] > create('Duty', array('action' => > 'displayDutyDetails')); ?> > > > > > > > > > > > submit('../img/icons/view.png', > array('label'=>'View', 'duty_id' => $duty['Duty']['duty_id'], > 'width' => '40px', 'height' =>'25px', > 'onmouseover' => 'javascript:this.src="../img/icons/ > view_over.png"', > 'onmouseout' => 'javascript:this.src="../img/icons/view.png"'));? > > > > > > end();?> > [/code] > > Observe that the table is inside the form. You had a mixup with the > sequence of the table and the form tags. > Enjoy, > John > > On Jan 14, 11:57 am, Bailey wrote: > > > Hi all, > > > I'm trying to display data in a html table from a database query. > > > The data appears but I want to be able to provide an option from each > > record shown in the html table, i.e. (view more details button). > > > I do this by creating a form inside the php loop that generates the > > table data. The form holds a hidden field that stores the record id i > > want to look up further with another function in the controller. In > > firefox this works perfectly but in IE it screws up, the button's dont > > appear and I get extra tables appearing above the results table that > > matches the same number of records in that table. > > > (i.e. loop goes through 7 times, prints out 7 lots of data, but prints > > out 7 extra tables above). > > > I'm sure theres a simple fix to this but i'm having real difficulty > > finding it. Does anyone know of anything i can do to fix this (or if > > theres another means that I can achieve the same result)? my table > > code is below, i'm not using any other styling at the moment apart > > from the cakephp default one. > > > Many thanks! > > > Code - View.ctp > > == > > > > > > echo $form->create('Duty', array('action' => 'displayDutyDetails')); > > echo $form->hidden('duty_id',array('value' => $duty['Duty'] > > ['duty_id']));?> > > > > > > > > > > > > > > > > > > > > > > submit('../img/icons/view.png', > > array('label'=>'View', 'width' => '40px', 'height' > > =>'25px', > > 'onmouseover' => 'javascript:this.src="../img/icons/ > > view_over.png"', > > 'onmouseout' => > > 'javascript:this.src="../img/icons/view.png"'));?> > > > > end();?> > > > > > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Form helper causing unwanted html to appear in IE but not firefox
I am sure that this is not a good idea! You are creating 7 forms with the same id-name! Suggest you move the form creation outside the loop and make your submit button provide the correct duty id. [code] create('Duty', array('action' => 'displayDutyDetails')); ?> submit('../img/icons/view.png', array('label'=>'View', 'duty_id' => $duty['Duty']['duty_id'], 'width' => '40px', 'height' =>'25px', 'onmouseover' => 'javascript:this.src="../img/icons/ view_over.png"', 'onmouseout' => 'javascript:this.src="../img/icons/view.png"'));? > end();?> [/code] Observe that the table is inside the form. You had a mixup with the sequence of the table and the form tags. Enjoy, John On Jan 14, 11:57 am, Bailey wrote: > Hi all, > > I'm trying to display data in a html table from a database query. > > The data appears but I want to be able to provide an option from each > record shown in the html table, i.e. (view more details button). > > I do this by creating a form inside the php loop that generates the > table data. The form holds a hidden field that stores the record id i > want to look up further with another function in the controller. In > firefox this works perfectly but in IE it screws up, the button's dont > appear and I get extra tables appearing above the results table that > matches the same number of records in that table. > > (i.e. loop goes through 7 times, prints out 7 lots of data, but prints > out 7 extra tables above). > > I'm sure theres a simple fix to this but i'm having real difficulty > finding it. Does anyone know of anything i can do to fix this (or if > theres another means that I can achieve the same result)? my table > code is below, i'm not using any other styling at the moment apart > from the cakephp default one. > > Many thanks! > > Code - View.ctp > == > > > echo $form->create('Duty', array('action' => 'displayDutyDetails')); > echo $form->hidden('duty_id',array('value' => $duty['Duty'] > ['duty_id']));?> > > > > > > > > > > > > submit('../img/icons/view.png', > array('label'=>'View', 'width' => '40px', 'height' > =>'25px', > 'onmouseover' => 'javascript:this.src="../img/icons/ > view_over.png"', > 'onmouseout' => > 'javascript:this.src="../img/icons/view.png"'));?> > > end();?> > > > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: console shell
excuse was a mistake. is app_controller On 14 Gen, 10:48, John Andersen wrote: > Please confirm that the error message states "ap_controller"?? Naming > issue?? > Enjoy, > John > > On Jan 14, 11:11 am, alberto wrote: > > > Hi, > > php.exe C:/xampp/htdocs/cakeblog/cake/console/cake.php myfunction > > > in the shell I import a model like > > $uses = array('Mymodel'); > > > when I run this into my prompt print an error > > "Fatal error: Class 'Controller' not fount in C:\xampp\htdocs\cakeblog > > \app\ap_controller.php on line 2 > > > any ideas? > > > thanks in advance Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Eclipse + PDT 2.1 - How to include the Cake core application
Can anyone give me an instruction for the new Eclipse / PDT version how I can include the Cake core application to my projects? Here: http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-with-cake The part of including the Cake core application via "Include Path" does not work. There is no "Include Path" section in the Project Settings of PDT 2.1. Can anyone explain how I can include the Cake core application in my projects??? Many thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Form helper causing unwanted html to appear in IE but not firefox
Hi all, I'm trying to display data in a html table from a database query. The data appears but I want to be able to provide an option from each record shown in the html table, i.e. (view more details button). I do this by creating a form inside the php loop that generates the table data. The form holds a hidden field that stores the record id i want to look up further with another function in the controller. In firefox this works perfectly but in IE it screws up, the button's dont appear and I get extra tables appearing above the results table that matches the same number of records in that table. (i.e. loop goes through 7 times, prints out 7 lots of data, but prints out 7 extra tables above). I'm sure theres a simple fix to this but i'm having real difficulty finding it. Does anyone know of anything i can do to fix this (or if theres another means that I can achieve the same result)? my table code is below, i'm not using any other styling at the moment apart from the cakephp default one. Many thanks! Code - View.ctp == create('Duty', array('action' => 'displayDutyDetails')); echo $form->hidden('duty_id',array('value' => $duty['Duty'] ['duty_id']));?> submit('../img/icons/view.png', array('label'=>'View', 'width' => '40px', 'height' =>'25px', 'onmouseover' => 'javascript:this.src="../img/icons/ view_over.png"', 'onmouseout' => 'javascript:this.src="../img/icons/view.png"'));?> end();?> Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: console shell
Please confirm that the error message states "ap_controller"?? Naming issue?? Enjoy, John On Jan 14, 11:11 am, alberto wrote: > Hi, > php.exe C:/xampp/htdocs/cakeblog/cake/console/cake.php myfunction > > in the shell I import a model like > $uses = array('Mymodel'); > > when I run this into my prompt print an error > "Fatal error: Class 'Controller' not fount in C:\xampp\htdocs\cakeblog > \app\ap_controller.php on line 2 > > any ideas? > > thanks in advance Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
console shell
Hi, php.exe C:/xampp/htdocs/cakeblog/cake/console/cake.php myfunction in the shell I import a model like $uses = array('Mymodel'); when I run this into my prompt print an error "Fatal error: Class 'Controller' not fount in C:\xampp\htdocs\cakeblog \app\ap_controller.php on line 2 any ideas? thanks in advance Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: named parameters in pages_controller
try $url = $html->url( array('controller' => 'posts', 'action' => 'view', 'id' => 12, 'param' => 'name)); echo $url; On Jan 13, 8:56 pm, "blickensdoer...@googlemail.com" wrote: > hi everyone, > > i have a problem with the url helper in the pages_controller: > > i want to append a named parameter to the current url . > > in all controllers this works fine, but the pages_controller does > always something like this: > > /pages/display/pages/info/param:name > > i've tried various ways to pass the url to the helper, even things > like: > > $html->url($this->here.'/param:name') > > but nothing works > > anyone knows help? > > ty+regards Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: highest traffic cakePHP 1.2 sites?
It's a German car pooling / ride sharing platform: www.mitfahrgelegenheit.de Thanks to cake we can easily do our roll outs to other countries (e.g. www.pamemazi.gr where we are already live), others will follow in the next weeks. On 13 Jan., 13:41, Jon Bennett wrote: > > We serve >35M PVs (>2M visits) per month. > > Who/what is 'we'? > > j > > -- > jon bennett -www.jben.net- blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en