Re: Paginate limit setting

2009-08-23 Thread leafchild book
Thanks brian :) l On Fri, Aug 21, 2009 at 3:43 AM, brian wrote: > > Set the limit at 8 as normal and override it in the admin action: > > $this->paginate['YOUR_MODEL']['limit'] = 50; > > On Fri, Aug 21, 2009 at 5:30 AM, leafchild > wrote: > > > > I have admin page (admin_view.ctp) and public pag

Re: How to save a record but not clear an empty field?

2009-08-23 Thread delocalizer
Yes nice, I hadn't though of that. So you would test for: if (isset($this->data['User]]['password']) && $this->data['User'] ['password'] == Security::hash(Configure::read('Security.salt'))) On Aug 24, 1:27 pm, "Dr. Loboto" wrote: > > If you do this you'll have to hash your own password rather th

Re: array from query() call

2009-08-23 Thread jeff
=>To make custom queries use the foll *Syntax:* $this->model name->query(" sql query here “ ); On Mon, Aug 24, 2009 at 11:39 AM, dhiraj ray wrote: > > how to run something like a mysql_query and then mysql_fetch_array > > simple use > $rs=Query("your Query"); > > to pass data to mysql;

Re: array from query() call

2009-08-23 Thread dhiraj ray
> how to run something like a mysql_query and then mysql_fetch_array simple use $rs=Query("your Query"); to pass data to mysql; u can use config file to to connect with data base app/config/database.php sorry for my bad english dhiraj (india); --~--~-~--~~~---~--~--

Re: Please Help!! my password is always null!!!

2009-08-23 Thread thatsgreat2345
$form->create('User', array('url'=>array ('controller'=>'users','action'=>'login'))); On Aug 23, 9:50 pm, liaogz82 wrote: > Hi all, > > I dont know why but my password is always sent as null in $this->data, > which causes it to be unable to retrieve data for comparison. The > following below are

Re: Please Help!! my password is always null!!!

2009-08-23 Thread Martin Westin
My guess is that Auth component is doing it. If you are doing your own authentication you have to remove Auth from your list of components. And if you do want to use Auth ten you shouldn't do any of the authenticating stuff yourself. /Martin On Aug 24, 6:50 am, liaogz82 wrote: > Hi all, > > I

Re: Export to Excel

2009-08-23 Thread Martin Westin
There is a trick that almost makes me love Microsoft... You can export an html table to Excel. Just output a table, maybe some heading before and a p-tag after if you like... no layout... no full html document needed. Just make the browser think this html table is an excel file and Excel will hap

Re: How do I merge 2 tables

2009-08-23 Thread Martin Westin
Here are two basic example of how you do it using MySQL insert with a select statement for the values. http://mysql-tips.blogspot.com/2005/04/mysql-insert-select-example.html and the variation where you can trick mysql into doing an update. http://forums.mysql.com/read.php?61,65650,262461#msg-2

Re: Certain strings crashing CakePHP - where do I look first?

2009-08-23 Thread Bert Van den Brande
I'm glad it's solved :) On Sun, Aug 23, 2009 at 3:38 PM, technicaltitch wrote: > > After a small struggle with my budget hosts, they've told me my text > was triggering a mod_security2 rule and are willing to disable it for > my site (if I assure them I'm on the case re security). As far as I > c

Please Help!! my password is always null!!!

2009-08-23 Thread liaogz82
Hi all, I dont know why but my password is always sent as null in $this->data, which causes it to be unable to retrieve data for comparison. The following below are my codes: login.ctp Login create('User', array ('controller'=>'users','action'=>'login'));?> input('User.username');?>

Re: logged in users list

2009-08-23 Thread Junaed Halim
Thank you all for your reply. I'll get the logged-in users by adding a datetime column and updating it. But how would I know whether someone has logged out or not? They can simply close the browser without logging out themselves. Am I missing something? On Mon, Aug 24, 2009 at 8:50 AM, Miles J wr

Re: Validation alphaNumeric issue.

2009-08-23 Thread Dr. Loboto
alphaNumeric rule is for latin letters only, yes. Good for usernames, for example. If you want non-latin letters there too, you may try this: "rule" => array('custom', '/^[\w\d]*$/iu') But it also includes underscore. And depends on server locale. On Aug 24, 5:37 am, delocalizer wrote: > You're

Re: How to save a record but not clear an empty field?

2009-08-23 Thread Dr. Loboto
> If you do this you'll have to hash your own password rather than let > Auth do it automatically, because Auth will hash a blank password and > the 'if' condition will never be true. If do not touch Auth hashing behavior password field can be checked not as "notBlank" but by comparison with hash

Re: logged in users list

2009-08-23 Thread Miles J
You would need a datetime column named "lastLoginTime" or something equivalent. Then you would update that with the current timestamp each login. Then you would find all users that have logged in within the past x minutes. --~--~-~--~~~---~--~~ You received this m

Re: How to save a record but not clear an empty field?

2009-08-23 Thread delocalizer
Hi Gerard; There would be many ways to do this - one way would be to put some logic in the User model beforeValidate method that checks if password field is set in the data but blank, then password field is unset - so it won't be validated or saved. eg. function beforeValidate(){ if (isset($th

Re: Validation alphaNumeric issue.

2009-08-23 Thread delocalizer
You're very welcome. That will work for ASCII characters only of course. I've never looked into why that library isn't compiled with Unicode support by default - RHEL releases tend towards the conservative, but it seems a strange omission to me to ignore the character sets of most of the world's l

Re: Using a Button to Submit an AJAX Form

2009-08-23 Thread schneimi
Not sure if this is all you need, but the form must have the option onsubmit="return(false);" to not reload the page. Regards On 23 Aug., 15:54, Shaun wrote: > In a non-AJAX form, I commonly use this: > > $form->button('Submit', array('onclick' => 'this.form.submit()')); > > I can't use this wi

Re: How do I merge 2 tables

2009-08-23 Thread Farjad Habib
sory my bad. On Sun, Aug 23, 2009 at 8:08 PM, simplesi wrote: > > > > Farjad Habib wrote: > > > > http://book.cakephp.org/view/78/Associations-Linking-Models-Together > > > > go through this and u ll get an idea > AFAICT there's nothing in there to show how loop through all the records in >

Re: Please help - 3rd time trying to post - Why is knownusers from IBM tutorial not working?

2009-08-23 Thread Dr. Loboto
There are a lot of chages between cake 1.1 and 1.2. IBM tutorials was written for 1.1 On Aug 22, 11:34 pm, winegoddess wrote: > THANK YOU!! > > Im surprised I couldnt find anything correcting the tutorial on this. > > THANK YOU!!! > > Judy > > On Aug 21, 6:41 pm, Sam Sherlock wrote: > > > >

Re: Dying on blank white page

2009-08-23 Thread Arvind
Yes of course. But as i mentioned above no cache files were being written to tmp cache directory. On Aug 21, 3:00 pm, "rich...@home" wrote: > Also worth remembering to clear the app/tmp directories (just the > files, leave the directory structures intact) when you upload > > On Aug 21, 9:22 am,

Re: Dying on blank white page

2009-08-23 Thread Arvind
Well..it may be browser cache but not sure though. On Aug 21, 1:22 pm, Bert Van den Brande wrote: > I've had blank pages when : > * .htaccess was not working as it should, due to restrictions from > Apache (it needed Allow Overwrite All) > * a table was missing from the db, and the error couldn'

Re: pages not diplayed

2009-08-23 Thread Onezino HEAT
the server need change some files of apache conf. http://book.cakephp.org/view/27/Developing-with-CakePHP 2009/8/23 xxbeta > > My project is working properly on my local server, apache on windows > xp. However, after uploading all the files onto the hosting server, > some pages just can not be d

Re: logged in users list

2009-08-23 Thread Onezino HEAT
please read cake log documentation, u can register everthyng the user do. 2009/8/23 Junaed Halim > Hello all, I am using cake's Auth component for login purpose. > Now my client wants to get a list of all logged in users. > Can anyone give any advice how to do that? > > I also need to prevent m

pages not diplayed

2009-08-23 Thread xxbeta
My project is working properly on my local server, apache on windows xp. However, after uploading all the files onto the hosting server, some pages just can not be displayed.Only returns a blank page in the web browser, both IE and Firefox. The hosting server should be linux. Need advice. Thanks

Re: logged in users list

2009-08-23 Thread Rick
You could use a database table (maybe add columns to one of the auth tables?). user/account login-time When a user tries to log in check that his account is not already in the table. if it is there and the login-time is recent then don't allow login. If not there add his name/account and current

Re: Validation alphaNumeric issue.

2009-08-23 Thread Tmyclyk Dmytryk
Thank you for the thorough description, I appreciate it - I could have sworn I had it working on my other CentOS box without doing anything specific, but I may not have, for now I am using "rule" => array('custom', '/^[a-z0-9]*$/i') and it works fine, thank you again! Best Regards, Howard On A

Re: How do I merge 2 tables

2009-08-23 Thread simplesi
Farjad Habib wrote: > > http://book.cakephp.org/view/78/Associations-Linking-Models-Together > > go through this and u ll get an idea AFAICT there's nothing in there to show how loop through all the records in one table and update another table as appropriate :) I tried modifying the foreach

How to save a record but not clear an empty field?

2009-08-23 Thread gedm
I'm wondering how the cakephp bakery site ignores the blank password field when a user is updating their profile? That is, if the password is left blank it updates the other fields in the record but does not clear the password when the record is saved. How is this done? Thanks --~--~-~-

Using a Button to Submit an AJAX Form

2009-08-23 Thread Shaun
In a non-AJAX form, I commonly use this: $form->button('Submit', array('onclick' => 'this.form.submit()')); I can't use this with the AJAX helper because the onclick event will reload the page. How can I use a button with AJAX? I want to avoid using a regular submit button because it doesn't p

Re: Certain strings crashing CakePHP - where do I look first?

2009-08-23 Thread technicaltitch
After a small struggle with my budget hosts, they've told me my text was triggering a mod_security2 rule and are willing to disable it for my site (if I assure them I'm on the case re security). As far as I can tell you cannot disable this in .htaccess files. Thanks SO MUCH for helping me elimina

Request help with a model definition.

2009-08-23 Thread gedm
Hi, I am very new to Cake and have searched for an answer to this but can't quite get my head around it enough to ask ask the right question. I'm hoping someone here can point me in the right direction. I have 2 tables, Users and Comments. Each User has many comments. I have defined the Comme

Re: How do I merge 2 tables

2009-08-23 Thread Farjad Habib
http://book.cakephp.org/view/78/Associations-Linking-Models-Together go through this and u ll get an idea On Sun, Aug 23, 2009 at 5:55 PM, simplesi wrote: > > > I'm re-coding a simple helpdesk application and I'd like to merge 2 tables > into one. > I could probably do this using a raw MySQL qu

How do I merge 2 tables

2009-08-23 Thread simplesi
I'm re-coding a simple helpdesk application and I'd like to merge 2 tables into one. I could probably do this using a raw MySQL query but I'd like to know if it is possible to do it using a one-time controller/view action. My main table is Issues and my associated table is Changes where each iss

Re: array from query() call

2009-08-23 Thread Dr. Loboto
Your explanation looks exactly $this->find('list') : http://book.cakephp.org/view/810/find-list On Aug 21, 8:46 pm, dycokac wrote: > I would like to gain better control/understanding of formatting the > returned array from the query() method. > > I have thought of a few ways around this but can'

Re: Set containable vars in beforeFind() callback of model

2009-08-23 Thread Dr. Loboto
Is ClientUser model always associated? As I know, Containable demand association for models in "contain". On Aug 21, 3:51 pm, Adrian wrote: > Btw when I add debug($queryData); it confirms the contain array is > present: > > app\models\ticket.php (line 175) > > Array > ( >     [conditions] => Arr

Re: Validation alphaNumeric issue.

2009-08-23 Thread delocalizer
It's nothing to do with php version - the problem is CentOS (or RHEL) - cake's built-in 'alphaNumeric' rule uses unicode matching in its regex, which is not supported by the PCRE library that comes with those flavours of Linux. If you know what you're doing you could try to compile the library wit

Re: Export to Excel

2009-08-23 Thread delocalizer
Adam Royle's csv helper is very nice for this... http://bakery.cakephp.org/articles/view/csv-helper-php5 cheers, Conrad. On Aug 23, 12:41 am, AMF wrote: > I've been looking for a good tutorial/exaple on exporting data to > excel like format. > > Any success/ideas/pinters. > > Thanks > > AMF --~