Re: File Uploading

2009-03-12 Thread ORCC
¿Did you put the attribute enctype=multipart/form-data in the form? --~--~-~--~~~---~--~~ 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

Re: Add property last = true to every validation rule

2008-11-20 Thread ORCC
?php class AppModel extends Model { function beforeValidate() { foreach ($this-validate as $field) { foreach ($field as $rule) { $rule[last] = true; It seems that your

Re: Wamp cakePHP allright except bake

2008-10-27 Thread ORCC
Enable the mysqlcli (Command Line Interface) module in PHP It doesn't use to be enable by default. The PHP's mysql module for command line isn't the same mysql module used in CGI/Apache Module. See the php.ini file and php documentation for detail (usually you just have to uncomment a single

Re: CSV file as DataSource

2008-10-27 Thread ORCC
Use the ConnectionManager::getInstance() method to get the DB Manager instance, and set manually the database. $conn = ConnectionManager::getInstance() $conn-config['file'] = 'your_csv_file'; --~--~-~--~~~---~--~~ You received this message because you are

Re: CSV file as DataSource

2008-10-27 Thread ORCC
Actually, it is (assuming your db configuration variable is called default): $conn = ConnectionManager::getInstance() $conn-config-default['file'] = 'your_csv_file'; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

How to save recursively with a hasOne relation

2008-10-17 Thread ORCC
I have the following models: Users (id, name, ...) Preferences (id, user_id, ...) With the relationships User hasOne Preference and Preferences belongsTo User set in each model. I created a form with all fields for either users and preferences. $form-create('User',Array('action' =

Re: What is the proper way of adding script to the layout?

2008-10-17 Thread ORCC
- css - I want to include some css files only when I use Elements or helpers they are used by. Is it any way to do this in cakephp? Or have I include all css files into all pages? I prefer to include all css scripts in the head. It has tow advantages: - The includes are made in one place in

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-17 Thread ORCC
Set the name attribute into the CommandParser class (If your are using PHP 4 the name attribute is mandatory as it is in models and controllers). class CommandParserComponent extends Object { var $name = CommandParser; //the rest of the code. }

Re: startpage with different layout

2008-10-15 Thread ORCC
Just set the layout in the first line of your view ?php $this-layout=foo ? and after this line all your presentation code. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-15 Thread ORCC
if(function_exist( $this-{$command}()) ){ For testing the existence of cass methods, you should use method_exists instead. if (method_exists(get_class($this),$command) { //blah blah } With this fix i think that this idea would work too,

Re: How to Handle Special Fields on $this-query() statements - Forking from MySQL Having Clausule

2008-10-14 Thread ORCC
Use Set classs for manipulating your find's results, particularly the Set::combine method maybe helpful for you.. http://book.cakephp.org/view/662/combine --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP

Re: Troubles doing a complex find

2008-10-14 Thread ORCC
AND logical operator is asociative, hence: 'OR' = Array ( 'AND' = Array ( /*put all conditions here*/) ) is equivalent, and here you don't rewrite the Array index. --~--~-~--~~~---~--~~ You received this message because you

Re: Question on the best way to proceed and stay true to MVC/CakePHP philosophy

2008-10-14 Thread ORCC
I think first that all you have to separate the parsing of the text and the execution of the command itself via components, namely: 1) Create a CommandParser component that has function to parse a command. 2) Create a CommandExecutive component that has a method for implement each of the

Access $data content in afterSave callback

2008-10-13 Thread ORCC
I have the following question: I'm saving in the controller with the method: $this-Model-save($this-data); But I don't set $this-Model-data explicitly. How can I access to the data array in the afterSave callback? Can I use $this-data if that array wasn't set explicitly with $this-Model-

Re: Dynamical display contation on default layout.ctp

2008-10-13 Thread ORCC
Use an element. 1) In your UsersController you have a function that returns the count of live users: class UsersController extends AppModel { function getCountLiveUsers() { //perform the calculation return $n; } } 2) Create

Re: MySQL Having Clausule

2008-10-13 Thread ORCC
If you have query with complex conditions, I suggest you to use the query() method directly $users = $this-User-query('YOUR SQL QUERY') --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this

Error when including prototype and scriptaculous in layout template

2008-10-11 Thread ORCC
I have a layout template that includes the prototype and scriptaculous scripts that are placed in webroot/js directory. The template looks like: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html

Re: Documentation - Cakes bad side

2008-10-03 Thread ORCC
The only complain that I found in the API documentation, is that there are not clear explanations about the parameters that a method expects (usually as an array) or class attributes are not explained too. Altought there is the source code; in many cases the source code itself is the best

Re: Add user_id from session to db when adding a product

2008-10-03 Thread ORCC
Just assign the values to the data array $this-data['Product']['user_id'] = $user_id Or put user_id as a hidden field in the form. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this

Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread ORCC
..the comment PERFORM BUSINESS LOGIC should immediately let you think that something is not 100% MVC ..you are performing LOGIC inside a MODEL, and not just model data handling. So, where I have to do the business logic? For example, I have a Product Object, and the product has some taxes

Re: Simple Question

2008-10-03 Thread ORCC
When you post a form, the selected value of a select list is in the data array as any other form field. Hello all, how do I get the selected value from a select drop down box. Basically I want to redirect based on the returned value however I can not figure out how to get the selected

Does calling model methods from elements break MVC pattern?

2008-10-02 Thread ORCC
It is a question about MVC pattern in cakephp. I have a calculated value that I want to display in many views, so I decided to create an element. The business logic has to be performed in the model, i.e: models/product.php class Product extends AppModel { //... all attributes and methods

Re: Database design for local information specific site

2008-10-02 Thread ORCC
I suggest you to: - Create a single table Cities (id,name). For example IdName 1 New York 2 Madrid 3 Roma - Create a single table called Properties (id,city_id, property, value) and place in that table All the properties for each city. For instance: Id City_Id Property Value

Re: Does calling model methods from elements break MVC pattern?

2008-10-02 Thread ORCC
Ok, that means that I would consider to pass parameters to my elements (parameters calculated inside the controller) to avoid a requestAction call, doesn't it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: javascipt onclick in $html-image

2008-09-30 Thread ORCC
Double quotes should work too: 'on_click' = open_win($id); On 30 sep, 10:37, bartez [EMAIL PROTECTED] wrote: Panic over answer is: 'onclick'='open_win('. $id .')' cheers a --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

How to allow all non-administrative route with Auth

2008-09-26 Thread ORCC
I'm using Auth component to manage an admin panel. I use admin route for all function in admin panel. In order to allow all other actions without login, I add them in beforeFilter method. For instance: function beforeFilter() { parent::beforeFilter(); //Controller general initialization

Re: How to update a model with save method?

2008-09-23 Thread ORCC
column and has nothing to do with the actual name. The actual name is stored in the $primaryKey property of the model. On Sep 23, 1:28 am, ORCC [EMAIL PROTECTED] wrote: Thank you for answer. On 23 sep, 00:42, teknoid [EMAIL PROTECTED] wrote: $this-Manufacturer-id = $id; you can also

Re: Wouldn't it be great if cake adds a straight PHP equivalent on it's manual pages e.g redirection

2008-09-23 Thread ORCC
You can issue a header or any php function into the View, but it is not correct from the point of view of the MVC pattern, because it seems that you are putting application logic into the view. --~--~-~--~~~---~--~~ You received this message because you are

How to update a model with save method?

2008-09-22 Thread ORCC
In the blog tutorial, they use the save method both to save or update an existing record. I tried to take that idea for my application and had some trouble: My model is the following, with all default table names (i.e id is the primary key) class Manufacturer extends AppModel { var

Re: How to update a model with save method?

2008-09-22 Thread ORCC
Thank you for answer. On 23 sep, 00:42, teknoid [EMAIL PROTECTED] wrote: $this-Manufacturer-id = $id; you can also save() the data without doing a set() first, i.e. $this- Manufacturer-save($this-data); This doesn't work either in my model-controller given in the previous posts. I can't

How to count associated records in a model?

2008-09-21 Thread ORCC
I have a Manufacturer model having many Products. In order to return the number of Products of a Manufacturer I wrote the following method in Manufacturer: function countProducts() { App::import('Model','Product'); $condition = Array('manufacturer_id' = $this-id) return

Re: using Configure::read in a model definition file

2008-09-21 Thread ORCC
It is a php syntax issue. When you declare a class attribute, its value must be constant, i.e class Foo { var $foo = Array('equalTo' = 'xx', 'name' = yy); //correct, since all array's elements are constant var $bar = Array('equalTo' = Conf::read('Secret')); //Error, since the value

Generate List with SQL calculated Fields

2008-09-21 Thread ORCC
Usually I create lists for using with $form-select(), vía find('list') method. For instance, in the controller method $l = $this-ProductCategory-find('list'); Another way to create the list is by using a plain query: $l = $this-ProductCategory-query('SELECT `id`, `name` FROM product_categories