Re: how data pass through one controller to another controller with examples

2012-08-16 Thread jeremyharris
If you have a question, please show that you've done some work and let us know what you've tried. Asking for someone to write your code for you isn't going to result in positive responses. Also, be more clear. Let us know what you're trying to accomplish and why you haven't been able to yet. O

Re: Sign up for newsletter form on homepage

2012-08-16 Thread jeremyharris
Just don't redirect then. The homepage should reload and the validation errors should be shown. On Tuesday, August 14, 2012 6:59:43 AM UTC-7, iFemke wrote: > > For a client website we want a newsletter sign up on the homepage, but we > can't get this to work the way we want it. > > What's happe

Re: Checking cookie values in controller test

2012-08-16 Thread jeremyharris
You check it just like in the controller. function testCookieWrite() { $this->testAction('/posts/action_that_writes_to_cookie'); $result = $this->controller->Cookie->read('my_cookie_value'); $expected = 'yes'; $this->assertEquals($expected, $result); } Of course, you can always mock the c

Re: Registering users with Google accounts - CakePHP

2012-08-16 Thread jeremyharris
Google uses Oauth[1] like Twitter. They even have a nice PHP library[2] that should help speed things along for you. 1: https://developers.google.com/accounts/docs/OAuth2 2: https://code.google.com/p/google-api-php-client/ On Thursday, August 16, 2012 2:42:37 AM UTC-7, ivnrmc wrote: > > Hell

Re: Cakephp Benchmark with debug is 2 and 0

2012-05-31 Thread jeremyharris
I agree with euromark. There's literally no point in comparing the two, unless you are going to launch a production app in debug mode (uh). On Thursday, May 31, 2012 8:12:59 AM UTC-7, euromark wrote: > > NO, i am saying that this shoudn't have been in this blog post in the > first place > it

Re: Using PHP's Interface as Extension Point

2012-05-31 Thread jeremyharris
CakePHP is just PHP, so there's no reason you couldn't use interfaces where you wanted to. The users of the plugins would just need to understand that they need to implement them. On Thursday, May 31, 2012 4:07:13 AM UTC-7, Vinicius Dusso wrote: > > Hello all, > > Did everyone tried to use PHP's

Re: app/tmp permissions

2012-05-31 Thread jeremyharris
Changing the ENTIRE folder to 777 is a TERRIBLE idea and a massive security risk. I highly suggest you don't do it this way. Assuming you have the proper user and groups on the folder, 660 should be sufficient. On Tuesday, May 29, 2012 8:28:29 PM UTC-7, Nikhil Agrawal wrote: > > Try changing the

Re: relationship

2012-05-29 Thread jeremyharris
You can use Containable[1] to bring in relationship data. Something like $this->Inventory->find('all', array( 'contain' => array( 'Profile', 'Item' ) )); The above assumes Inventory is associated with Profile and Item (you didn't give us the relationships). -jeremy 1: http://book.

Re: Tests - Fixture does not truncate tables

2012-05-24 Thread jeremyharris
Actually it appears you already reported it :) I'll comment there. On Thursday, May 24, 2012 7:17:12 AM UTC-7, jeremyharris wrote: > > I did some research and yes, I believe it is a bug. The problem is that > when it tries to create the table and mark it as being created, it will

Re: Tests - Fixture does not truncate tables

2012-05-24 Thread jeremyharris
I did some research and yes, I believe it is a bug. The problem is that when it tries to create the table and mark it as being created, it will fail because the table already exists and then skips marking it as created, which is what's needed in order for truncate to happen. I'll add it on Ligh

Re: Very newbie question. Trying to define cake core include path

2012-05-24 Thread jeremyharris
So CAKE_CORE_INCLUDE_PATH should point to the Cake directory in the repo's lib folder. >From your setup, you should use if (!defined('CAKE_CORE_INCLUDE_PATH')) { // points to /var/www/cake/lib (which has the "Cake" folder in it) define('CAKE_CORE_INCLUDE_PATH', DS . 'var' . DS . 'www' . DS

cake-php@googlegroups.com

2012-05-08 Thread jeremyharris
I answered on ask.cakephp.org for a long time, but it logged me out on a regular basis and didn't give me notifications when people commented or asked further questions, so I would have to revisit questions just to see the activity. I've started answering on StackOverflow instead. I agree that

Re: CakePHP (2.1) Media Plugin - Multi File Upload

2012-05-01 Thread jeremyharris
e are numerous forks) On Monday, April 30, 2012 8:09:33 PM UTC-7, double07 wrote: > Hi Jeremy, > > Not having much luck with the saving manually option, do you having > any working examples of drag and drop (jquery) I can look at? > > Thanks, > > -Brett > > On Apr 17,

Re: Pagination

2012-04-27 Thread jeremyharris
Why didn't you use the $belongsTo array I gave you? Your belongsTo has changed the aliases from MainCity to main_city, so paginating by MainCity will not work. Rename the aliases to be CamelCased and try again. Also, debug the results of $this->paginate() to make sure it includes the MainCity a

Re: Pagination

2012-04-26 Thread jeremyharris
le was a different then my actual code (I know I should > have just used it) > > I have two cities per book. > > IE > > main_city_id (where it was written) > billing_city_id (where the author wants to get paid) > > How do I distinguish them? I can't use City.nam

Re: Pagination

2012-04-26 Thread jeremyharris
ate from the book model to be able to sort by Book, Author or City On Thursday, April 26, 2012 3:06:34 PM UTC-7, Hill180 wrote: > > City hasMany books, books only have one author. > > City.name didn't work > > var $hasMany = array( > 'Book' => array

Re: Hide "previous" "next" when no pagination

2012-04-26 Thread jeremyharris
Try: if ($this->Paginator->counter(array('format' => '%count%')) == 0) { // no records, don't show links! } -jeremy On Thursday, April 26, 2012 9:17:49 AM UTC-7, JonStark wrote: > > How can I hide the "<< Previous Next >>" that appears if there is no > pages to paginate ? > I think this is po

Re: Mock and test uploads

2012-04-26 Thread jeremyharris
I would take cues from the Media plugin, which uses binary data in some of its testing library. Test data: https://github.com/davidpersson/media/blob/next/tests/fixtures/test_data.php Where test data is set up: https://github.com/davidpersson/media/blob/next/tests/cases/models/behaviors/base.te

Re: Pagination

2012-04-26 Thread jeremyharris
Is City a hasOne or belongsTo relationship? If so, and your find code is using contain or recursive to include those in the results, you can do this: $this->Paginator->sort('Where Written', 'City.name'); Check your data and SQL queries to see if it's joined that way. On Wednesday, April 25, 201

Re: Testing in Command line, change output error ?

2012-04-26 Thread jeremyharris
You can run it in the CLI and it should work fine. As for changing the warning, I'm not sure what you're looking for. Is it the styling or how the report is generated that you don't like? If it's the styling, then use CSS. If it's the report itself, I think theoretically you can change it by cr

Re: Mock testing , don't save data.

2012-04-26 Thread jeremyharris
Rodrigo is right. By mocking the save method you are basically saying that that method does nothing, unless you specify a return value. Mocking the save method is probably not the way to go. If you're using a test database and fixtures, the data will be stored in a database and wiped clean when

Re: Cake Media Plugin: How to create dynamic directories

2012-04-19 Thread jeremyharris
Yes, as defined in the transferTo function in your model. Here's a sample one that sticks it under a user directory and uses a UUID as the filename so there aren't conflicts (so something like /media/transfer/doc/user/550e8400-e29b-41d4-a716-44665544.doc): function transferTo($via, $from) {

Re: Auth component WITHOUT ACL blocks every controller action

2012-04-19 Thread jeremyharris
7;s the intended functionality). On Tuesday, April 17, 2012 11:13:53 PM UTC-7, muka wrote: > > Probably a more correct way could be > > function isAuthorized(){ > return $this->Auth->user(); > } > > > Il 18/04/2012 00:24, jeremyharris ha scritto: > > Sett

Re: Auth component WITHOUT ACL blocks every controller action

2012-04-17 Thread jeremyharris
Setting $this->Auth->authorize = array('Controller'); tells the AuthComponent where to run the `isAuthorized()` method, in this case, the Controller. You can find more info here: http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#using-controllerauthorize On Tuesda

Re: ACL very slow

2012-04-17 Thread jeremyharris
I realized after posting that the post I referenced assumes MySQL, but the idea of indexing is relative nonetheless. On Tuesday, April 17, 2012 8:20:05 AM UTC-7, jeremyharris wrote: > > It's quite possible you're just missing indexes[1], which would be a huge > performance

Re: ACL very slow

2012-04-17 Thread jeremyharris
It's quite possible you're just missing indexes[1], which would be a huge performance problem. Also, make sure the engine is innodb. 1: http://blog.loadsys.com/2008/03/19/cakephp-12-tuning-the-acl-via-mysql/ On Tuesday, April 17, 2012 6:00:05 AM UTC-7, Farah wrote: > > I'm not expert in CakePH

Re: Where am I supposed to save additional PHP source files while I'm writing a new behavior

2012-04-17 Thread jeremyharris
If it's more than two files (behavior + test case) it's worthwhile to point out that plugins are not only good for redistributing your code, but it's also good for packaging your tests and everything in a different repo that has its own history and that you can submodule via git. This assumes th

Re: Issue with multiple select form input.

2012-04-17 Thread jeremyharris
> Now I understand this, I'd expect them to be displayed like > .../brand[0]:Dell/brand[1]:Apple/. Currently (now I've tweaked the plugin) > the values are separated with a pipe, for example /brand:Dell%7CApple but > as I mentioned above, this causes problems as the search plu

Re: CakePHP (2.1) Media Plugin - Multi File Upload

2012-04-16 Thread jeremyharris
You could try looping through the files array and saving them manually: foreach $_FILES['files'] as $file { // create data array containing fields such as a foreignKey, model, etc. and save them as individual records } Or, instead of using the multiple option, you can try processing them each a

Re: Issue with multiple select form input.

2012-04-16 Thread jeremyharris
That is the proper name, because PHP sees that and creates an array with the values within that array. How else would you get multiple values for the same group? When you submit the form, for example, the data is populated like this: // $this->data array( 'Server' => array( 'brand' => arr

Re: CakePHP and Wordpress

2012-04-12 Thread jeremyharris
s experience pulling posts from a > (non-hosted) WP Blog into a Cake website, and can will point me to some > good documentation on how to do it. > > > On Thursday, April 12, 2012 11:25:54 AM UTC-5, jeremyharris wrote: >> >> 1. If you can't connect to the database how

Re: Using html template in cakephp

2012-04-12 Thread jeremyharris
working on codeigniter. so its little difficult to work > on cakeph though its on MVC. > > > On Thursday, 12 April 2012 21:58:31 UTC+5:30, jeremyharris wrote: >> >> You can read more about the structure here: >> http://book.cakephp.org/2.0/en/getting-started.html

Re: Using html template in cakephp

2012-04-12 Thread jeremyharris
You can read more about the structure here: http://book.cakephp.org/2.0/en/getting-started.html Cake doesn't work like WordPress (which uses header, content and footer templates). It uses proper MVC, that is a layout (kind of like the header and footer templates combined) and view (kind of li

Re: CakePHP and Wordpress

2012-04-12 Thread jeremyharris
sure if I can connect to the WP database. I was > hoping someone could point me to an existing plugin/component that does > what I need it to do. I'm not interested in writing something from scratch. > > > On Thursday, April 12, 2012 9:29:29 AM UTC-5, jeremyharris wrote: >>

Re: CakePHP and Wordpress

2012-04-12 Thread jeremyharris
As long as you can connect to the WP database, I don't see why this would be that hard. Just set it up as a separate database connection, set up some models and you're good. It really depends on how crazy you want to get. For example, do you want to form relationships that get the meta info, ta

Re: ACL: 3 levels ARO?

2012-04-03 Thread jeremyharris
I don't see why this wouldn't work, since Aro's are a tree anyway. For one of my projects, I technically have a 10 level deep Aro setup, where each parent group inherits its children's permissions (that is, if you are of a higher group you can access everything lower groups can). The same applie

Re: Help Regarding ACL

2012-03-19 Thread jeremyharris
That error is because it's looking for Group.1, which is missing from your posted ARO tree. On Sunday, March 18, 2012 4:41:12 AM UTC-7, mohit wrote: > > Hi Experts, > > Need some help, > I am in process of learning of Cake PHP. I was creating an app which needs > ACL feature. > While reading var

Re: Not Able to ADD or Edit

2012-03-09 Thread jeremyharris
Here are some basic debugging steps but we won't be able to help you until you narrow it down a little (is it a PHP error, a problem with your CakePHP code, a problem with your database connection?). Turn on debugging if it is not already: /config/core.php, Configure::write('debug', 2) Make su

Re: "Mass Assignment Vulnerability" - protection in Cake

2012-03-08 Thread jeremyharris
g, 8. März 2012 16:23:45 UTC+1 schrieb jeremyharris: >> >> I've had no problem with ajax forms and the security component. The token >> is still added and it still goes through. It only blackholes if you >> dynamically change that field with javascript. >> >>

Re: How to link to a non cake php page, and where to put it?

2012-03-08 Thread jeremyharris
I have no idea if css and images will load properly from the vendors folder. It's probably looking for those assets in the webroot folders. The anchor should be stored in $this->params['url']['#']. It seems weird to be rendering a complete site within Cake. On Thursday, March 8, 2012 8:53:48 AM

Re: How to link to a non cake php page, and where to put it?

2012-03-08 Thread jeremyharris
Based on the controller code I wrote, it would be /SkillsMat/edit_scores The .php is appended in the controller. I have no idea if it will work, it was just an idea more than anything. On Thursday, March 8, 2012 7:59:16 AM UTC-8, Daniel wrote: > > OK, I put the directroy "SkillsMat" in the vendo

Re: How to link to a non cake php page, and where to put it?

2012-03-08 Thread jeremyharris
Pages isn't probably the right place to put it. I would just make it a .ctp file, or create a view class that uses the .php extension. So if your pages controller used that view it would dispatch something like /pages/SkillsMat to /views/pages/skills_mat.php. If you need the .php extension to

Re: WordPress query_posts on a CakePHP page?

2012-03-08 Thread jeremyharris
WordPress is full of globals and a bunch of other garbage that would make it nearly impossible to work with *any* other codebase. You would be much better off creating models that connected to WP's database and tables. That's my suggestion. On Friday, March 2, 2012 3:27:53 PM UTC-8, 85VicWagonG

Re: Cake PHP (Bug even still exists in cake php2)

2012-03-08 Thread jeremyharris
Where does Cake "rely" on a CSS file. How could any PHP program rely on a css file, for that matter? On Thursday, March 8, 2012 6:40:15 AM UTC-8, Phil wrote: > > Bad programming by cake php here. This bug still exists in version > 2. Why does it rely on a css file existing? A lot of people wi

Re: "Mass Assignment Vulnerability" - protection in Cake

2012-03-08 Thread jeremyharris
I've had no problem with ajax forms and the security component. The token is still added and it still goes through. It only blackholes if you dynamically change that field with javascript. On Thursday, March 8, 2012 7:20:34 AM UTC-8, euromark wrote: > > well, with ajax and dynamic field injectio

Re: IIS7 + CakePhp

2012-03-07 Thread jeremyharris
t; to web.config (which would usually break the images but enable the > controller/action pages), nothing actually changed. I expected something to > be different, or at least more broken, but it all seemed the same. > > On Wednesday, March 7, 2012 4:05:33 PM UTC-5, jeremyharris wrote:

Re: Issue with Excel Helper

2012-03-07 Thread jeremyharris
Use DebugKit and see if it's in the list of loaded helpers. If it's not, then Cake can't find it. If it is, then perhaps you're referencing it incorrectly. On Wednesday, March 7, 2012 8:31:23 AM UTC-8, mohit wrote: > > Hi Experts, > > I am using this tutorial to set up an excel export helper > >

Re: "Mass Assignment Vulnerability" - protection in Cake

2012-03-07 Thread jeremyharris
Enabling the Security component should be the first thing you do. You are immediately protected against form tampering. Something to note on enabling it on an existing app: test it thoroughly! Checkboxes with no hiddenField will blackhole (at least in 1.3) comes to mind. On Wednesday, March 7,

Re: IIS7 + CakePhp

2012-03-07 Thread jeremyharris
Make sure your Physical Path is pointing to the webroot directory, not the root of the app. I've used the .htaccess files (using ISAPI mod rewrite) but never got it to work by pointing to the root of the app. I always had to point to the webroot directory so the assets worked. On Wednesday, Mar

Re: How to get all products with one PhotoSmall and at least one PhotoBig

2012-03-06 Thread jeremyharris
So it looks like your joins are working (am I wrong) but you're getting null data joined for those who are missing photos. Is this correct? If so, try adding a condition: $conditions = array( 'Product.category_id'=> $cats 'not' => array( 'PhotoBig.id' => null, 'PhotoSmall.id' => null ) );

Re: Code Help

2012-03-06 Thread jeremyharris
I would get all users who *are* following and then look up everyone except them. $followers = $this->User->Follow->find('all', array( 'conditions' => array( 'Follow.followed_by' => $this->Auth->user('id') ) )); $nonfollowers = $this->User->find('all', array( 'conditions' => array( 'not' => a

Re: SqlQueries in Fields to save?

2012-03-06 Thread jeremyharris
You could use UUIDs instead which are automatically created by Cake and a nice replacement for auto increments. On Monday, March 5, 2012 3:42:39 AM UTC-8, Kosmo wrote: > > Hi there, > > I know this could be a critical hole in my application, > anyhow - is there a way to set an article-id like

Re: Insert generated fields into database

2012-03-02 Thread jeremyharris
No problem. Enjoy Cake! On Friday, March 2, 2012 1:09:16 PM UTC-8, Graham wrote: > > Thanks, so simple when you know how. > > Cheers > > Gj > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and

Re: Insert generated fields into database

2012-03-02 Thread jeremyharris
You can just add it to the data you save in the controller action. Something like: function add() { if (!empty($this->data)) { $this->data['Model']['amount_plus_fee'] = $this->data['Model']['amount'] + 10; $this->Model->save($this->data); } } So amount_plus_fee wouldn't be in the form necessari

Re: POSTing to CakePHP from iOS (CakePHP 1.3)

2012-03-01 Thread jeremyharris
Sounds like an iOS question http://stackoverflow.com/questions/5537297/ios-how-to-perform-a-http-post-request On Thursday, March 1, 2012 1:15:21 PM UTC-8, 8vius wrote: > > I've set up my RESTful web services and I'm trying to POST to my add > method, how would the URL be to do this? I haven't

Re: Command history in CakePHP console

2012-03-01 Thread jeremyharris
know that PHP had an interactive shell. I believe the closest > I got was the -r parameter! > > On Thu, Mar 1, 2012 at 3:55 PM, jeremyharris > wrote: > > I don't know of any, but that might be a fun contribution to add :) > > > > I'd create a lighthouse R

Re: Need Help

2012-03-01 Thread jeremyharris
Your first resource should be the book[1]. You can also look at screencasts[2] and sign up for classes that will teach you the basics and get you going[3]. 1: http://book.cakephp.org 2: http://tv.cakephp.org/ 3: http://training.cakephp.org/ On Thursday, March 1, 2012 5:44:07 AM UTC-8, mohit w

Re: i've issues while using ajax in form submission

2012-03-01 Thread jeremyharris
Sounds like you're creating the form wrong in the view. What's the code in the view for your form? On Thursday, March 1, 2012 2:48:55 AM UTC-8, boobalan wrote: > > i am creating a blog application > i've some issues while using ajax in forms > > Warning (2): array_merge() [function.array-merge]

Re: Command history in CakePHP console

2012-02-29 Thread jeremyharris
I don't know of any, but that might be a fun contribution to add :) I'd create a lighthouse RFC ticket and post some code to see what people (and the core team) think. It shouldn't be too hard to code, either. On Wednesday, February 29, 2012 7:33:58 PM UTC-8, Simon Males wrote: > > Hello, > > Ar

Re: isAuthorized redirect

2012-02-29 Thread jeremyharris
It would be easier to debug your code with... you know, code. Can you post your isAuthorized function please? On Wednesday, February 29, 2012 3:31:34 PM UTC-8, JT wrote: > > I'm using isAuthorized to check if the user is an admin or a user. If a > user tries to access an admin function I want th

Re: Media PLugin

2012-02-29 Thread jeremyharris
y as the 'User' had already > been unset by the Coupler. I've therefore had to roll the change back and > go back to the drawing board for now. > > Keith Gorman > *Class Outfit* > ** > keithgor...@classoutfit.com > www.classoutfit.com > > On 29 Feb 2012, at

Re: Add class to active links

2012-02-29 Thread jeremyharris
Or ternary! $class = $active ? 'active' : null; On Wednesday, February 29, 2012 1:07:08 AM UTC-8, euromark wrote: > > just use conditions then > > if ($condition) {} else {} > > basic PHP one-o-one > > > On 29 Feb., 09:56, Kiran Ambati wrote: > > Hi stephen, > > > > I want add class to onl

Re: Model Array index issue

2012-02-29 Thread jeremyharris
Are your versions of PHP the same on both setups? Remember that for PHP 4.x, you'll need to define $name in your models. On Tuesday, February 28, 2012 4:49:18 PM UTC-8, Waterschaats wrote: > > I have a weird problem with Models and array's > > I moved a website from a test server to the live ser

Re: MVC design for shopping cart

2012-02-29 Thread jeremyharris
I would simply create a component called Cart and add a read() method to just pull the products. Something like this: class CartComponent extends Object { var $components = array('Session'); function read() { $Product = ClassRegistry::init('Product'); $productsInCart = $this->Session->read('Cart

Re: Media PLugin

2012-02-29 Thread jeremyharris
ach out to David > yesterday, hoping to learn more from him so that we can implement this > properly and will report back. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 28 Feb 2012, at 21:15:25, jeremyharris wrote: > > I didn't say I agr

Re: Media PLugin

2012-02-28 Thread jeremyharris
in model get on with > its work. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 28 Feb 2012, at 15:45:29, jeremyharris wrote: > > It should only unset the data if you are creating the User and it's > missing the 'file' key. If you are u

Re: Date out of the V2.1 Stable

2012-02-28 Thread jeremyharris
Generally the response to this question is: when it's done. It's important to understand that CakePHP is a completely volunteer-driven framework. This means that people (core team and otherwise) put in unpaid time after their normal job. Because of this, there isn't a hard and fast release sche

Re: Can't set checkbox value to 0

2012-02-28 Thread jeremyharris
The 'checked' key just checks the checkbox. If you set the value to '0' Cake (well, PHP) sees that as an empty value and therefore assigns it a value (the default being 1). You have a few of options here: 1. Use unconventional string values like 'on' and 'off' 2. Flip the results in the model be

Re: Media PLugin

2012-02-28 Thread jeremyharris
It should only unset the data if you are creating the User and it's missing the 'file' key. If you are updating, you shouldn't *need* the 'file' key. That said, you can probably get away with passing an empty (or a path to a default image) file key when you are creating the User using a hidden

Re: How to upgrade from 2.0 to 2.1

2012-02-27 Thread jeremyharris
this is why we have version control, after all :) On Monday, February 27, 2012 5:16:12 AM UTC-8, Thiago Belem wrote: > > +1 to euromark > > > 2012/2/27 euromark > >> why dont you guys just try it >> its not like it will explode and kill you or something > > -- Our newest site for the community:

Re: HABTM model fields and Security->disabledFields

2012-02-27 Thread jeremyharris
You should only need to disable them if they are being manipulated with JavaScript. That said, I've had issues trying anything other than disabling the entire HABTM data: $this->Security->disabledFields = array('BusinessHour'); This is because the way Cake compares the fields does not take int

Re: Inner Join Clause in the Model.

2012-02-27 Thread jeremyharris
It sounds like you should probably just include your own 'join' 'key[1] in your find statement then. 1: http://book.cakephp.org/1.3/en/view/1047/Joining-tables On Sunday, February 26, 2012 4:15:18 PM UTC-8, padma wrote: > > Hi, > > I have the model configured with belongsto association. > >

Re: Cake 2.0.x auth

2012-02-27 Thread jeremyharris
There's nothing really out of the ordinary going on here, it's basic Cake stuff. Your ajax form should POST the data to /users/login. Then your controller action can look something like: public function login() { if ($this->Auth->login($this->data) { // set flash // set user data via $this->Aut

Re: How to update but if field is empty not

2012-02-27 Thread jeremyharris
Check out Set::filter() On Sunday, February 26, 2012 8:12:10 AM UTC-8, Reynier Pérez Mira wrote: > > I need to run a save/update query but only update those fields that aren't > empty. My form contains a FILE field and if I don't upload any file then > when the save() is executed this field goes

Re: Issue with Form Helper array('type' => 'file')

2012-02-25 Thread jeremyharris
a[$Model->alias]['delete']) > && $Model->data[$Model->alias]['delete'] !== '0') > { > $Model->delete(); > unset($Model->data[$Model->alias]); >

Re: Custom model association column

2012-02-25 Thread jeremyharris
t_id = HospitalAdmission.subject_id' > > ... > ) > > > ? > > On Feb 22, 6:16 am, Stephen Speakman > wrote: > > Something i need to bear in mind when mapping my models, no joining > > between two connections. > > > > Could yo

Re: Issue with Form Helper array('type' => 'file')

2012-02-24 Thread jeremyharris
n using a separate > Attachment table, does this mean I don't need the Coupler element? > > On Feb 24, 2:19 am, jeremyharris wrote: > > What behaviors are you using besides Transfer? Coupler tends to mess > with > > the data because it expects *just* the fields in

Re: Issue with Form Helper array('type' => 'file')

2012-02-23 Thread jeremyharris
What behaviors are you using besides Transfer? Coupler tends to mess with the data because it expects *just* the fields in the Media.Attachment model. Try removing Coupler if it's attached (since you're not using it). Also, unit tests are your friend. It would be much easier to try things and d

Re: Handling data returned by multi-select box

2012-02-23 Thread jeremyharris
It sounds like your $dropdownOpts var might be incorrect. What is it when you debug? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To u

Re: It's possible to change Pagination output markup?

2012-02-23 Thread jeremyharris
Yep, look at the PaginatorHelper docs[1]. 1: http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper The book is your friend :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask

Re: The classic "Fatal error: Call to a member function find() on a non-object" for newbie

2012-02-23 Thread jeremyharris
No problem. Sometimes it helps to have another person look at it :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from th

Re: The classic "Fatal error: Call to a member function find() on a non-object" for newbie

2012-02-23 Thread jeremyharris
It's because the item Country does not exist on Information. Models are always singular, so where you have Countries defined in your Information belongsTo you should have Country instead. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new Cak

Re: Error while trying to bake model for specific table

2012-02-23 Thread jeremyharris
Bake the model Person or tell your People controller to use the People model. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscr

Re: Error while trying to bake model for specific table

2012-02-23 Thread jeremyharris
The model it is probably looking for is Person, which in english is the singular of People. So PeopleController uses the Person model -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help ot

Re: Using $content_for_layout how :-(

2012-02-23 Thread jeremyharris
To include CSS and JS, use the HtmlHelper[1]. This will include files from /webroot/css and /webroot/js $content_for_layout holds the content from the rendered view. All you need to do is echo it in the layout. There isn't anything more that you need to do with it. 1: http://book.cakephp.org/2

Re: Issue with Form Helper array('type' => 'file')

2012-02-23 Thread jeremyharris
What do you mean by corrupted? It should fail gracefully and stop the save process if there's an error. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP relate

Re: Saving a field with every operation in controllers

2012-02-23 Thread jeremyharris
Depends what you mean by "make an action." Do you want to modify the timestamp each time they modify the database, or do you want to modify the timestamp each time they call an action, like /controller/action? If it's the first, then use a behavior. There are a few "logging" behaviors out there

Re: is this possible ? Seeking advice from mysql gurus :)

2012-02-23 Thread jeremyharris
You can do this in a single find() call, using containable. (It will still create many mysql queries because that's just the way it needs to be done, however it will filter all the data for you). Something like: $this-> Customer ->find('all', array( 'conditions' => array( 'Customer.id' =>

Re: Having strange problem with debug()

2012-02-23 Thread jeremyharris
That is weird, seeing as debug() uses print_r(). Try debug($results, false) to see what you get. If it shows info, the problem lies in the html entity encoding. Maybe you have html in your results that just cause it to look like nothing's there (view source to see what's really there). -- Our

Re: Having strange problem with debug()

2012-02-22 Thread jeremyharris
You probably get the warning because you are including the sql log element somewhere else (like in your layout). Remove it and it will show up in debug kit. As for the empty results, do you have behaviors attached or anything that might be touching the data? -- Our newest site for the commun

Re: Media Plugin of David Persson is for cake 1.3 and for cake 2.0?

2012-02-22 Thread jeremyharris
See: https://github.com/davidpersson/media/issues/66 -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send

Re: Controller/View and Model it is not working

2012-02-22 Thread jeremyharris
Just to be clear, your DocumentRoot is correct either way. If you point it to webroot, there's less work on the server's end to find it. Like kdubya said, make sure debug is on. If you're receiving a 404 error that means something is broken within cake (missing method, model, etc) and in produc

Re: Custom model association column

2012-02-21 Thread jeremyharris
Does Containable not work? $this->HospitalAdmission->find('all', array( 'contain' => array( 'Subject' => array( 'Contents' ) ) )); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.o

Re: HtmlHelper::div close tag?

2012-02-21 Thread jeremyharris
The reason is because $text is empty. HtmlHelper::div uses HtmlHelper::tag which documents that it will only print the starting tag if no text is within the tag. I personally don't like this behavior. That's why you'll see things like this in baked code echo $this->Html->tag('div', $post['Post'

Re: Undefined index with associated afterFind()

2012-02-21 Thread jeremyharris
Well for one you're calling a find twice, once in $this->Quote->find('all') and again in $this->paginate(). You only should be calling $this->paginate() which will perform the find for you, and limit the results to the pagination settings. -- Our newest site for the community: CakePHP Video Tu

Re: How to make and use your own functions

2012-02-17 Thread jeremyharris
In the view you would create a helper that had the function on it. Your controller includes that helper. I'm not trying to be mean here, but even to use CakePHP you have to have a semi-decent grasp on programming PHP. Understanding functions, classes, scope (the $this keyword) are all still imp

Re: How to make and use your own functions

2012-02-16 Thread jeremyharris
Well, just think of how the function will be used. In CakePHP, you can split things up into components, helpers and behaviors as well. CakePHP is just PHP so you can technically put the function anywhere. If you put it in your AppController all of your controllers will have access to it. If you

Re: Undefined index with associated afterFind()

2012-02-16 Thread jeremyharris
Let's see your model associations set up, where the afterFind is, and what find call you are using. That will probably give me a better understanding of what's going on. Also have you looked at virtual fields? They might be an answer to your problem. -- Our newest site for the community: Ca

Re: Using Cakephp 1.3 console with Cakephp 2.0

2012-02-15 Thread jeremyharris
You can by just browsing to the 1.3's console directory and running it from there cd /path/to/1.3app/cake/console cake -app /path/to/1.3app bake All putting it in your path does is make it easy to call cake bake from anywhere. -- Our newest site for the community: CakePHP Video Tutorials ht

Re: restricting afterFind() to one method

2012-02-15 Thread jeremyharris
Remember that there's a separation between controllers and models. The model really doesn't need to know the method (and really shouldn't). I agree with euromark, attach it within the methods you want to use it. Or, attach it in beforeFilter for a little more organization. -- Our newest site f

  1   2   >