¿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
?php
class AppModel extends Model {
function beforeValidate() {
foreach ($this-validate as $field) {
foreach ($field as $rule) {
$rule[last] = true;
It seems that your
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
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
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
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' =
- 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
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.
}
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
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,
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
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
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
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-
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
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
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
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
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
..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
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
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
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
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
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
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
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
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
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
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
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
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
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
33 matches
Mail list logo