Re: Proof of concept: Custom validation using beforeValidate

2006-06-12 Thread RosSoft
invalidate() sets a row in an array with a value of 1. Change invalidate() to set the string as value (then the errors will be available in your controller and helpers) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Proof of concept: Custom validation using beforeValidate

2006-06-12 Thread ginstrom
I really like the idea of custom validation error messages. For example, for a password field you could check that the password was entered the same way twice, contains at least two numbers, no illegal characters, etc., and give a different error message for each. I think that validation should l

Re: Please help with Ajax controller method

2006-06-12 Thread nate
Personally, I think putting JSON data in the header is a poor solution, especially when you consider that all Prototype adds is doing the eval( ) for you. It's better to just embed the data in your own custom JS code. And yes, AjaxHelper::remoteFunction is used to generate Ajax.Request and Ajax.

Re: Please help with Ajax controller method

2006-06-12 Thread [EMAIL PROTECTED]
The point of the original post (and my solution) was to send JSON formatted data back to the client, not just HTML to be inserted in a div. Maybe I should've created a less trivial example... Anyhow my original solution wasn't good, the json.thtml view should be: /app/views/test/json.thtml in

Re: custom session name

2006-06-12 Thread John Zimmerman [gmail]
define('NEW_SESSION_NAME', 'php'); I don't believe this belongs in your core.php file.It most likely should read ...    define('CAKE_SESSION_SAVE', 'php');What exactly are you trying to do?  You can rename the cookie, you can change the session string, you can change the session table if you are u

Re: Errors when using bake.php

2006-06-12 Thread bigdog
Did you setup your database file to connect? http://manual.cakephp.org/chapter/4 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To u

Re: New JavaScript Features

2006-06-12 Thread clenard
Sounds interesting, Thanks for the heads up! :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send

Re: getting sum of a column for one field

2006-06-12 Thread [EMAIL PROTECTED]
the code about the limitClause must be changed to this : if ($limit != null) { $offset = ($page > 1) ?( ($page - 1) * $limit) : 0; $limitClause = " LIMIT " . $offset . "," . $limit ; } else { $

getting sum of a column for one field

2006-06-12 Thread [EMAIL PROTECTED]
hi all, last night I came up with a generic function to be able to get the sum of the numeric values of certain rows. I am wondering if there was not an easier solution than mine. Feedback and improvement would be greatly appreciated :) so here it is (I put it in app_model.php so it ios availa

Re: othAuth and default sessions

2006-06-12 Thread jeko
change it to 'medium' then see what happens. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send emai

New JavaScript Features

2006-06-12 Thread nate
I just wanted to give everyone a heads-up on some new features that have been added to JavascriptHelper of late. One is the addition of two parameters to cacheEvents( ) ($file and $all) that allow you to cache JavaScript events, or all JavaScript code written by JavascriptHelper, to an external f

Re: othAuth and default sessions

2006-06-12 Thread [EMAIL PROTECTED]
I was hoping for a bit more detail :) I'm not getting my sessions stored for anytime at all. Nothing to do with inactivity. I had wondered if security impacted on more than just wait time. --~--~-~--~~~---~--~~ You received this message because you are subscribed

custom session name

2006-06-12 Thread [EMAIL PROTECTED]
Hi All, Newbie question: i need to change the name of my php sessions, so in my core.php: i changed this variable: define('NEW_SESSION_NAME', 'php'); however, i got two notices: "Use of undefined constant CAKE_SESSION_SAVE - assumed 'CAKE_SESSION_SAVE' in /Library/WebServer/Documents/help/cake

Re: othAuth and default sessions

2006-06-12 Thread John David Anderson
On Jun 12, 2006, at 2:04 PM, [EMAIL PROTECTED] wrote: > > It's the default of > > define('CAKE_SECURITY', 'high'); > > are there docs explaining just what each setting means? Yep: CAKE_SECURITY: Change this value to indicate your preferred level of sessions checking. Cake will timeout sessio

Re: othAuth and default sessions

2006-06-12 Thread [EMAIL PROTECTED]
It's the default of define('CAKE_SECURITY', 'high'); are there docs explaining just what each setting means? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to c

Re: What is $this->Post->User->set(....) in rdBloggery

2006-06-12 Thread [EMAIL PROTECTED]
nate wrote: > Hint: Look at the associations in app/models/post.php Yes, Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To u

Re: What is $this->Post->User->set(....) in rdBloggery

2006-06-12 Thread nate
Hint: Look at the associations in app/models/post.php --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group,

Re: Problems w/ Graham Bird's Task List Tutorial

2006-06-12 Thread nate
You're probably better off using this: http://api.cakephp.org/class_ajax_helper.html#e9b39f961e4c9fd0c8a09b41532b6125 For the $href parameter (the URL), it should be in the form of "/controller/action/parameter", for example "/tasks/edit/1" assumes that you have a TasksController with an edit( )

What is $this->Post->User->set(....) in rdBloggery

2006-06-12 Thread [EMAIL PROTECTED]
I studying the rdBloggery. In a PostsController there is $this->Post->User->set(...); Is't Ok for the PostsController call the wiew Post but I don't anderstand how the Post model call the User model ? --~--~-~--~~~---~--~~ You received this message because you

Re: One application, different views for each virtual host

2006-06-12 Thread nate
Yeah, there's a variable in Controller called $themeWeb that you can set, which will automatically pull assets from a different subdirectory of your webroot. I'm acutally not too sure on the details. PhpNut? --~--~-~--~~~---~--~~ You received this message becaus

Re: How optimize application?

2006-06-12 Thread nate
Yes, we're working on a very sophisticated query cache system for 2.0. Right now we just have some basic optimizations, i.e. if the same query is executed more than once, Cake will return the in-memory result. You can disable this on a per-model basis by setting var $cacheQueries = false. --~--

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread brandags
Wow, that is awesome. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL

Re: How optimize application?

2006-06-12 Thread [EMAIL PROTECTED]
I gotcha - makes sense; How would you go about clearing the persistModel cache? Out of curiousity is there any query caching built in / being built in to cake? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake

Re: How optimize application?

2006-06-12 Thread nate
Okay, you're getting your methods of caching confused. By default, Cake caches table descriptions loaded from the database, either for a very short time (15 seconds in debug mode), or a long time (several years in production mode, recently increased from 24 hours). $persistModel, however, causes

Re: Please help with Ajax controller method

2006-06-12 Thread nate
Well, that's a lot more work than you need to do, but okay. What about this: /app/controllers/test_controller.php set('text', 'Hello World!'); } } ?> /app/views/test/get_text.thtml /app/views/test/index.thtml The text below is retrieved asynchronously from the server, and updated eve

One application, different views for each virtual host

2006-06-12 Thread Mike52
Hi, I want to have one CakePHP application serving several sites. Each site has its own virtual host. I want each site to have its own look. I have done this before in Smarty by simply setting the template directory and the compiled-template directory. Something like this: class AppSmarty exte

Re: How optimize application?

2006-06-12 Thread [EMAIL PROTECTED]
with debug set to zero doesn't CakePHP cache the model views for 24 hours at a time? So, once you went live it is going to cache the model for 24 hours at a time. And if you don't need those models then why are you making associations for them? You need to be careful using bindModel all over th

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of brandags > Wait - but don't I still need to send the validation rules, > etc. to the > view? Can you change what parameters are sent to the > startup() function? Well, here is your init function: function init($validations=null, $data=null) { $formDa

Errors when using bake.php

2006-06-12 Thread [EMAIL PROTECTED]
Thanks to everyone in advance. When I am using bake.php- i keep getting these error when it trys to write out the config info for the db: php bake.php -app /var/www/si/testapp Creating file /var/www/si/cake///var/www/si/testapp/config/database.php Warning: fopen(/var/www/si/cake//var/www/si

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread brandags
Wait - but don't I still need to send the validation rules, etc. to the view? Can you change what parameters are sent to the startup() function? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To p

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread brandags
Oh, that's very nice! I was wondering if there was something like that. Thanks for letting me know. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@go

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of brandags > It extends Cake's Form helper and also takes the validation from the > model (using the advanced validation method - multiple rules > per field) > so you don't have to retype the validation messages or which > fields are > required, in your vie

Re: Problems w/ Cake Tutorials Working.. Getting Fatal Errors

2006-06-12 Thread jeannie109
Thank you so much! Problem solved. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMA

Re: Problems w/ Cake Tutorials Working.. Getting Fatal Errors

2006-06-12 Thread DJ Spark
On 6/12/06, jeannie109 <[EMAIL PROTECTED]> wrote: > > Here is the URL: > http://cakephp.org/pastes/show/2fde1e708150e1046c472674853e9879 > > > > > -- [web] http://synapsisdi.com.br [livesets] http://djspark.com.br --~--~-~--~~~---~--~~ You received this

Re: updating a record

2006-06-12 Thread [EMAIL PROTECTED]
basically you'd want to set $this->data['Model']['user_id'] = $this->Session->user_id (I forget correct Session syntax at the moment, but you ge tthe idea) - do this before your $this->Model->save($this->data) statement in your controller's "add" or "edit" methods in your "Edit" method do pretty

Re: How optimize application?

2006-06-12 Thread [EMAIL PROTECTED]
I just stumbled onto this post by chance, and persistModel looks very interested, but i can't really find it covered in any docs - If you're using model caching in this fashion, how do you control when/how-often the model cache gets refreshed? --~--~-~--~~~---~--~

Re: insert id after save?

2006-06-12 Thread [EMAIL PROTECTED]
either perform $this->Comment->save($this->data) and then refernece $this->Comment->id -OR- if you have your associations setup in the models you can have $this->data['Comment'] and $this->data['Comment_Association'] all saved via $this->Comment->save($this->data) (that second method probalby isn

Re: Problems w/ Cake Tutorials Working.. Getting Fatal Errors

2006-06-12 Thread jeannie109
Here is the URL: http://cakephp.org/pastes/show/2fde1e708150e1046c472674853e9879 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To un

Problems w/ Graham Bird's Task List Tutorial

2006-06-12 Thread jeannie109
I am having problems trying to place the correct URL that Graham states in his tutorial for the AJAX task list for done.thml: "If Cake is installed in a subfolder (ie not your server's web root) then you will need to use $html->url("/tasks/undo/" . $item["id"] ); in the second Ajax.Updater argume

Re: Problems w/ Cake Tutorials Working.. Getting Fatal Errors

2006-06-12 Thread Larry E. Masters aka PhpNut
You have a syntax error in app/app_controller.phphttp://cakephp.org/pastes/addpaste the contents of that file in the link above then send the url back in a reply to this email. -- /*** @author Larry E. Masters* @var string $userName* @param string $realName* @returns string aka PhpNut* @access  pub

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread brandags
I've also been working on a similar form helper. I just uploaded it at: http://cakeforge.org/snippet/detail.php?type=snippet&id=75 It extends Cake's Form helper and also takes the validation from the model (using the advanced validation method - multiple rules per field) so you don't have to rety

Re: Problems w/ Cake Tutorials Working.. Getting Fatal Errors

2006-06-12 Thread jeannie109
I tried what you suggested above and only got this line (which I don't understand) Parse error: parse error, unexpected T_VAR in /jobboard.bernardtransportation.com/CAKE/app/app_controller.php on line 42 Both the tasks and gallery are tutorials which I did not change the code at all. I am just t

Re: Please help with Ajax controller method

2006-06-12 Thread [EMAIL PROTECTED]
Here's how I solved the problem: /app/controllers/test_controller.php set('text', $this->Json->encode(array('text' => 'Hello World!'))); $this->render('json', 'ajax'); } } ?> /app/views/layouts/test.thtml http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http:

Re: Updating HABTM relationships

2006-06-12 Thread Martin
For anyones info I didn't go ahead with putting this feature into the Model. I went the same way as before and as panyasan. I created an action that loops the existing associations and makes the desired modifications and then I use that from other actions and controllers as a requestAction('/pat/t

Re: Problem creating a user registration area

2006-06-12 Thread Andy
The last post on that thread, suggesting using beforeValidate, seemed to work well for me. I've included using beforeSave as well for hashing the password, such as: function beforeValidate() { if (!isset($this->data[$this->name]['id'])) { $user = $this->findByUsername

Re: Problems with TestSuite

2006-06-12 Thread Timo Derstappen
Thanks, the test suite works fine now using the test controller. @Larry: I still don't know how to access my models from outside the framework without using the test controller. Can you pls clear things up? Anyway thank you for the nice test suite. Cheers, Timo On 6/9/06, Larry E. Masters aka

View cache

2006-06-12 Thread Gonçalo Marrafa
Hi. I've been playing with view caching but there are some things i don't understand. First of all, to get cake to place cache files in tmp/cache/views, i had to add Cache to the list of helpers. Correct me if i wrong but i think that is not mentioned in the manual. Secondly, even though the c

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of RosSoft > I repeat, use $value=$this->Html->tagValue($fieldName) for maximum > compatibility Thanks for the pointer. I actually ended up copying the HtmlHelper code into FormationHelper and modifying it, because tagValue was calling h() (AKA htmlspecial

Re: redirect to previous page

2006-06-12 Thread josh robb
The rough equivalent would be to use the following in your controller action: $this->redirect($this->referer()); There are some useful params to referer which are worth checking out. http://api.cakephp.org/class_controller.html#87f90447a9235c60ea65f9ff4cad2de8 j. On 6/12/06, rinda <[EMAIL PRO

redirect to previous page

2006-06-12 Thread rinda
Hi, how do you redirect to previous page. I have function that change language of the web. This function does not render the view. All the controller's functions have this access to this function. I mean, you can change the language in any page of the web. What I want is. after change the lang

Re: othAuth and default sessions

2006-06-12 Thread jeko
What is CAKE_SECURITY set to in core.php? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email t

Re: HasMany relationship and select conditions

2006-06-12 Thread jeko
It sounds like you should use bindModel in the controller, and set a variable for the conditions key in the hasMany Instructor array. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread RosSoft
be careful, you're only using $this->data at helper, but it only works if you put $this->data in controller. There's two ways at controller to set the data, $this->data or $this->params['data']. You must check these two at your helper for ensure compatibility to all the users (if this is what you

othAuth and default sessions

2006-06-12 Thread [EMAIL PROTECTED]
I've just setup othAuth and the user session isn't being saved between pages. I can login ok but when I go to another page on the model I'm asked to login again. I've set var $othAuthRestrictions = "*"; and in the database I've created a permission and a group permission. If I var_dump($this->

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of RosSoft > You don't need to pass $data to the helpers: see the blog > tutorial edit > action: OK, I have been enlightened. Thanks! Thanks to you, I've improved my component and cleaned up my controllers as well. Open source at its best. So the example c

Re: creating a selectTag from an enum in the model

2006-06-12 Thread naryga
I've been dealing with the same issue. If you use scaffolding, it works just fine, producing a very nice select box. If you use bake.php, it produces LOT'S of errors. Shold be consistent. It seems like there should be something in the manual about dealing with verious column types. --~--~---

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread RosSoft
You don't need to pass $data to the helpers: see the blog tutorial edit action: function edit($id = null) { if (empty($this->data)) { $this->Post->id = $id; $this->data = $this->Post->read(); } else { if ($this->Post->save($this->data['Post']))

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of RosSoft > If you use $this->params['data']=$data at your controller, then in the > helper is accessible through $this->params['data'] > > If you use $this->data at your controller, then in the helper > $this->data I've been doing: $this->set( 'data', $th

Re: HasMany relationship and select conditions

2006-06-12 Thread dudus
Is there really nobody who has ever come across this problem? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread RosSoft
Ok now I'm documented. If you use $this->params['data']=$data at your controller, then in the helper is accessible through $this->params['data'] If you use $this->data at your controller, then in the helper $this->data The correct way is to check where is the data. From HtmlHelper: fu

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread RosSoft
mmm..but I think that $this->params['data']=$data; is "standard", see first blog tutorial of wiki, edit() action: http://wiki.cakephp.org/tutorials:blog_tutorial_-_1?s=params+data function edit($id=null) { if (empty($this->params['data'])) { $this->Post->id = $id

Re: Uploaded Form Helper: FormationHelper

2006-06-12 Thread RosSoft
I think that you must do $this->set('data',$data) at controller (it's standard) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To uns

Re: radio button select

2006-06-12 Thread sicapitan
a thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more

RE: Uploaded Form Helper: FormationHelper

2006-06-12 Thread Ryan Ginstrom
> [mailto:[EMAIL PROTECTED] On Behalf Of RosSoft > Looks promising, Thanks! > I think that you can avoid $data parameter, it must be accessible in > the helper through $this->params['data'] > (because HtmlHelper needs it) That's a good idea, and would definitely clean up the function calls. But