Re: Ajax validation vs Javascript validation?

2007-12-01 Thread Marcin Jaworski

As long as you really don't need to check values against database I
think it is better to do JS validation. This will be faster and won't
consume resources on your server just to validate simple values
(regexp or if field is required etc). Of course you should also
validate on the server side after submition, but I assume you already
know that (JS can be turned off).

On 1 Gru, 07:16, Action [EMAIL PROTECTED] wrote:
 Quick question:

 I need to validate a form but I don't need to compare any of the
 fields to the database. Is it better to use ajax validation with the
 model or javascript validation? and why?
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Accessing data stored on other server

2007-12-01 Thread Novice Programmer
Hello Chirstopher,

Thanks for your help. This seems quite viable. I have another question. I
want to transfer files from one server to the another. is it possible in
php?

Thanks.


On 12/1/07, Christopher E. Franklin, Sr. [EMAIL PROTECTED]
wrote:


 Well, what I am thinking is this: You know how you can display an
 image on your page from another site?  Why not try that? I know it
 works as long as the folder on the other site is not protected.  If it
 is, and you must get the file through a php page, just put the swf
 source url as the php page as long as the php page sends the headers
 to you as the correct mime type.

 I do this with images all the time to protect them.  img src=http://
 img.othersite.com/getImage.php?id=1 / and in the php page I check
 the referrer and then send the headers: header(Content-type:
 {$sql['mime']});

 On Nov 30, 3:01 pm, Novice Programmer [EMAIL PROTECTED]
 wrote:
  Hello guys,
 
  actually i have stored some SWFs on one web server...but the index page
 of
  the site is not on that server...
  the php page where these swfs will be embedded is on some other server..
  what are the possibilities of using the swfs on other server from this
 one..
  I guess i can't directly accesses files on the other server directly.
 Can
  some one help?
 
  --
  Thanks  Regards,
  Novice (http://ishuonweb.wordpress.com/).
 



-- 
Thanks  Regards,
Novice (http://ishuonweb.wordpress.com/).

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



using render element with request action

2007-12-01 Thread Brady

Ok so I'm not quite sure whats going on and normally I would just dig
around until I found an answer on some site somewhere, but my brain is
tired so I think I'll just try asking. Feel free not to answer :P

Anyway to the problem,

I'm trying to render an element within a view with this code:
  ?php echo $this-renderElement('post_comments', $this-
requestAction('/comments/getComments/'  . $post['Post']['id'])); ?

And my comments controller action looks like this:
   function getComments($postId)
  {
  $this-set('comments', $this-Comment-
findByPostId($postId));
  }

My element then makes use of the $comments variable.

The warning messages I get are as follows:
  Warning: array_merge_recursive() [function.array-merge-recursive]:
Argument #1 is not an array in/home/brady/www/bblog/cake/libs/view/
view.php on line 376

Warning: array_merge() [function.array-merge]: Argument #2 is not an
array in /home/brady/www/bblog/cake/libs/view/view.php on line 377

Warning: extract() [function.extract]: First argument should be an
array in /home/brady/www/bblog/cake/libs/view/view.php on line 596

Thanks!

p.s. I just started to play with cakePHP yesterday.

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Model Constructors

2007-12-01 Thread [EMAIL PROTECTED]

Hi all,

I had a puzzling problem with the 1.2 pre-beta (rev 5875) when I
deployed my site to a PHP 4 server (my local testing  setup is PHP 5).
The problem was a totally blank page - nothing was rendered, even at
the highest debug level.

The fix was adding an empty constructor to my models. Weirdly it works
to add a PHP 5 style __construct() method (I'm guessing that has
something to do with the implementation of Overloadable). Calling
parent::__construct() brings back the blank screen, which is also odd.

These were baked Model classes, and bake doesn't include a
constructor, so I'm guessing this is a bug or a problem with my setup.
I was wondering if anyone had a similar problem or might know the
cause. The server is running PHP 4.4.7 and is also running Zend
Optimizer which may be a problem, I gather.

Thanks,

-dave

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Joyce

I would like to apologize for being a nuisance. It is ok. Your English
is understandable, it is only probably I couldn't get the point, not
really used to using cakePhp, somehow have a sense of being
restricted, which may be the fact that I am not used to it.

Hardcoring can get things pretty straight forward, but it takes time.
Hence, it is kind of a trade off in between.

 If you have all associations set correctly, you can put in the
 ProductsController:

Is there anything that I will need to set in besides this:
$this-set('categories', $this-Product-Category-generateList(null,
null, null,
{n}.Category.id, {n}.Category.catname));

Is it the $hasMany (for Product) and $BelongsTo (Category) under their
model?

If it is these, then I have tried but there is an issue whenever I do
any action to them (add, edit, etc), they will prompt for the table
products_categories error. Do I have to set a table for it, or
otherwise? Below is the output result:

output result

Query: DELETE FROM `categories_products` WHERE cat_id = '7'
Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
line 440

Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
(7,6)
Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
line 440

Warning: Cannot modify header information - headers already sent by
(output started at /home/testdb/cake/basics.php:697) in /home/testdb/
cake/libs/controller/controller.php on line 447

/output result

Thanks for your assistance.


On Dec 1, 8:04 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 Hi, I don't quite get you.

 that's probably because my English sucks! (I'm a Spanish speaker)

  Do you mean something like this if I have a
  products table with fieldname: id, productname, cat_id, and I would
  need a select element under the product, where I will be able to
  select the categories?

  $this-set('categories', $this-Category-generateList(null, null,
  null, {n}.categories.id, {n}.categories.catname));

  Do I put this under the Category Controller or Products Controller?

 If you have all associations set correctly, you can put in the
 ProductsController:

   $this-set('categories',
 $this-Product-Category-generateList(null, null, null,
 {n}.Category.id, {n}.Category.catname));

  Thanks.

 You're welcome.

  On Dec 1, 5:41 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   I you want to use fields from associated tables, use the key/valuePath
   options in Model::generateList(), and set recursive to the apropiate
   value.

   2007/11/30, Dardo Sordi Bogado [EMAIL PROTECTED]:

This is for fields from the same table. I don't understand what you
mean with the aro aco method.

2007/11/30, Joyce [EMAIL PROTECTED]:

 Can this solution for fieldname within same table be used with those
 that are of different tables? Or do I have to use the aro aco method
 for that?

 Thanks.

 On Dec 1, 4:23 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  There are thre ways:

  1. If you are using Model::generateList(), ex:

  // generateList ($conditions, $order, $limit,
  $keyPath=, $valuePath)
  $categories = $this-Category-generateList(null, null, null, null,
  '{n}.Category.catname');

  2. Also you can just set Model::$displayField :

  class Category extends AppModel {
var $name = 'Category';
var $displayField = 'catname';

  }

  Then, it becomes:

  $categories = $this-Category-generateList();

  3. You can rename colmn catname to name (default displayField).

  I think number 2 is best.

  Dardo Sordi.

  2007/11/30, Joyce [EMAIL PROTECTED]:

   Hi all,

   I am a newbie in cakePHP, and I have created a table as per below.

   I have 3 fields for my categories table, and would like tocreatea
   Select form element to insert new categories and link within the 
   table
   itself(where the parent_id comes from the id).

   Such that it will echo the select option in this manner:
   selectoption value=idcatname/option/select, where the 
   values
   of id and catname are populated from the table below.

   categories table:
   id
   catname
   parent_id

   I have tried some of the ways that will google help, but none 
   seems
   successful, in which I could only end up with the id instead of
   catname.

   Please advise. Thanks in advance.

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Re: Am I trying to do the impossible (or impractical)?

2007-12-01 Thread AD7six



On Dec 1, 7:53 am, FrenchEscapes [EMAIL PROTECTED] wrote:
 Well that kind of worked!

 I have put:

 var $hasMany = array(
 'Address' = array('className' = 'Address',
'foreignKey' = 
 'customer_id'
 ),
 );

 var $belongsTo = array(
 'Address' = array('className' = 'Address',
'foreignKey' =
 'default_address_id',
  ),
 );

It's doing it because with the same name the multi dimensional array
of hasMany Addresses is being added to/merged with the result of your
belongsTo Address.

Change the name of one of those aliases (e.g. 'Address' change to
'DefaultAddress').

hth,

AD
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Am I trying to do the impossible (or impractical)?

2007-12-01 Thread AD7six



On Dec 1, 1:37 pm, AD7six [EMAIL PROTECTED] wrote:
 On Dec 1, 7:53 am, FrenchEscapes [EMAIL PROTECTED] wrote:



  Well that kind of worked!

  I have put:

  var $hasMany = array(
  'Address' = array('className' = 'Address',
 'foreignKey' = 
  'customer_id'
  ),
  );

  var $belongsTo = array(
  'Address' = array('className' = 'Address',
 'foreignKey' =
  'default_address_id',
   ),
  );

 It's doing it because with the same name the multi dimensional array
 of hasMany Addresses is being added to/merged with the result of your
 belongsTo Address.

 Change the name of one of those aliases (e.g. 'Address' change to
 'DefaultAddress').

 hth,

 AD

Although you'd be better of following Rhee's suggestion imo.

AD
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Constructors

2007-12-01 Thread AD7six



On Dec 1, 1:02 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 Hi all,

 I had a puzzling problem with the 1.2 pre-beta (rev 5875) when I
 deployed my site to a PHP 4 server (my local testing  setup is PHP 5).
 The problem was a totally blank page - nothing was rendered, even at
 the highest debug level.

 The fix was adding an empty constructor to my models. Weirdly it works
 to add a PHP 5 style __construct() method (I'm guessing that has
 something to do with the implementation of Overloadable). Calling
 parent::__construct() brings back the blank screen, which is also odd.

 These were baked Model classes, and bake doesn't include a
 constructor, so I'm guessing this is a bug or a problem with my setup.
 I was wondering if anyone had a similar problem or might know the
 cause. The server is running PHP 4.4.7 and is also running Zend
 Optimizer which may be a problem, I gather.

 Thanks,

 -dave

You don't need to add a constructor, and doing so is risky business.
Particularly as adding one and not calling the parent (with the passed
params, the model constructor has some parameters which you are
removing) basically means you are disabling all of cake's model work
and have about 0% chance of your models being of use.

It's probably the zend optimizer problem, check the group for
solutions (hint find the __ method), I'd bet it turns out to be
missing/misnamed file/class/method.

hth,

AD
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



turn debugging on for a single controller

2007-12-01 Thread cakeFreak

Hey guys,

is there a way to turn debugging on for a single controller and not
application wide?

Or should I use the test suite for this purpose?

Cheers

Dan
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bake function, Fatal Error, Call to undefined function mysql_connect()...

2007-12-01 Thread AD7six



On Nov 30, 3:15 pm, lynch [EMAIL PROTECTED] wrote:
  Are you suggesting that the problems you are having installing/
  configuring php cli are somehow cake's fault?

 Of course not, its my wrong configured/installed php (so its my
 fault :) ), but i was so keen on working with acl and now i still
 working  on cli.
 ok... i keep on invastigating...

Why not just run the sql from the config/sql folder, pass go,
collection $200,  skip using it via command line, and start using acl?

hth,

AD
BTW please do not create two threads for the same problem, and if you /
do/ it'd be helpful if you didn't keep them both alive.
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Am I trying to do the impossible (or impractical)?

2007-12-01 Thread J.B.

As I said in my first post: just remember to name the associations
different names ...
I prefer this method over Rhee's suggestion with a bool for the
default address in the database... I think it looks nicer and feel
more OO :)

On Dec 1, 1:37 pm, AD7six [EMAIL PROTECTED] wrote:
 On Dec 1, 7:53 am, FrenchEscapes [EMAIL PROTECTED] wrote:



  Well that kind of worked!

  I have put:

  var $hasMany = array(
  'Address' = array('className' = 'Address',
 'foreignKey' = 
  'customer_id'
  ),
  );

  var $belongsTo = array(
  'Address' = array('className' = 'Address',
 'foreignKey' =
  'default_address_id',
   ),
  );

 It's doing it because with the same name the multi dimensional array
 of hasMany Addresses is being added to/merged with the result of your
 belongsTo Address.

 Change the name of one of those aliases (e.g. 'Address' change to
 'DefaultAddress').

 hth,

 AD

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bake function, Fatal Error, Call to undefined function mysql_connect()...

2007-12-01 Thread lynch

I already toke the sql from the config/sql folder and after this i
took the sql from the Simon JAILLET Tutorial.
But i have to run the init_acl_controller.php to fill this tables with
first content or not? Maybe i use the wrong command.
How did you initilize the init_acl_controller.php?
Or got i something basic totaly wrong?
Thank you for your patience.


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: bake function, Fatal Error, Call to undefined function mysql_connect()...

2007-12-01 Thread AD7six



On Dec 1, 2:53 pm, lynch [EMAIL PROTECTED] wrote:
 I already toke the sql from the config/sql folder and after this i
 took the sql from the Simon JAILLET Tutorial.
 But i have to run the init_acl_controller.php to fill this tables with
 first content or not? Maybe i use the wrong command.
 How did you initilize the init_acl_controller.php?
 Or got i something basic totaly wrong?
 Thank you for your patience.

I don't know what the init_aco_controller does, but as it's a
controller, running it I would assume involves opening a browser and
going to the url /init_acl/ and doesn't involve any console
activities. Have a re-read of the tutorial you are following (or a
step back and rethink).

hth,

AD
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Am I trying to do the impossible (or impractical)?

2007-12-01 Thread FrenchEscapes

Sorry to be a stick in the mud, but have changed the name (seems
obvious now!!) of the second association to DefaultAddress and that
works so it will be staying as is for now. No doubt it will all change
before too long and will try the other way.

Thanks to all for your help,

Duncan
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Update gone wrong.

2007-12-01 Thread Mech7

Hey i updated today to the latest nightly now.. and now indeed this
code is not in bootstrap anymore, and now it finally works again :D

Thanks for the help :)



On Dec 1, 3:12 am, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Nov 30, 2007 9:10 PM, Chris Hartjes [EMAIL PROTECTED] wrote:

  On Nov 30, 2007 7:33 PM, Mech7 [EMAIL PROTECTED] wrote:
   It still does not work.. it can't read the cache configuration.. even
   though all it is supposed to do is throw up an error and revert to
   default file caching..

  Hrm, you have provided me with a clue here.

  I do not have the Configure::write('Cache.disable', true) command in
  *my* config.php.  So that trigger_error() statement in bootstrap will
  never show up.

 I just checked and it is in cake/app/config/core.php, but I don't use
 that file at all.  My own config/core.php file that is the app
 directory for my project doesn't have that line in it at all.

 Interesting...

 --
 Chris Hartjes

 My motto for 2007:  Just build it, damnit!

 @TheKeyboard -http://www.littlehart.net/atthekeyboard
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Dardo Sordi Bogado

2007/12/1, Joyce [EMAIL PROTECTED]:

Hi,

 I would like to apologize for being a nuisance. It is ok. Your English
 is understandable, it is only probably I couldn't get the point, not
 really used to using cakePhp, somehow have a sense of being
 restricted, which may be the fact that I am not used to it.
yes, I felt like that in the beginning, now I love CakePHP.


 Hardcoring can get things pretty straight forward, but it takes time.
 Hence, it is kind of a trade off in between.

  If you have all associations set correctly, you can put in the
  ProductsController:

 Is there anything that I will need to set in besides this:
 $this-set('categories', $this-Product-Category-generateList(null,
 null, null,
 {n}.Category.id, {n}.Category.catname));

 Is it the $hasMany (for Product) and $BelongsTo (Category) under their
 model?

 If it is these, then I have tried but there is an issue whenever I do
 any action to them (add, edit, etc), they will prompt for the table
 products_categories error. Do I have to set a table for it, or
 otherwise? Below is the output result:

 output result

 Query: DELETE FROM `categories_products` WHERE cat_id = '7'
 Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
 exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
 line 440

 Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
 (7,6)
 Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
 exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
 line 440

 Warning: Cannot modify header information - headers already sent by
 (output started at /home/testdb/cake/basics.php:697) in /home/testdb/
 cake/libs/controller/controller.php on line 447

 /output result


Seems like you have wrong your associations. Can you post the source
code from both models and the tables definitions (just ASCII, no SQL
please)?

And maybe have a look at :

* http://manual.cakephp.org/chapter/models
* http://tempdocs.cakephp.org/#TOC78831
* http://bennerweb.com/node/16 (Understanding CakePHP Associations)

HTH.

 Thanks for your assistance.

You're welcome.

- Dardo Sordi.

P/D: What I love more about CakePHP is this group, ( and the bake script :P )


 On Dec 1, 8:04 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  Hi, I don't quite get you.
 
  that's probably because my English sucks! (I'm a Spanish speaker)
 
   Do you mean something like this if I have a
   products table with fieldname: id, productname, cat_id, and I would
   need a select element under the product, where I will be able to
   select the categories?
 
   $this-set('categories', $this-Category-generateList(null, null,
   null, {n}.categories.id, {n}.categories.catname));
 
   Do I put this under the Category Controller or Products Controller?
 
  If you have all associations set correctly, you can put in the
  ProductsController:
 
$this-set('categories',
  $this-Product-Category-generateList(null, null, null,
  {n}.Category.id, {n}.Category.catname));
 
   Thanks.
 
  You're welcome.
 
   On Dec 1, 5:41 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
I you want to use fields from associated tables, use the key/valuePath
options in Model::generateList(), and set recursive to the apropiate
value.
 
2007/11/30, Dardo Sordi Bogado [EMAIL PROTECTED]:
 
 This is for fields from the same table. I don't understand what you
 mean with the aro aco method.
 
 2007/11/30, Joyce [EMAIL PROTECTED]:
 
  Can this solution for fieldname within same table be used with those
  that are of different tables? Or do I have to use the aro aco method
  for that?
 
  Thanks.
 
  On Dec 1, 4:23 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   There are thre ways:
 
   1. If you are using Model::generateList(), ex:
 
   // generateList ($conditions, $order, $limit,
   $keyPath=, $valuePath)
   $categories = $this-Category-generateList(null, null, null, 
   null,
   '{n}.Category.catname');
 
   2. Also you can just set Model::$displayField :
 
   class Category extends AppModel {
 var $name = 'Category';
 var $displayField = 'catname';
 
   }
 
   Then, it becomes:
 
   $categories = $this-Category-generateList();
 
   3. You can rename colmn catname to name (default displayField).
 
   I think number 2 is best.
 
   Dardo Sordi.
 
   2007/11/30, Joyce [EMAIL PROTECTED]:
 
Hi all,
 
I am a newbie in cakePHP, and I have created a table as per 
below.
 
I have 3 fields for my categories table, and would like 
tocreatea
Select form element to insert new categories and link within 
the table
itself(where the parent_id comes from the id).
 
Such that it will echo the select option in this manner:
selectoption value=idcatname/option/select, where the 
values
of id and catname are populated 

Re: turn debugging on for a single controller

2007-12-01 Thread Dardo Sordi Bogado

Yes.

(CakePHP 1.2) In the beforeFilter() of that controller, put
Configure::write('debug', 1);

(CakePHP 1.1) I don't use it, but I think you can put something in
app/config/bootstrap.php and check the url against a regexp and do the
define() according to the controller.

HTH,

- Dardo Sordi.

2007/12/1, cakeFreak [EMAIL PROTECTED]:

 Hey guys,

 is there a way to turn debugging on for a single controller and not
 application wide?

 Or should I use the test suite for this purpose?

 Cheers

 Dan
 


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: using render element with request action

2007-12-01 Thread Dardo Sordi Bogado

http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

2007/12/1, Brady [EMAIL PROTECTED]:

 Ok so I'm not quite sure whats going on and normally I would just dig
 around until I found an answer on some site somewhere, but my brain is
 tired so I think I'll just try asking. Feel free not to answer :P

 Anyway to the problem,

 I'm trying to render an element within a view with this code:
   ?php echo $this-renderElement('post_comments', $this-
 requestAction('/comments/getComments/'  . $post['Post']['id'])); ?

 And my comments controller action looks like this:
function getComments($postId)
   {
   $this-set('comments', $this-Comment-
 findByPostId($postId));
   }

 My element then makes use of the $comments variable.

 The warning messages I get are as follows:
   Warning: array_merge_recursive() [function.array-merge-recursive]:
 Argument #1 is not an array in/home/brady/www/bblog/cake/libs/view/
 view.php on line 376

 Warning: array_merge() [function.array-merge]: Argument #2 is not an
 array in /home/brady/www/bblog/cake/libs/view/view.php on line 377

 Warning: extract() [function.extract]: First argument should be an
 array in /home/brady/www/bblog/cake/libs/view/view.php on line 596

 Thanks!

 p.s. I just started to play with cakePHP yesterday.

 


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Setting Cookie path prevents cookie from being set

2007-12-01 Thread Richard

If I try either of the following:

// beforeFilter()
$this-Cookie-path = 'localhost';
or:
var $cookieDomain = 'localhost';

The cookie is not set.

I have to remove any reference to setting the cookie path for the
Cookie component to work. Is this a bug? Or an issue with my
development environment?

Many 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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Replace for VALID_NOT_EMPTY?

2007-12-01 Thread Dardo Sordi Bogado

I'm using this:

'nonEmpty' = array(
   'rule' = VALID_NOT_EMPTY
   'required' = true,
   'allowEmpty' = false,
   'message' = 'You must to put something.'
   )

2007/11/18, mbavio [EMAIL PROTECTED]:

 Hi, I was told that VALID_NOT_EMPTY is deprecated and in orden to
 achive this kind of validation, you have to use:

 'nonEmpty' = array(
 'rule' = null
 'required' = true,
 'allowEmpty' = false,
 'message' = 'You must to put something.'
 )

 But it´s not working. I´ve managed to solve the problem changing the
 rule...

 'rule' = array('minLength', '1'),

 But it doesnt seem like the official solution. Somebody with the same
 problem?

 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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Input field read only

2007-12-01 Thread rvntone

function input($fieldName, $htmlAttributes = array(), $return =
false)

function inputTag($tagName, $size = 20, $htmlOptions = null)

you are using the wrong function or the wrong parameters order

$thtml-input('Employee/start_date', array('size' = '40', 'READONLY'
= 'readonly'));

or

$thtml-inputtag('Employee/start_date',40 , array('READONLY' =
'readonly'));

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Setting Cookie path prevents cookie from being set

2007-12-01 Thread Richard

..sorry that was suppose to read: setting cookie domain prevents
cookie from being set. The below will prevent a cookie from being set:

// beforeFilter()
$this-Cookie-domain = 'localhost';
or:
var $cookieDomain = 'localhost';

On Dec 1, 8:51 pm, Richard [EMAIL PROTECTED] wrote:
 If I try either of the following:

 // beforeFilter()
 $this-Cookie-path = 'localhost';
 or:
 var $cookieDomain = 'localhost';

 The cookie is not set.

 I have to remove any reference to setting the cookie path for the
 Cookie component to work. Is this a bug? Or an issue with my
 development environment?

 Many 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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Input field read only

2007-12-01 Thread rvntone

Use a input not a inputtag

On Nov 30, 1:30 pm, Brian [EMAIL PROTECTED] wrote:
 How do I get an input field to be readonly?

 I have tried
  ?php echo $html-inputTag('Employee/start_date', array('size' = '4
 0', 'READONLY' = 'readonly')) ?
 and
  ?php echo $html-inputTag('Employee/start_date', array('size' = '4
 0', 'disabled' = 'true')) ?

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Joyce

Hi,

Here's my Category model:

code
?php
class Category extends AppModel {

var $name = 'Category';
var $displayField = 'cat_name';
var $validate = array(
'catList' = VALID_NOT_EMPTY,
'id' = VALID_NOT_EMPTY,
'cat_name' = VALID_NOT_EMPTY,
);
var $hasMany = array ('Product' = array(
'className' = 'Product',
'conditions'= '',
'order'= '',
'foreignKey'='cat_id')
);

}
?
/code

Product Model:
code
?php
class Product extends AppModel {

var $name = 'Product';

var $hasAndBelongsToMany = array ('Category' = array(
'className' = 'Category',
'conditions'= '',
'order'= '',
'foreignKey'='cat_id')
);
}
?
/code

ASCII code? Do you mean this?

Categories:
++-+--+-+-++
| Field  | Type| Null | Key | Default | Extra  |
++-+--+-+-++
| id   | int(5)  |  | PRI | NULL|
auto_increment |
| cat_name   | varchar(50)  |  | | ||
| cat_parent  | int(5)  |  | | 0
||
++-+--+-+-++

Products:
+--+--+--+-+-++
| Field| Type | Null | Key | Default | Extra  |
+--+--+--+-+-++
| id  | int(20)  |  | PRI | NULL|
auto_increment |
| cat_id| int(5)   |  | | 0   |
|
| productname  | varchar(100) |  | | |
|
+--+--+--+-+-++

Thanks.



On Dec 1, 11:36 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
 2007/12/1, Joyce [EMAIL PROTECTED]:

 Hi,

  I would like to apologize for being a nuisance. It is ok. Your English
  is understandable, it is only probably I couldn't get the point, not
  really used to using cakePhp, somehow have a sense of being
  restricted, which may be the fact that I am not used to it.

 yes, I felt like that in the beginning, now I love CakePHP.



  Hardcoring can get things pretty straight forward, but it takes time.
  Hence, it is kind of a trade off in between.

   If you have all associations set correctly, you can put in the
   ProductsController:

  Is there anything that I will need to set in besides this:
  $this-set('categories', $this-Product-Category-generateList(null,
  null, null,
  {n}.Category.id, {n}.Category.catname));

  Is it the $hasMany (for Product) and $BelongsTo (Category) under their
  model?

  If it is these, then I have tried but there is an issue whenever I do
  any action to them (add, edit, etc), they will prompt for the table
  products_categories error. Do I have to set a table for it, or
  otherwise? Below is the output result:

  output result

  Query: DELETE FROM `categories_products` WHERE cat_id = '7'
  Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
  exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
  line 440

  Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
  (7,6)
  Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
  exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
  line 440

  Warning: Cannot modify header information - headers already sent by
  (output started at /home/testdb/cake/basics.php:697) in /home/testdb/
  cake/libs/controller/controller.php on line 447

  /output result

 Seems like you have wrong your associations. Can you post the source
 code from both models and the tables definitions (just ASCII, no SQL
 please)?

 And maybe have a look at :

 *http://manual.cakephp.org/chapter/models
 *http://tempdocs.cakephp.org/#TOC78831
 *http://bennerweb.com/node/16(Understanding CakePHP Associations)

 HTH.

  Thanks for your assistance.

 You're welcome.

 - Dardo Sordi.

 P/D: What I love more about CakePHP is this group, ( and the bake script :P )



  On Dec 1, 8:04 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   Hi, I don't quite get you.

   that's probably because my English sucks! (I'm a Spanish speaker)

Do you mean something like this if I have a
products table with fieldname: id, productname, cat_id, and I would
need a select element under the product, where I will be able to
select the categories?

$this-set('categories', $this-Category-generateList(null, null,
null, {n}.categories.id, {n}.categories.catname));

Do I put this under the Category Controller or Products Controller?

   If you have all associations set correctly, you can put in the
   ProductsController:

 $this-set('categories',
   $this-Product-Category-generateList(null, null, null,
   {n}.Category.id, {n}.Category.catname));

Thanks.

   You're 

Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Dardo Sordi Bogado

 Hi,

Hi,

 Here's my Category model:

 code
 ?php
 class Category extends AppModel {

 var $name = 'Category';
 var $displayField = 'cat_name';
 var $validate = array(
 'catList' = VALID_NOT_EMPTY,
 'id' = VALID_NOT_EMPTY,
 'cat_name' = VALID_NOT_EMPTY,
 );
 var $hasMany = array ('Product' = array(
 'className' = 'Product',
 'conditions'= '',
 'order'= '',
 'foreignKey'='cat_id')
 );

 }
 ?
 /code

The Category model is fine.

 Product Model:
 code
 ?php
 class Product extends AppModel {

 var $name = 'Product';

 var $hasAndBelongsToMany = array ('Category' = array(
 'className' = 'Category',
 'conditions'= '',
 'order'= '',
 'foreignKey'='cat_id')
 );
 }
 ?
 /code

The Product model is wrong.

It should be:

?php
class Product extends AppModel {

var $name = 'Product';

var $belongsTo = array ('Category' = array(
'className' = 'Category',
'foreignKey'='cat_id')
);
}
?

The association is wrong, it should be Product belongsTo Category. Fix
it, and try.

 ASCII code? Do you mean this?

 Categories:
 ++-+--+-+-++
 | Field  | Type| Null | Key | Default | Extra  |
 ++-+--+-+-++
 | id   | int(5)  |  | PRI | NULL|
 auto_increment |
 | cat_name   | varchar(50)  |  | | ||
 | cat_parent  | int(5)  |  | | 0
 ||
 ++-+--+-+-++

 Products:
 +--+--+--+-+-++
 | Field| Type | Null | Key | Default | Extra  |
 +--+--+--+-+-++
 | id  | int(20)  |  | PRI | NULL|
 auto_increment |
 | cat_id| int(5)   |  | | 0   |
 |
 | productname  | varchar(100) |  | | |
 |
 +--+--+--+-+-++

I would prefer something like:

Category:
 id
auto_increment
cat_name
cat_parent

Products:
id
auto_increment
cat_id   // make this category_id and you would
haven't to configure it.
productname


 Thanks.

You are welcome.

And please, read the manual and take pay attention to conventions!



 On Dec 1, 11:36 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  2007/12/1, Joyce [EMAIL PROTECTED]:
 
  Hi,
 
   I would like to apologize for being a nuisance. It is ok. Your English
   is understandable, it is only probably I couldn't get the point, not
   really used to using cakePhp, somehow have a sense of being
   restricted, which may be the fact that I am not used to it.
 
  yes, I felt like that in the beginning, now I love CakePHP.
 
 
 
   Hardcoring can get things pretty straight forward, but it takes time.
   Hence, it is kind of a trade off in between.
 
If you have all associations set correctly, you can put in the
ProductsController:
 
   Is there anything that I will need to set in besides this:
   $this-set('categories', $this-Product-Category-generateList(null,
   null, null,
   {n}.Category.id, {n}.Category.catname));
 
   Is it the $hasMany (for Product) and $BelongsTo (Category) under their
   model?
 
   If it is these, then I have tried but there is an issue whenever I do
   any action to them (add, edit, etc), they will prompt for the table
   products_categories error. Do I have to set a table for it, or
   otherwise? Below is the output result:
 
   output result
 
   Query: DELETE FROM `categories_products` WHERE cat_id = '7'
   Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
   exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
   line 440
 
   Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
   (7,6)
   Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
   exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
   line 440
 
   Warning: Cannot modify header information - headers already sent by
   (output started at /home/testdb/cake/basics.php:697) in /home/testdb/
   cake/libs/controller/controller.php on line 447
 
   /output result
 
  Seems like you have wrong your associations. Can you post the source
  code from both models and the tables definitions (just ASCII, no SQL
  please)?
 
  And maybe have a look at :
 
  *http://manual.cakephp.org/chapter/models
  *http://tempdocs.cakephp.org/#TOC78831
  *http://bennerweb.com/node/16(Understanding CakePHP Associations)
 
  HTH.
 
   Thanks for your assistance.
 
  You're welcome.
 
  - Dardo Sordi.
 
  P/D: What I love more about CakePHP is this group, ( and the bake script :P 
  )
 
 
 
   On Dec 1, 8:04 am, Dardo 

Can't read cookie

2007-12-01 Thread Buzzholio

I start with the following code:

var $cookieName = 'MyCookie';
var $cookieKey = 'has82js737hak2';

function __construct()
{
parent::__construct();
$this-cookieDomain = '.'.$_SERVER['SERVER_NAME'];
}

Then I use it as follows:

$this-Cookie-write('page', $ptr, false);
$ptr=$this-Cookie-read('page');

It always returns NULL. What am I doing wrong?
P.S. I searched the archives and could not find a solution that
worked.


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Joyce

What does it mean by Fatal error: Call to a member function on a non-
object?


On Dec 2, 2:17 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  Hi,

 Hi,



  Here's my Category model:

  code
  ?php
  class Category extends AppModel {

  var $name = 'Category';
  var $displayField = 'cat_name';
  var $validate = array(
  'catList' = VALID_NOT_EMPTY,
  'id' = VALID_NOT_EMPTY,
  'cat_name' = VALID_NOT_EMPTY,
  );
  var $hasMany = array ('Product' = array(
  'className' = 'Product',
  'conditions'= '',
  'order'= '',
  'foreignKey'='cat_id')
  );

  }
  ?
  /code

 The Category model is fine.



  Product Model:
  code
  ?php
  class Product extends AppModel {

  var $name = 'Product';

  var $hasAndBelongsToMany = array ('Category' = array(
  'className' = 'Category',
  'conditions'= '',
  'order'= '',
  'foreignKey'='cat_id')
  );
  }
  ?
  /code

 The Product model is wrong.

 It should be:

 ?php
 class Product extends AppModel {

 var $name = 'Product';

 var $belongsTo = array ('Category' = array(
 'className' = 'Category',
 'foreignKey'='cat_id')
 );}

 ?

 The association is wrong, it should be Product belongsTo Category. Fix
 it, and try.



  ASCII code? Do you mean this?

  Categories:
  ++-+--+-+-++
  | Field  | Type| Null | Key | Default | Extra  |
  ++-+--+-+-++
  | id   | int(5)  |  | PRI | NULL|
  auto_increment |
  | cat_name   | varchar(50)  |  | | ||
  | cat_parent  | int(5)  |  | | 0
  ||
  ++-+--+-+-++

  Products:
  +--+--+--+-+-++
  | Field| Type | Null | Key | Default | Extra  |
  +--+--+--+-+-++
  | id  | int(20)  |  | PRI | NULL|
  auto_increment |
  | cat_id| int(5)   |  | | 0   |
  |
  | productname  | varchar(100) |  | | |
  |
  +--+--+--+-+-++

 I would prefer something like:

 Category:
  id
 auto_increment
 cat_name
 cat_parent

 Products:
 id
 auto_increment
 cat_id   // make this category_id and you would
 haven't to configure it.
 productname

  Thanks.

 You are welcome.

 And please, read the manual and take pay attention to conventions!



  On Dec 1, 11:36 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   2007/12/1, Joyce [EMAIL PROTECTED]:

   Hi,

I would like to apologize for being a nuisance. It is ok. Your English
is understandable, it is only probably I couldn't get the point, not
really used to using cakePhp, somehow have a sense of being
restricted, which may be the fact that I am not used to it.

   yes, I felt like that in the beginning, now I love CakePHP.

Hardcoring can get things pretty straight forward, but it takes time.
Hence, it is kind of a trade off in between.

 If you have all associations set correctly, you can put in the
 ProductsController:

Is there anything that I will need to set in besides this:
$this-set('categories', $this-Product-Category-generateList(null,
null, null,
{n}.Category.id, {n}.Category.catname));

Is it the $hasMany (for Product) and $BelongsTo (Category) under their
model?

If it is these, then I have tried but there is an issue whenever I do
any action to them (add, edit, etc), they will prompt for the table
products_categories error. Do I have to set a table for it, or
otherwise? Below is the output result:

output result

Query: DELETE FROM `categories_products` WHERE cat_id = '7'
Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
line 440

Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
(7,6)
Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
line 440

Warning: Cannot modify header information - headers already sent by
(output started at /home/testdb/cake/basics.php:697) in /home/testdb/
cake/libs/controller/controller.php on line 447

/output result

   Seems like you have wrong your associations. Can you post the source
   code from both models and the tables definitions (just ASCII, no SQL
   please)?

   And maybe have a look at :

   *http://manual.cakephp.org/chapter/models
   *http://tempdocs.cakephp.org/#TOC78831
   

dbdesigner2cake version 1.0.4 released - minor change

2007-12-01 Thread Dérico Filho

Hello All,

A minor change in dbdesigner2cake is available. If you are comfortable
with current release, there is no need of upgrade.

A new parameter is now available:

--core DIRECTORY uses CakePHP core files in the given
directory

This parameter should be used when CakePHP core files are located in
some non-standard directory.

Well, as I usually finish such release notes:

You are welcome to download the 1.0.4 version at
http://www.cirello.org/dbdesigner2cake/download.html

Bye


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to INNER Join in Model ?

2007-12-01 Thread foxmask

gooed evening
any idea about inner join ?

On Nov 29, 12:39 pm, foxmask [EMAIL PROTECTED] wrote:
 Hi i'd like to know what i need to do and in what model, to be able to
 use this SQL query

 SELECT t.id, t.subject FROM topics AS t INNER JOIN forums AS f ON
 f.id=t.forum_id LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND
 fp.group_id='xxx') WHERE (fp.read_forum IS NULL OR fp.read_forum=1)
 AND t.moved_to IS NULL  ORDER BY t.last_post DESC LIMIT 10

 actually this SQL Query :
 SELECT `Post`.`id`, `Post`.`poster`, `Post`.`poster_id`,
 `Post`.`poster_ip`, `Post`.`poster_email`, `Post`.`message`,
 `Post`.`hide_smilies`, `Post`.`posted`, `Post`.`edited`,
 `Post`.`edited_by`, `Post`.`topic_id`, `Topic`.`id`, `Topic`.`poster`,
 `Topic`.`subject`, `Topic`.`posted`, `Topic`.`last_post`,
 `Topic`.`last_post_id`, `Topic`.`last_poster`, `Topic`.`num_views`,
 `Topic`.`num_replies`, `Topic`.`closed`, `Topic`.`sticky`,
 `Topic`.`moved_to`, `Topic`.`forum_id` FROM `posts` AS `Post` LEFT
 JOIN `topics` AS `Topic` ON (`Post`.`topic_id` = `Topic`.`id`) WHERE 1
 = 1 ORDER BY `last_post` desc LIMIT 10

 is produce when i do in my element :

 $pt_active_topics = $this-requestAction('posts/index/sort:last_post/
 direction:desc/limit:10');

 here are my models :

 ?php
 class Post extends AppModel {

 var $name = 'Post';

 //The Associations below have been created with all possible keys,
 those that are not needed can be removed
 var $belongsTo = array(
 'Topic' = array('className' = 'Topic',
 'foreignKey' 
 = 'topic_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = '',
 
 'counterCache' = ''),
 );

 }

 ?php
 class Topic extends AppModel {

 var $name = 'Topic';

 //The Associations below have been created with all possible keys,
 those that are not needed can be removed
 var $belongsTo = array(
 'Forum' = array('className' = 'Forum',
 'foreignKey' 
 = 'forum_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = '',
 
 'counterCache' = ''),
 );

 var $hasMany = array(
 'Post' = array('className' = 'Post',
 'foreignKey' 
 = 'topic_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = '',
 'dependent' 
 = ''),
 );

 }

 ?php
 class Forum extends AppModel {

 var $name = 'Forum';

 //The Associations below have been created with all possible keys,
 those that are not needed can be removed
 var $hasMany = array(
 'ForumPerm' = array('className' = 'ForumPerm',
 'foreignKey' 
 = 'forum_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = '',
 'limit' = '',
 'offset' = 
 '',
 'dependent' 
 = '',
 'exclusive' 
 = '',
 'finderQuery' 
 = '',
 
 'counterQuery' = ''),
 'Topic' = array('className' = 'Topic',
 'foreignKey' 
 = 'forum_id',
 'conditions' 
 = '',
 'fields' = 
 '',
 'order' = '',
 'limit' = '',
 'offset' = 
 '',
  

Re: Save doesn't work with Postgres

2007-12-01 Thread Adrian Maier

On Nov 30, 2007 12:01 PM, Rhee [EMAIL PROTECTED] wrote:

 No one has ever this problem?


 On Nov 29, 12:17 pm, Rhee [EMAIL PROTECTED] wrote:
  Does anybody have problem to use Save function with Postgres?
  Everytime I call $this-Model-save($this-data) I get the following
  notice messages (repeated 4 times):
 
  Notice: Undefined index: name in /var/www/htdocs/sid/cake/libs/model/
  dbo/dbo_postgres.php on line 350
 
  and then:
  Warning: Cannot modify header information - headers already sent by
  (output started at /var/www/htdocs/sid/cake/libs/model/dbo/
  dbo_postgres.php:350) in /var/www/htdocs/sid/cake/libs/controller/
  controller.php on line 447
 
  Basically the data were saved into database.
 
  It works well at production level. I believe in this level all notices
  and warnings were suppressed, so it looks like to work perfectly.
  Right now, to avoid the notices I use $this-Model-execute($sql);
  where $sql is an SQL INSERT INTO or UPDATE statement.
 
  I still use Cake v 0.2.9.4409. The same version works well with MySQL.
 
  Any idea to resolve this, except with execute() or maybe upgrade Cake?

Hello,

I've encountered the same error when using a PostgreSQL database.  It's a
bug that has been very recently solved .

Instead of upgrading, i've simply duplicated the fix on the version of cakephp
i was using . The fix is a trivial one:   open the dbo_postgres.php  ,
go to line 350
and modify this if statement :

 if (strcasecmp($sourceinfo['name'], $field) == 0) {
break;
 }

to this :

 if (  isset($sourceinfo['name']) 
strcasecmp($sourceinfo['name'], $field) == 0)   {
break;
 }

You could also try to upgrade to a newer cake , but i'm not sure which
is the first version
that includes this particular bug fix.


Cheers,
Adrian Maier

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: dbdesigner2cake version 1.0.4 released - minor change

2007-12-01 Thread powtac

What can I do with this??? Any tutorials? Im using dbdesigner...
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: dbdesigner2cake version 1.0.4 released - minor change

2007-12-01 Thread powtac

Found it:

1. DBDesigner 4 Scaffold Tools for CakePHP, or simply dbdesigner2cake,
is a tool which parses fabFORCE's DBDesigner 4 XML file into CakePHP
models and controllers files. It aims to simplify the first two steps
in any system development, modelling and model coding.

2. http://blog.cirello.org/2007/09/12/preliminary-tutorial-for-dbdesigner2cake/

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How To Create Select Options for Fields Within Same Table

2007-12-01 Thread Dardo Sordi Bogado

It means that you are calling a member function of something that *is
not* an object.

2007/12/1, Joyce [EMAIL PROTECTED]:

 What does it mean by Fatal error: Call to a member function on a non-
 object?


 On Dec 2, 2:17 am, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
   Hi,
 
  Hi,
 
 
 
   Here's my Category model:
 
   code
   ?php
   class Category extends AppModel {
 
   var $name = 'Category';
   var $displayField = 'cat_name';
   var $validate = array(
   'catList' = VALID_NOT_EMPTY,
   'id' = VALID_NOT_EMPTY,
   'cat_name' = VALID_NOT_EMPTY,
   );
   var $hasMany = array ('Product' = array(
   'className' = 'Product',
   'conditions'= '',
   'order'= '',
   'foreignKey'='cat_id')
   );
 
   }
   ?
   /code
 
  The Category model is fine.
 
 
 
   Product Model:
   code
   ?php
   class Product extends AppModel {
 
   var $name = 'Product';
 
   var $hasAndBelongsToMany = array ('Category' = array(
   'className' = 'Category',
   'conditions'= '',
   'order'= '',
   'foreignKey'='cat_id')
   );
   }
   ?
   /code
 
  The Product model is wrong.
 
  It should be:
 
  ?php
  class Product extends AppModel {
 
  var $name = 'Product';
 
  var $belongsTo = array ('Category' = array(
  'className' = 'Category',
  'foreignKey'='cat_id')
  );}
 
  ?
 
  The association is wrong, it should be Product belongsTo Category. Fix
  it, and try.
 
 
 
   ASCII code? Do you mean this?
 
   Categories:
   ++-+--+-+-++
   | Field  | Type| Null | Key | Default | Extra  |
   ++-+--+-+-++
   | id   | int(5)  |  | PRI | NULL|
   auto_increment |
   | cat_name   | varchar(50)  |  | | ||
   | cat_parent  | int(5)  |  | | 0
   ||
   ++-+--+-+-++
 
   Products:
   +--+--+--+-+-++
   | Field| Type | Null | Key | Default | Extra  |
   +--+--+--+-+-++
   | id  | int(20)  |  | PRI | NULL|
   auto_increment |
   | cat_id| int(5)   |  | | 0   |
   |
   | productname  | varchar(100) |  | | |
   |
   +--+--+--+-+-++
 
  I would prefer something like:
 
  Category:
   id
  auto_increment
  cat_name
  cat_parent
 
  Products:
  id
  auto_increment
  cat_id   // make this category_id and you would
  haven't to configure it.
  productname
 
   Thanks.
 
  You are welcome.
 
  And please, read the manual and take pay attention to conventions!
 
 
 
   On Dec 1, 11:36 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
2007/12/1, Joyce [EMAIL PROTECTED]:
 
Hi,
 
 I would like to apologize for being a nuisance. It is ok. Your English
 is understandable, it is only probably I couldn't get the point, not
 really used to using cakePhp, somehow have a sense of being
 restricted, which may be the fact that I am not used to it.
 
yes, I felt like that in the beginning, now I love CakePHP.
 
 Hardcoring can get things pretty straight forward, but it takes time.
 Hence, it is kind of a trade off in between.
 
  If you have all associations set correctly, you can put in the
  ProductsController:
 
 Is there anything that I will need to set in besides this:
 $this-set('categories', $this-Product-Category-generateList(null,
 null, null,
 {n}.Category.id, {n}.Category.catname));
 
 Is it the $hasMany (for Product) and $BelongsTo (Category) under their
 model?
 
 If it is these, then I have tried but there is an issue whenever I do
 any action to them (add, edit, etc), they will prompt for the table
 products_categories error. Do I have to set a table for it, or
 otherwise? Below is the output result:
 
 output result
 
 Query: DELETE FROM `categories_products` WHERE cat_id = '7'
 Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
 exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
 line 440
 
 Query: INSERT INTO `categories_products` (cat_id,category_id) VALUES
 (7,6)
 Warning: SQL Error: 1146: Table 'testdb.categories_products' doesn't
 exist in /home/testdb/cake/libs/model/datasources/dbo_source.php on
 line 440
 
 Warning: Cannot modify header information - headers already sent by
 (output started at /home/testdb/cake/basics.php:697) in /home/testdb/
 cake/libs/controller/controller.php on line 447
 
 /output 

Exclude Array Item on Save

2007-12-01 Thread wilson

Hiya,

I've got a simple image upload form in which the user can come back
and update the image, as well as name, description etc.

The issue I'm having is that when they come back to only update the
description, I don't want the original image to be overridden.

So I first thought that I could just unset the array item.  For
example:

if (!$this-data['Home']['image']['name']) {
unset($this-data['Home']['image']);
}

However, the Cake save() function still overrwrites the old image in
the DB.

How do you all accomplish this in your forms?  Is there a CakePHP
syntax to tell it to not update a field?

I'm using the latest 1.2x from the SVN.

Many thanks!
Wilson


--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



baking batch or short cuts

2007-12-01 Thread WordPress Guru

Hello ,

Is someone of you automated the commonly usage options in bake.php ,
or if there is a way to force bake.php to use a defined config always.
I want to avoid giving the same answers again and again .

Regards
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



$html-input and hasMany

2007-12-01 Thread bibi

If i have a simple attribut i can use Using $html-input('Model/
fieldname')

I have a hasmany attribut names hasmanyfieldname, and i want to
update each row of this attribut in a single form.
can i used the $htmlhelper ?

foreach ($params['data']['hasmanyfieldname'] as $key=$val) {
 echo $val['libelle']; // to view the fied
 echo $html-input(XX); ? // to edit =the fiedls
}

What can i code remplacing XX ?

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Exclude Array Item on Save

2007-12-01 Thread Chris Hartjes

On Dec 1, 2007 4:54 PM, wilson [EMAIL PROTECTED] wrote:

 Hiya,

 I've got a simple image upload form in which the user can come back
 and update the image, as well as name, description etc.

 The issue I'm having is that when they come back to only update the
 description, I don't want the original image to be overridden.

 So I first thought that I could just unset the array item.  For
 example:

 if (!$this-data['Home']['image']['name']) {
 unset($this-data['Home']['image']);
 }

 However, the Cake save() function still overrwrites the old image in
 the DB.

 How do you all accomplish this in your forms?  Is there a CakePHP
 syntax to tell it to not update a field?


Try putting the code that unsets that element in the array in a
beforeSave() method in the model.


-- 
Chris Hartjes

My motto for 2007:  Just build it, damnit!

@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Model Constructors

2007-12-01 Thread [EMAIL PROTECTED]

 You don't need to add a constructor, and doing so is risky business.
 Particularly as adding one and not calling the parent (with the passed
 params, the model constructor has some parameters which you are
 removing) basically means you are disabling all of cake's model work
 and have about 0% chance of your models being of use.

Yes, I didn't think it would really *work*, I was just wondering why
it allowed the page to display, and if it was some weird PHP 4/PHP 5
difference.

 It's probably the zend optimizer problem, check the group for
 solutions (hint find the __ method), I'd bet it turns out to be
 missing/misnamed file/class/method.

It was the Zend Optimizer issue. I disabled __() since I'm not using
it in the app, and the Cake error page displayed telling me it
couldn't find my table.

Turned out I had a space prepending the database name in database
config. Doh! Once the error page actually displayed it was an easy
fix.

Since it seems to be causing a lot of problems, perhaps it may be a
good idea for Cake to check for the existence of the Zend Optimizer,
and issue a warning message? Just a thought. Blank output bugs are
hard to troubleshoot.

Thanks for the help. I believe the blank model constructor helped
precisely because it disables any non-trivial model functionality.

-dave

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using models with plugins in CakePHP 1.2

2007-12-01 Thread brandags

Yes, it doesn't seem fair that just because I'm using a certain Model
from my app controller, that makes my plugin not work because its
AppModel extends my main app model and it can't find the one I'm
trying to use. Is there no way around this?

On Nov 17, 11:00 am, Aaron  Shafovaloff [EMAIL PROTECTED] wrote:
 I'd have to agree with some folks here---it'd be great if plugins
 could plugin into the existing application and have access to the
 main app's models, etc.

 Perhaps plugins could be split into two types? One of the reasons
 Wordpress is so popular is itspluginsystem (which tap into the
 larger app). It'd be nice if CakePHP made it easy for us to set up our
 apps this way.

--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: dbdesigner2cake version 1.0.4 released - minor change

2007-12-01 Thread RichardAtHome

And it works too :-)

I've used it on a largish (30 odd table) schema with great results.

Use it to build the models. Controllers should be baked imho.

On Dec 1, 9:01 pm, powtac [EMAIL PROTECTED] wrote:
 Found it:

 1. DBDesigner 4 Scaffold Tools for CakePHP, or simply dbdesigner2cake,
 is a tool which parses fabFORCE's DBDesigner 4 XML file into CakePHP
 models and controllers files. It aims to simplify the first two steps
 in any system development, modelling and model coding.

 2.http://blog.cirello.org/2007/09/12/preliminary-tutorial-for-dbdesigne...
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: baking batch or short cuts

2007-12-01 Thread kiang

Try this:
http://code.google.com/p/twpug/wiki/PowerBake

---
kiang

On 12月2日, 上午7時59分, RichardAtHome [EMAIL PROTECTED] wrote:
 I posted a similar request about automating bake with a bake /all

 On Dec 1, 9:55 pm, WordPress Guru [EMAIL PROTECTED] wrote:

  Hello ,

  Is someone of you automated the commonly usage options in bake.php ,
  or if there is a way to force bake.php to use a defined config always.
  I want to avoid giving the same answers again and again .

  Regards
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP and XOOPS(2|CUBE)

2007-12-01 Thread kiang

Just a notice for you who would like to talk about integration of
CakePHP and XOOPS(2|CUBE). I just built up a new group here:

http://groups.google.com/group/cakephpxoops
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Replace for VALID_NOT_EMPTY?

2007-12-01 Thread Marcin Domanski aka kabturek

Hey
 'nonEmpty' = array(
'rule' = VALID_NOT_EMPTY
'required' = true,
'allowEmpty' = false,
'message' = 'You must to put something.'
)

 looks like you didnt' replace VALID_NOT_EMPTY ;)

here is what i use:
'field' = array(
'rule' = null,
 'allowEmpty' = false,
 'required' = true
)

'required' = false if you don't want the field to be required for all
saves

HTH
--
Marcin Domanski
tumble.kabturek.info
--~--~-~--~~~---~--~~
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 options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---