Validation errors not working properly

2012-05-14 Thread rahaji...@bankofbaku.com
This stuff is mostly taken from http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html Here's the model: class User extends UserModel { public $name = 'User'; public $validate = array( 'username' = array( 'rule1' = array(

Re: Validation errors not working properly

2012-05-14 Thread rahaji...@bankofbaku.com
Sorry, my bad, initially I changed all occurrences of the tutorial's User to Admin, then I changed my mind and reverted back to User, but missed this echo $this-Form-create('Admin'); After changing to echo $this-Form-create('User'); everything works. Don't do this at home :) -- Our newest

Re: Undefined property: LinksController::$Text

2012-05-14 Thread AD7six
On Sunday, 13 May 2012 11:17:55 UTC+2, luftlinie wrote: hi, i wanna use striplinks from Text helper but cake gives me this error Notice (8): Undefined property: LinksController::$Text [APP \controllers \links_controller.php, line 1480] Fatal error: Call to a member function

Re: Bake in Cakephp 2.0 give me a code of previus version?!!

2012-05-14 Thread gabrielem
Solved! Il giorno sabato 12 maggio 2012 14:30:45 UTC+2, gabrielem ha scritto: now I found a different problem :) The code generated by bake is now of cakephp 2.0 version But it not work... I have only a blank page, and if i write something in the app controller or every where i have

Passing value back to controller

2012-05-14 Thread rahaji...@bankofbaku.com
Say you need to generate a random password when creating new user: class User extends AppModel ... public function beforeSave() { $this-data[$this-alias]['password'] = AuthComponent::password(self::generatePassword()); return true; } } and in the

Re: Passing value back to controller

2012-05-14 Thread LITTO CHACKO
i think if u return password from model and in the controller pass it to message what u set in flash.. $this-Session-setFlash(__(The user has been saved.$pass)); may be it works On Mon, May 14, 2012 at 3:04 PM, rahaji...@bankofbaku.com rahaji...@bankofbaku.com wrote: Say you need to generate a

Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ........../includes/modules.php on line 87

2012-05-14 Thread vikram sharma
*HELLO , i INSTALL THE SOFTWAREhttp://open-school.org/ http://open-school.org/FOR SCHOOL MANAGMENT SOFTWARE THERE COME AN ISSUE Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ../includes/modules.php

Re: Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ........../includes/modules.php on line 87

2012-05-14 Thread AD7six
On Monday, 14 May 2012 12:20:20 UTC+2, vikram sharma wrote: *HELLO , i INSTALL THE SOFTWAREhttp://open-school.org/http://open-school.org/FOR SCHOOL MANAGMENT SOFTWARE THERE COME AN ISSUE Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion

Re: Passing value back to controller

2012-05-14 Thread rahaji...@bankofbaku.com
On May 14, 2:53 pm, LITTO CHACKO li...@axtecindia.com wrote: i think if u return password from model and in the controller pass it to message what u set in flash..  $this-Session-setFlash(__(The user has been saved.$pass)); may be it works Then the question would be how to return password

Re: Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ........../includes/modules.php on line 87

2012-05-14 Thread vikram sharma
Hi its a cake php based. On Mon, May 14, 2012 at 4:04 PM, AD7six andydawso...@gmail.com wrote: On Monday, 14 May 2012 12:20:20 UTC+2, vikram sharma wrote: *HELLO , i INSTALL THE SOFTWARE http://open-school.org/http://open-school.org/FOR SCHOOL MANAGMENT SOFTWARE THERE COME AN ISSUE

Re: Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ........../includes/modules.php on line 87

2012-05-14 Thread vikram sharma
?php /** * @fileincludes/modules.php * @descriptionModule model for checking, deleting, installing modules. * @packageOpen-School v1.0 * @copyrightCopyright (C) 2005 - 2008 Open-School. All rights reserved. * @licenseGNU/GPL, see LICENSE.php * Open-School is

Re: Warning: include_once() [function.include]: Failed opening 'ERROR_PAGE' for inclusion (include_path='.:/opt/lampp/lib/php') in ........../includes/modules.php on line 87

2012-05-14 Thread AD7six
On Monday, 14 May 2012 12:41:36 UTC+2, vikram sharma wrote: Hi its a cake php based. IC so, you haven't used CakePHP before then? This isn't a general-php support group. We'll moderate your replies for now - you're currently mailing 10k+ people about something that's irrelevant. I'm not

How to tell if it's an edit or create action?

2012-05-14 Thread rahaji...@bankofbaku.com
In model's beforeSave() I need to do different things based on whether we're adding or editing an existing object. Unfortunately $this- data[$this-alias]['id'] is empty even when editing (but it's in the URL). How can I _cleanly_ check if we're creating or editing? My first impression is that

Re: How to tell if it's an edit or create action?

2012-05-14 Thread Jeremy Burns | Class Outfit
Ask yourself this: If the id column is empty, how does the model work out which row to update?, and then check your code that sends data to the model (the id column to be present and populated on an edit). Jeremy Burns Class Outfit http://www.classoutfit.com On 14 May 2012, at 12:28:43,

Duplicate query when use containable

2012-05-14 Thread Điển vũ
I use this query , and it created a lot duplicate query . This problem seems many people met. $this-Action-find('all', array( 'limit' = 60, 'order' = array('Action.created DESC'), 'contain' = array( 'Thread' = array('Game' = array('Image' = array('limit' = 1))), 'Post' = array('Thread' =

Re: How to tell if it's an edit or create action?

2012-05-14 Thread Thomas Ploch
I suppose that: a) The hidden input for Model.id is missing from the edit form. b) The record isn't being read in the action beforehand Regards Thomas Am 14.05.2012 13:38, schrieb Jeremy Burns | Class Outfit: Ask yourself this: If the id column is empty, how does the model work out which row

Re: Server Move: Catch old details page url and forward to cake style url

2012-05-14 Thread heohni
If I try this: (from the 2.0 book) Router::redirect( '/details*', array('controller' = 'qrcode', 'action' = 'redirect', array('persist' = true) )); I get this message: The requested address *'/details.php?id=4863'* was not found on this server. What is wrong with my Router? --

Re: Login / idle timeout

2012-05-14 Thread bs28723
I am writing and reading session variables about half the transactions. What is the default timeout for session, if I don't set anything? Thanks, bill On 5/14/2012 1:07 AM, TobyG [via CakePHP] wrote: Might it be because you are not touching the session after the initial login? Not sure if

Re: How to tell if it's an edit or create action?

2012-05-14 Thread stork
Read api/code of Model::$id Model::getID() Model::exists() -- 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

Re: How to tell if it's an edit or create action?

2012-05-14 Thread rahaji...@bankofbaku.com
On May 14, 5:05 pm, Thomas Ploch profipl...@googlemail.com wrote: I suppose that: a) The hidden input for Model.id is missing from the edit form. b) The record isn't being read in the action beforehand It isn't missing. the edit action receives it as a parameter. It's in the URL!

Re: How to tell if it's an edit or create action?

2012-05-14 Thread rahaji...@bankofbaku.com
On May 14, 5:43 pm, stork lubomir.st...@gmail.com wrote: Read api/code of Model::$id Model::getID() Model::exists() Excellent! $this-getID() did the trick in beforeSave(). Thanks. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new

Re: How to tell if it's an edit or create action?

2012-05-14 Thread bs28723
I am not sure if adding exists() to beforeSave is another DB query or not. But, why not add a field in your add and edit functions? function admin_add($id = null) { // other checks if ($this-request-isPost() || $this-request-isPut()) { $this-request-data['new'] = true;

Set page number in cakephp pagination

2012-05-14 Thread Kiran
I want to get multiple pagination on same template. I am querying 2 different models to paginate in 2 different places of a template file file. As you have guessed if I click next page of one of both pagination, both the models fetches next page values. I have done enough research and tried

Re: Component cannot import vendor files

2012-05-14 Thread mubasshir pawle
Did it work for you as I dont see further replays. On Saturday, November 14, 2009 3:33:57 AM UTC+5:30, [ ramesh ] wrote: I have a component like this App::import('Vendor', 'Twitter', array('file' = 'twitter'.DS.'EpiCurl.php')); App::import('Vendor', 'Twitter', array('file' =

Re: Duplicate query when use containable

2012-05-14 Thread Thiago Belem
Did you set the cacheQueries model property? http://book.cakephp.org/2.0/en/models/model-attributes.html#cachequeries -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil *Assando Sites* - Curso online de *CakePHP* assando-sites.com.br http://goo.gl/b1EEd thiagobelem.net

Re: Duplicate query when use containable

2012-05-14 Thread Điển vũ
I don't use cacheQueries but I tested with cacheQueries = true or false , no change happen. -- 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

Re: Duplicate query when use containable

2012-05-14 Thread Điển vũ
I found out this problem cause by my SQL table design mistakes. -- 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

Related model question

2012-05-14 Thread Andrés Manikis
Hello. I'm new in Cake and I'm having a problem with a model relationship. I have a model named Person and another one named Producer. Producer belongs to Person. When I try to access the person from the producer model I can't get anything. I mean, if inside Producer.php I do $this-Person-name

Re: optional routing elements

2012-05-14 Thread rihad
Isn't this a bug? -- 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 email to

The length parameter is not working for some input fields

2012-05-14 Thread Daniel
The length parameter is not working for some input fields. For example it is not working for a password field: echo $this-Form-input('password', array('length' = '16')); ... this is not limiting the number of characters entered. Also it is not working for a captcha field: div id=normaltxtPlease

Make all radio buttons unchecked

2012-05-14 Thread luvnrocs
I didn't create our online ordering system, but now I need to make a slight change to one of the forms but I'm not sure how to code it. Here's the present code for a list of radio buttons. By default the first one is automatically selected. I would like to make it so that none of the buttons are

Saving Multiple rows from table that has been created dynamically.

2012-05-14 Thread Super Steve
Hello, I have a table that stores procedure title and description and a table that stores steps to a procedure. Steps table would store a procedure foreign key. In my view-single-procedure page, I have made a table where the user can create more rows to the table dynamically via javascript.

Re: Undefined property: LinksController::$Text

2012-05-14 Thread luftlinie
im using 1.3 how do i load it manually? thx :) On 14 Mai, 09:38, AD7six andydawso...@gmail.com wrote: On Sunday, 13 May 2012 11:17:55 UTC+2, luftlinie wrote: hi, i wanna use striplinks from Text helper but cake gives me this error Notice (8): Undefined property: LinksController::$Text

Get related model

2012-05-14 Thread Andrés Manikis
Hello. Is there a way to get a related model when I'm in a controller? What I mean is doing something like this: Suppose I have an Author model and a Book model and an author has many books. I would like to do something like this: class BookController { public function view($id) { $book =

Events, multiple listeners, and return data

2012-05-14 Thread Jamie Nay
I'm wondering if anyone else has come across this: I have a situation in which I'm dispatching an event with 2.1's event system, and have multiple listeners for that event. Each listener returns its own set of data, with the idea being that all of the returned data is compiled into one set (in

Re: Get related model

2012-05-14 Thread Alejandro Gómez Fernández
I think the simplest way to see this in action is using BAKE and analizing the generated code. Please, see the blog tutorial and then, make your own tests using bake. You'll see how cake manage this relations automagically. Regards, Alejandro Gómez Fernández Enviado desde mi iPad El

Re: Get related model

2012-05-14 Thread Thiago Belem
$book = $this-Book-findById($id); $author = $book['Author']; -- ***Thiago Belem* Desenvolvedor Rio de Janeiro - RJ - Brasil *Assando Sites* - Curso online de *CakePHP* assando-sites.com.br http://goo.gl/b1EEd thiagobelem.net cont...@thiagobelem.net *Skype / gTalk **»* thiago.belem.web

Events, multiple listeners, and return data

2012-05-14 Thread José Lorenzo
Basically you have two options, one is writing the result property directly on each listener to push new values on the array as needed, wich is the option I would recommend. The other option is to use the ObjectCollection instead of the event sustem and pass the collectReturn param -- Our

Re: Events, multiple listeners, and return data

2012-05-14 Thread Jamie
Thanks. Just curious - why is the result data overwritten in this way? For me, at least, using the event system to get information from multiple listeners (as in my situation) was one of the first uses I thought of, especially since it can replace a bunch of custom stuff I had written previously.

Inheritance?

2012-05-14 Thread Andrés Manikis
Hello. I'm trying to solve the following problem: In my application I have to model different kinds of people, lets say engineer, architect and designer. Most of the data is the same for the three cases but they differ in some fields. From OO theory I think I could solve this using either

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

2012-05-14 Thread double07
Just thought I'd post my slightly cleaner solution to this which makes use of a modified version of the attachments element in the media plugin. This allows you to use the attachment multiple times in a form for when you have different groups of attachments i.e. photos, files, videos etc. I'm no

Re: Events, multiple listeners, and return data

2012-05-14 Thread José Lorenzo
If you think about it, collecting return values is actually the edge case: A save operation has a single result wich is data to be saved A redirect operation has a single result, the URL to redirect to A dispatching operation has a single response value as result There a very few cases where

Inheritance?

2012-05-14 Thread José Lorenzo
I'm going to answer with a recommendation a professor said to me in college: if you have a people table in your database, you are doing it wrong. I'm not going to argue against your design, there are valid cases for modeling inerrancy in relational databases. Please have a look at

Re: Related model question

2012-05-14 Thread Jeremy Burns | Class Outfit
Can you show some code? Show the model associations from each model and the code where you are trying to do the look up. Jeremy Burns Class Outfit http://www.classoutfit.com On 14 May 2012, at 17:53:31, Andrés Manikis wrote: Hello. I'm new in Cake and I'm having a problem with a model

Re: Saving Multiple rows from table that has been created dynamically.

2012-05-14 Thread Jeremy Burns | Class Outfit
Would like to see some code Basic principle is that each row gets an id ($data['Step'][0]['id'], $data['Step'][1]['id'], etc) and then you do a saveAll (http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-saveall-array-data-null-array-options-array). Jeremy Burns Class Outfit

Cakephp1.3 autocomplete problem

2012-05-14 Thread Mangesh Sathe
Hello all , I need some help on autocomplete, I want to fetch merchant names from database. Here is my code. controller ?php class MerchantsController extends AppController { var $name = 'Merchants'; var $uses =