Re: Pagination Limits

2011-05-30 Thread Okalany Daniel
Thanks. Its not what i was looking for though. I'm looking for a way to
limit all the records returned by a pagination. Not to limit the records per
page.

On Fri, May 27, 2011 at 8:08 PM, majna majna...@gmail.com wrote:

 http://book.cakephp.org/view/1232/Controller-Setup

 On May 27, 3:20 pm, Okalany Daniel dokala...@gmail.com wrote:
  How would i set the limit in the model? I couldn't find it.
 
  2011/5/26 Alejandro Gómez Fernández agom...@gmail.com
 
 
 
 
 
 
 
 
 
   -BEGIN PGP SIGNED MESSAGE-
   Hash: SHA1
 
   You want to limit the number of rows the database engine send to cake?
   This limit must be set in the select command, so, may be, it must be
   set in the model. Do you try this?
 
   Regards,
 
   Alejandro.
 
   El 26/05/2011 10:11, Okalany Daniel escribió:
Hi All,
i can't seem to be able to limit the number of records returned from
   cakephp
pagination.
 
$this-paginate('limit'=30);
limits the number of results per page. But i want to limit the total
   dataset
returned. Set it to like 300 since i have a very large table.
 
regards,
Daniel
 
   -BEGIN PGP SIGNATURE-
   Version: GnuPG v1.4.11 (MingW32)
   Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
 
   iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
   ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
   Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
   NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
   eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
   wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
   =e1Am
   -END PGP SIGNATURE-
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this
 group
   athttp://groups.google.com/group/cake-php
 
  --
  OKALANY DANIEL,
  P.O BOX 26150,
  Kampala.,
  Uganda.http://okasoft.net
  --

 --
 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php




-- 
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.
http://okasoft.net
--

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: transaction management

2011-05-30 Thread Jens Dittrich
Let's see

http://tinyurl.com/3nprn54

or alternatively

http://book.cakephp.org/view/1633/Transactions

On May 29, 7:59 pm, DerekGardiner derek.gardi...@gmail.com wrote:
 Does cakePHP have a default transaction management?

 On May 27, 8:24 am, Derek Jonathan Gardiner derek.gardi...@gmail.com
 wrote:







  How does cake handle transaction management? If the DB connection where to
  be lost, for example, in the middle of  save or if two sources try to
  make amendments to the same table row how would cakes transaction manager
  handle it?

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Limits

2011-05-30 Thread majna
Urghhh. Then use paginate callback (found in Controller::paginate()).

Add this in your model:

public function paginateCount($conditions = array(), $recursive = 0,
$extra = array()) {
if (isset($extra['myHardLimit'])) {
return $extra['myHardLimit'];
}

$parameters = compact('conditions');
if ($recursive != $this-recursive) {
$parameters['recursive'] = $recursive;
}
return $this-find('count', array_merge($parameters, $extra));
}

Use in controller:
$this-paginate(array('myHardLimit'=300,
'condition'='Post.published'=1));

I think this should work...

On May 30, 8:50 am, Okalany Daniel dokala...@gmail.com wrote:
 Thanks. Its not what i was looking for though. I'm looking for a way to
 limit all the records returned by a pagination. Not to limit the records per
 page.









 On Fri, May 27, 2011 at 8:08 PM, majna majna...@gmail.com wrote:
 http://book.cakephp.org/view/1232/Controller-Setup

  On May 27, 3:20 pm, Okalany Daniel dokala...@gmail.com wrote:
   How would i set the limit in the model? I couldn't find it.

   2011/5/26 Alejandro Gómez Fernández agom...@gmail.com

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

You want to limit the number of rows the database engine send to cake?
This limit must be set in the select command, so, may be, it must be
set in the model. Do you try this?

Regards,

Alejandro.

El 26/05/2011 10:11, Okalany Daniel escribió:
 Hi All,
 i can't seem to be able to limit the number of records returned from
cakephp
 pagination.

 $this-paginate('limit'=30);
 limits the number of results per page. But i want to limit the total
dataset
 returned. Set it to like 300 since i have a very large table.

 regards,
 Daniel

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJN3mE/AAoJEHQn9CmeN9DJ3wYH/37cOKjIvWUTuJKkgLrPikNQ
ZmBmqbdwdksI03FIYTJsh6Q7Ozw8m3/bJx0rUYO0qPvNs2QfyJpzJLSDsZl+ljf2
Zb6P/vEe4Y8nS8r7zGjavRAzuCbWzJeoPSRNGcsBw2ZnnAGCAUqwSMxElvFl3TC7
NsNVSiei/tpeuOFrLmZPyGk8/MQqHW+t+4aJDuSoVahsNHR/2WH+9YM9E9NmjdPB
eqdsrOXrUux7Wbs8EUbJkoh+GRaJGlhOuGd61oDInoSXwuRxOGN2vqap9b7lfaJq
wlGmCFGx+RiRJ8fT40J2+oVc8Rles/yyFvA0l73ZJksqRfpw0M3GsFnBsK0ME4o=
=e1Am
-END PGP SIGNATURE-

--
Our newest site for the community: CakePHP Video Tutorials
   http://tv.cakephp.org
Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp
others with their CakePHP related questions.

To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this
  group
athttp://groups.google.com/group/cake-php

   --
   OKALANY DANIEL,
   P.O BOX 26150,
   Kampala.,
   Uganda.http://okasoft.net
   --

  --
  Our newest site for the community: CakePHP Video Tutorials
 http://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group
  athttp://groups.google.com/group/cake-php

 --
 OKALANY DANIEL,
 P.O BOX 26150,
 Kampala.,
 Uganda.http://okasoft.net
 --

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Pagination Limits

2011-05-30 Thread Phang Mulianto
do you try use

$this-Model-findAll('criteria','fields','order','yourlimit','page');

this will limit the result queried from the database.

paginate only limit the view in the view layer and it depends on the total
record returned by your query.

hope helps

rgds,

Mulianto

On Mon, May 30, 2011 at 5:13 PM, majna majna...@gmail.com wrote:

 Urghhh. Then use paginate callback (found in Controller::paginate()).

 Add this in your model:

 public function paginateCount($conditions = array(), $recursive = 0,
 $extra = array()) {
if (isset($extra['myHardLimit'])) {
return $extra['myHardLimit'];
}

$parameters = compact('conditions');
if ($recursive != $this-recursive) {
$parameters['recursive'] = $recursive;
}
return $this-find('count', array_merge($parameters, $extra));
 }

 Use in controller:
 $this-paginate(array('myHardLimit'=300,
 'condition'='Post.published'=1));

 I think this should work...

 On May 30, 8:50 am, Okalany Daniel dokala...@gmail.com wrote:
  Thanks. Its not what i was looking for though. I'm looking for a way to
  limit all the records returned by a pagination. Not to limit the records
 per
  page.
 
 
 
 
 
 
 
 
 
  On Fri, May 27, 2011 at 8:08 PM, majna majna...@gmail.com wrote:
  http://book.cakephp.org/view/1232/Controller-Setup
 
   On May 27, 3:20 pm, Okalany Daniel dokala...@gmail.com wrote:
How would i set the limit in the model? I couldn't find it.
 
2011/5/26 Alejandro Gómez Fernández agom...@gmail.com
 

 
 --
 Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
 Check out the new CakePHP Questions
 sitehttp://ask.cakephp.organdhelp
 others with their CakePHP related questions.
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this
   group
 athttp://groups.google.com/group/cake-php
 
--
OKALANY DANIEL,
P.O BOX 26150,
Kampala.,
Uganda.http://okasoft.net
--
 
   --
   Our newest site for the community: CakePHP Video Tutorials
  http://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
   others with their CakePHP related questions.
 
   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this
 group
   athttp://groups.google.com/group/cake-php
 
  --
  OKALANY DANIEL,
  P.O BOX 26150,
  Kampala.,
  Uganda.http://okasoft.net
  --

 --
 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Routing with Query Strings

2011-05-30 Thread Rjs37
And an extra question continuing from the above post concerning pagination
and it's urls. 

Currently using the url format mentioned in my above post it's coming up
with:
ps3/blackops/ladders/clan/view/page:1/sort:rank/direction:asc?season=3

where as I'd prefer the paginator to use the query string rather than named
parameters. Those named parameters look horrible. Is there a way to get it
to do this? i.e I'd prefer the below:
/ps3/blackops/ladders/clan?season=3page=1sort=rankdirection=asc

Alternatively if I could get rid of the 'page:' stuff it would probably
suffice too. Something like:
/ps3/blackops/ladders/clan/3/1/rank/asc 
though I imagine it wouldn't like me not having the action in the url and
it's not very user friendly in the sense they wouldn't know how the numbers
correlate.

--
View this message in context: 
http://cakephp.1045679.n5.nabble.com/Routing-with-Query-Strings-tp4433697p4435721.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Form helper input select box customization

2011-05-30 Thread Jae Choi
Hi all,

Is there a way we can show multiple columns to select when selecting
belongsto values in edit.ctp view rather than just column named with
name?

To rephrase, basically I want to view different column values under
form helper input() rather than just one column value under select box
as it will give additional information under edit.ctp or add.ctp views.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Dates

2011-05-30 Thread Jae Choi
In a list view under scaffolding, is there a way we can create a form
at the top so that we can select start and from dates which can be
submitted so that we can filter those lists???

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to configure MeioUpload Behavior for uploading any kind of files

2011-05-30 Thread Alejandra
Hi everyone.
I would like to use the MeioUpload Behavior for uploading any kind of
documents(I want it to accept every extension ).

It looks like I was finally able to upload other kind of files apart
from images,I had to write the options 'allowedMime' and 'allowedExt'
in camelCase (I don't know why because in the documentation they use
the underscore version 'allowed_mime', 'allowed_ext' :(   ), but I
haven't been able to upload .zip files and most importantly I still
don't know how to tell the behaviour to accept anything.

var $actsAs = array(
'MeioUpload' = array(
'link_referencia' = array(
'dir' = 'files{DS}uploads',
'create_directory' = true,
'allowedMime' = array('application/pdf', 'application/
msword', 'application/vnd.ms-powerpoint', 'application/vnd.ms-excel',
'application/rtf', 'application/zip'),
'allowedExt' = array('.pdf', '.doc', '.ppt', '.xls',
'.rtf', '.zip'),
'default' = false,
 )
   )
);

Any help will be very much appreciated.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Can't validate model ?!

2011-05-30 Thread Niels
Hey everybody,

I'm new to CakePHP, so don't shoot me if I made a stupid mistake.
I'm having a problem validating my model I created. I think I done
everything right, but it doesnt' work.
I already took a look at http://book.cakephp.org/view/1143/Data-Validation
and http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller.
According to the cookbook I done it right but somehow I can't get my
model to be validated.

This is my code so far:

My Link_controller.php
?php

class LinksController extends AppController
{
var $name = 'Links';
var $helpers = array('Html','Session');

function index()
{
$this-set(links,$this-Link-find('all'));
}

function add()
{
if(isset($this-data))
{
$this-Link-set($this-data);
if($this-Link-validates())
{
debug($this-data);
//if($this-Link-save($this-data))
$this-Session-setFlash('Data Saved 
Succesfully');
}
}

}
}

?

If i don't type anything in my form my add method gets to the debug
statement. Which I find strange because I use the isset($this-data).
my debug print out looks like this :
Array
(
[Link] = Array
(
[link_name] =
[link_url] =
[link_category] =
[link_img_url] =
)

)

my link model
?php
class Link extends AppModel
{
var $name = 'Link';

var $validate = array(
'link_name' = array(
'rule' = 'notEmpty'
),
'link_url' = array(
'rule' = 'notEmpty'
)
);

/*  var $validate = array(
'link_name' = array(
'link_name_rule1' = array(
'rule' = 'alphaNumeric',
'message' = 'Link name can only contain 
numbers and letters'
),
'link_name_rule2' = array(
'rule' = array('macLength',50),
'message' = 'Link name can maximum have 50 
characters'
),
'link_name_rule3' = array(
'rule' = 'notEmpty',
'message' = 'The field cannot be empty'
),
'link_name_rule4' = array(
'rule' = 'isUnique',
'message' = 'The field must be unique'
)
),
'link_url' = array(
'link_url1' = array(
'rule' = 'notEmpty',
'message' = 'The url cannot be empty'
),
'link_url2' = array(
'rule' = array('url',true),
'message' = 'The given input isnot a valid url'
)
),
'link_category' = array(
'link_category' = array(
'rule' = 'notEmpty',
'message' = 'The category cannot be empty'
),
'link_category' = array(
'rule' = array('between',1,3),
'message' = 'The image category must be 1,2 or 
3'
)
),
'link_img_url' = array(
'link_img_url1' = array(
'rule' = 'notEmpty',
'message' = 'The image url cannot be empty'
),
'link_img_url2' = array(
'rule' = 
array('extension',array('gif','jpeg','png','jpg')),
'message' = 'Please supply a valid image'
)
)
);*/
}
?
I first tried some simple rules but they also don't seem to work.

and my add view:

?php
echo $form-create('Link');
echo $form-input('link_name');
echo $form-input('link_url');
echo $form-input('link_category');
echo $form-input('link_img_url');
echo $form-end('Add Link');
?


I find it really strange could some  one please help me find this
stupid bug ?

Thanks a lot,

cheers

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 

One-way relationship

2011-05-30 Thread Mondo
I have Items and Units, and want each Item to have one Unit, but that
unit can be used by many.

Items Table
id - int
name - varchar
description varchar
unit_id - int

Units Table
id - int
name - varchar
description - varchar


Items Model
var $hasOne = array( 'Units' = array( 'className' = 'Unit' ) );

Units Model
Nothing, but previously I tried:  var $belongsTo = array( 'Items' =
array( 'className' = 'Item' ) );


When I'm in the scaffolding (List Items) I get:
Warning (512): SQL Error: 1054: Unknown column 'Units.item_id' in 'on
clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]

And in the Edit Item screen, the Units drop-down is empty. Any idea
what I'm doing wrong? Essentially the Units table are just to populate
a drop-down in the Item entry form, but I'd like it to auto-populate
in scaffold.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


How to configure MeioUpload Behavior for uploading any kind of files

2011-05-30 Thread Alejandra
Hi everyone.
I would like to use the MeioUpload Behavior for uploading any kind of
documents(I want it to accept every extension ).

It looks like I was finally able to upload other kind of files apart
from images,I had to write the options 'allowedMime' and 'allowedExt'
in camelCase (I don't know why because in the documentation they use
the underscore version 'allowed_mime', 'allowed_ext' :(   ), but I
haven't been able to upload .zip files and most importantly I still
don't know how to tell the behaviour to accept anything.

var $actsAs = array(
   'MeioUpload' = array(
   'link_referencia' = array(
   'dir' = 'files{DS}uploads',
   'create_directory' = true,
   'allowedMime' = array('application/pdf', 'application/
msword', 'application/vnd.ms-powerpoint', 'application/vnd.ms-excel',
'application/rtf', 'application/zip'),
   'allowedExt' = array('.pdf', '.doc', '.ppt', '.xls',
'.rtf', '.zip'),
   'default' = false,
)
  )
   );

Any help will be very much appreciated.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


CakePHP 1.3.10 released

2011-05-30 Thread Graham Weldon
Today we're excited to release CakePHP 1.3.10, which emerges hot on
the heels of CakePHP 1.3.9 to addresses a specific issue with cookie
deletion that emerged in CakePHP 1.3.9.

This release contains 10 commits, and 3 bug fixes.

An addition has been made to check for URL Rewriting capabilities on
your web server, providing a helpful message with links to the CakePHP
book for assistance to configure URL rewriting.

The XML class previously incorrectly processed elements with children
for slugging, this has also been fixed.

Further to these updates, more testing has been aded to ensure the
functionality of the Media view, as well as correct handling for
uppercase file extensions.

Finally, we've added the test suite icons to the distribution meaning
that offline testing gives you pretty pictures in the test suite!

CakePHP 1.3.10 is a short release, but we're glad to be able to get
these fixes and enhancements out to the community quickly. We hope you
enjoy it!

CakeFest 2011[1] was announced a couple of weeks ago, but we'd like to
remind you all about this years conference. This years host city is
Manchester in the UK. We've booked an exciting venue, and we're
looking forward to a massive turnout of CakePHP developers, and core
CakePHP contributors. Early bird ticket sales are on now, so take
advantage of this reduced rate ticket while its still on! CakeFest
consists of 4 days of activities. The first two days comprise a
workshop where you can learn about CakePHP at a beginner or advanced
level in one of the two concurrent sessions that we'll be running. The
second two days are the conference, with talks presented from speakers
all over the world. Don't miss this amazing opportunity to mix with
your peers, learn some new things about CakePHP and extend your
existing knowledge! We look forward to seeing you there!

1: http://cakefest.org

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Can't validate model ?!

2011-05-30 Thread euromark
you should use

if(!empty($this-data)) {}

see baked code examples
as a beginner i strongly recommend that you use baking to create your
views and forms


On 29 Mai, 21:47, Niels steni...@gmail.com wrote:
 Hey everybody,

 I'm new to CakePHP, so don't shoot me if I made a stupid mistake.
 I'm having a problem validating my model I created. I think I done
 everything right, but it doesnt' work.
 I already took a look athttp://book.cakephp.org/view/1143/Data-Validation
 andhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller.
 According to the cookbook I done it right but somehow I can't get my
 model to be validated.

 This is my code so far:

 My Link_controller.php
 ?php

 class LinksController extends AppController
 {
         var $name = 'Links';
         var $helpers = array('Html','Session');

         function index()
         {
                 $this-set(links,$this-Link-find('all'));
         }

         function add()
         {
                 if(isset($this-data))
                 {
                         $this-Link-set($this-data);
                         if($this-Link-validates())
                         {
                                 debug($this-data);
                                 //if($this-Link-save($this-data))
                                         $this-Session-setFlash('Data Saved 
 Succesfully');
                         }
                 }

         }

 }

 ?

 If i don't type anything in my form my add method gets to the debug
 statement. Which I find strange because I use the isset($this-data).
 my debug print out looks like this :
 Array
 (
     [Link] = Array
         (
             [link_name] =
             [link_url] =
             [link_category] =
             [link_img_url] =
         )

 )

 my link model
 ?php
 class Link extends AppModel
 {
         var $name = 'Link';

         var $validate = array(
                 'link_name' = array(
                         'rule' = 'notEmpty'
                 ),
                 'link_url' = array(
                         'rule' = 'notEmpty'
                 )
         );

 /*      var $validate = array(
                 'link_name' = array(
                         'link_name_rule1' = array(
                                 'rule' = 'alphaNumeric',
                                 'message' = 'Link name can only contain 
 numbers and letters'
                         ),
                         'link_name_rule2' = array(
                                 'rule' = array('macLength',50),
                                 'message' = 'Link name can maximum have 50 
 characters'
                         ),
                         'link_name_rule3' = array(
                                 'rule' = 'notEmpty',
                                 'message' = 'The field cannot be empty'
                         ),
                         'link_name_rule4' = array(
                                 'rule' = 'isUnique',
                                 'message' = 'The field must be unique'
                         )
                 ),
                 'link_url' = array(
                         'link_url1' = array(
                                 'rule' = 'notEmpty',
                                 'message' = 'The url cannot be empty'
                         ),
                         'link_url2' = array(
                                 'rule' = array('url',true),
                                 'message' = 'The given input isnot a valid 
 url'
                         )
                 ),
                 'link_category' = array(
                         'link_category' = array(
                                 'rule' = 'notEmpty',
                                 'message' = 'The category cannot be empty'
                         ),
                         'link_category' = array(
                                 'rule' = array('between',1,3),
                                 'message' = 'The image category must be 1,2 
 or 3'
                         )
                 ),
                 'link_img_url' = array(
                         'link_img_url1' = array(
                                 'rule' = 'notEmpty',
                                 'message' = 'The image url cannot be empty'
                         ),
                         'link_img_url2' = array(
                                 'rule' = 
 array('extension',array('gif','jpeg','png','jpg')),
                                 'message' = 'Please supply a valid image'
                         )
                 )
         );*/}

 ?
 I first tried some simple rules but they also don't seem to work.

 and my add view:

 ?php
 echo $form-create('Link');
 echo $form-input('link_name');
 echo $form-input('link_url');
 echo $form-input('link_category');
 echo $form-input('link_img_url');
 echo $form-end('Add Link');
 ?

 I find it really strange could some  one please help me find this
 stupid bug ?

 Thanks a lot,

 cheers

-- 
Our 

Re: Dates

2011-05-30 Thread euromark
not in scaffolding
bake your views and then simply modify them to your needs
there are filter plugins out there that can be used almost with drag-
and-drop

On 29 Mai, 14:10, Jae Choi hybm...@hotmail.com wrote:
 In a list view under scaffolding, is there a way we can create a form
 at the top so that we can select start and from dates which can be
 submitted so that we can filter those lists???

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Can't validate model ?!

2011-05-30 Thread Niels Stevens
Thanks for the response but !empty doesn't work either.

it still passes the if and de debug output is still:

Array
(
[Link] = Array
(
[link_name] =
[link_url] =
[link_category] =
[link_img_url] =
)
)

when I don't input anything in the form. 
Maybe you're right of using the console to bake my first app but still my code 
should work.

Could any body see the error or mistake I made ?

On 30 May 2011, at 16:33, euromark wrote:

 you should use
 
 if(!empty($this-data)) {}
 
 see baked code examples
 as a beginner i strongly recommend that you use baking to create your
 views and forms
 
 
 On 29 Mai, 21:47, Niels steni...@gmail.com wrote:
 Hey everybody,
 
 I'm new to CakePHP, so don't shoot me if I made a stupid mistake.
 I'm having a problem validating my model I created. I think I done
 everything right, but it doesnt' work.
 I already took a look athttp://book.cakephp.org/view/1143/Data-Validation
 andhttp://book.cakephp.org/view/1182/Validating-Data-from-the-Controller.
 According to the cookbook I done it right but somehow I can't get my
 model to be validated.
 
 This is my code so far:
 
 My Link_controller.php
 ?php
 
 class LinksController extends AppController
 {
 var $name = 'Links';
 var $helpers = array('Html','Session');
 
 function index()
 {
 $this-set(links,$this-Link-find('all'));
 }
 
 function add()
 {
 if(isset($this-data))
 {
 $this-Link-set($this-data);
 if($this-Link-validates())
 {
 debug($this-data);
 //if($this-Link-save($this-data))
 $this-Session-setFlash('Data Saved 
 Succesfully');
 }
 }
 
 }
 
 }
 
 ?
 
 If i don't type anything in my form my add method gets to the debug
 statement. Which I find strange because I use the isset($this-data).
 my debug print out looks like this :
 Array
 (
 [Link] = Array
 (
 [link_name] =
 [link_url] =
 [link_category] =
 [link_img_url] =
 )
 
 )
 
 my link model
 ?php
 class Link extends AppModel
 {
 var $name = 'Link';
 
 var $validate = array(
 'link_name' = array(
 'rule' = 'notEmpty'
 ),
 'link_url' = array(
 'rule' = 'notEmpty'
 )
 );
 
 /*  var $validate = array(
 'link_name' = array(
 'link_name_rule1' = array(
 'rule' = 'alphaNumeric',
 'message' = 'Link name can only contain 
 numbers and letters'
 ),
 'link_name_rule2' = array(
 'rule' = array('macLength',50),
 'message' = 'Link name can maximum have 50 
 characters'
 ),
 'link_name_rule3' = array(
 'rule' = 'notEmpty',
 'message' = 'The field cannot be empty'
 ),
 'link_name_rule4' = array(
 'rule' = 'isUnique',
 'message' = 'The field must be unique'
 )
 ),
 'link_url' = array(
 'link_url1' = array(
 'rule' = 'notEmpty',
 'message' = 'The url cannot be empty'
 ),
 'link_url2' = array(
 'rule' = array('url',true),
 'message' = 'The given input isnot a valid 
 url'
 )
 ),
 'link_category' = array(
 'link_category' = array(
 'rule' = 'notEmpty',
 'message' = 'The category cannot be empty'
 ),
 'link_category' = array(
 'rule' = array('between',1,3),
 'message' = 'The image category must be 1,2 
 or 3'
 )
 ),
 'link_img_url' = array(
 'link_img_url1' = array(
 'rule' = 'notEmpty',
 'message' = 'The image url cannot be empty'
 ),
 'link_img_url2' = array(
 'rule' = 
 array('extension',array('gif','jpeg','png','jpg')),
 

Problem with default.ctp

2011-05-30 Thread Phil
I created a sample app using the scaffolding, which worked very well,
thank you.
I went the next step and created a default.ctp file using the one that
comes with cakephp.
I then created a style.css file with the following:
* { font-family: Lucida Grande,Lucida,sans-serif; }

th {
font-size: 14px;
fond-weight: bold;
background-color: #e1e1e1;
border-bottom: 1px solid #ccc;
padding: 10px;
}

div.actions ul {
list-style-type: none;
}

I then tried rerunning the application and the only output I got was:
css('styles');?

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Debugging CakeEmail in cake-2.0.0-alpha

2011-05-30 Thread José Lorenzo
Please use the latests 2.0 code, that was a bug detected short after
releasing cake 2.0 alpha.

On May 27, 12:39 pm, Matthias matthias.gruetz...@googlemail.com
wrote:
 Debugging the OLD component or using a different email component is
  not what i've asked for...

 Also, I got 2 bugs:
 Fatal error: Uncaught exception 'SocketException' with message 'Class
 mailTransport not found.' in /home2/www/b75/hrnstrm/domains/win-
 hildesheim/secret_cosynt_test/lib/Cake/Network/Email/CakeEmail.php:
 766
 When I manually insert this after line 762:
 $transportClassname = 'MailTransport';
 it works correctly.
 See the lower case m.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Find with $hasAndBelongsToMany

2011-05-30 Thread hill180
I have three models
Authors
Books (hasandbelongstomany category)
Category

They are properly configured for $hasAndBelongsToMany (books/category)
relationship.

I need to get all books by an author in a certain category (5 in this
example)

Obviously the category id is not in the authors table so I am trying to
figure out how to reference the category id.  I have tried below to no
avail.

$this-Category-Author-find('all',
array('conditions'=array('Category.id'='5', 'Author.id'='2')));
or
$this-Author-find('all', array('conditions'=array('Category.id'='5',
'Author.id'='2')));

This is the first time I have done a HABTM query.  (searched manual and and
a couple cake books - no help)

Thanks!

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Saving ARO taking around 10 seconds, processing tree behavior.

2011-05-30 Thread Tufla
After apply the change, the reading process has been improved a
little, but the writing process continue taking a lot time :S BTW I
checked and the AROS table is not fragmented. Any other idea ? Thank
you.


On May 27, 12:29 pm, Tufla hocanaste...@gmail.com wrote:
 Wow Jeremy, thank you very much...very good suggestion, I will do it,
 and I'll let you know how it works.

 On May 26, 11:54 pm, Jeremy Burns | Class Outfit







 jeremybu...@classoutfit.com wrote:
  The standard SQL that creates these tables uses MyIsam and therefore does 
  not include referential integrity. Ideally, the tables should be InnoDb and 
  have proper referential integrity. If you don't have that and can do it, 
  I'd strongly recommend it. It will bring about dramatic speed improvements.

  Jeremy Burns
  Class Outfit

  jeremybu...@classoutfit.comhttp://www.classoutfit.com

  On 26 May 2011, at 19:07, Tufla wrote:

   I have an app working in CakePHP 1.2.1.8004

   Currently my ARO's table has up to 43000 rows, and the ARO's save
   process, every time that a user creates an account, has became really
   slow. It is taking around 10 seconds exactly in the point where the
   save is made:

   $aro-save(array(
            'model'=$model,
            'foreign_key'=$id,
            'parent_id'=$parent_id,
            'alias'=$alias)
   );

   More in deeply, the most time is spent processing the tree behavior in
   the _setParent(...) method.

   What can I do to improve the process performance ? Could it be an
   issue in the table ?

   Thank you in advanced for your help.

   --
   Our newest site for the community: CakePHP Video 
   Tutorialshttp://tv.cakephp.org
   Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 
   others with their CakePHP related questions.

   To unsubscribe from this group, send email to
   cake-php+unsubscr...@googlegroups.com For more options, visit this group 
   athttp://groups.google.com/group/cake-php

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


HABTM Pagination

2011-05-30 Thread Shaz
I have the following relationships (habtm both ways):

User HABTM Groups
User HABTM Events
User HABTM Locations

So for example - I want to get users that belong to groupA, groupB and
locationX and paginate the results - whats the best way of
implementing it?

I'm trying to avoid using bindModel(), doing manual joins and making
models for the join table; I'm hoping someone can show me a simpler
way :)

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Find with $hasAndBelongsToMany

2011-05-30 Thread Shaz
I've just posted a similiar query!

Googling around has given me the bindModel() method - which you can
read at the bottom of the page here:

http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM

But I wasn't able to get it to work for me. There's also a method
using manual joins and creating models for the join table and querying
it - haven't tried either of the two and can't say if they'll work.

On May 30, 5:14 pm, hill180 hill...@gmail.com wrote:
 I have three models
 Authors
 Books (hasandbelongstomany category)
 Category

 They are properly configured for $hasAndBelongsToMany (books/category)
 relationship.

 I need to get all books by an author in a certain category (5 in this
 example)

 Obviously the category id is not in the authors table so I am trying to
 figure out how to reference the category id.  I have tried below to no
 avail.

 $this-Category-Author-find('all',
 array('conditions'=array('Category.id'='5', 'Author.id'='2')));
 or
 $this-Author-find('all', array('conditions'=array('Category.id'='5',
 'Author.id'='2')));

 This is the first time I have done a HABTM query.  (searched manual and and
 a couple cake books - no help)

 Thanks!

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Saving ARO taking around 10 seconds, processing tree behavior.

2011-05-30 Thread Shaz
Index it!

http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component

On May 30, 7:29 pm, Tufla hocanaste...@gmail.com wrote:
 After apply the change, the reading process has been improved a
 little, but the writing process continue taking a lot time :S BTW I
 checked and the AROS table is not fragmented. Any other idea ? Thank
 you.

 On May 27, 12:29 pm, Tufla hocanaste...@gmail.com wrote:







  Wow Jeremy, thank you very much...very good suggestion, I will do it,
  and I'll let you know how it works.

  On May 26, 11:54 pm, Jeremy Burns | Class Outfit

  jeremybu...@classoutfit.com wrote:
   The standard SQL that creates these tables uses MyIsam and therefore does 
   not include referential integrity. Ideally, the tables should be InnoDb 
   and have proper referential integrity. If you don't have that and can do 
   it, I'd strongly recommend it. It will bring about dramatic speed 
   improvements.

   Jeremy Burns
   Class Outfit

   jeremybu...@classoutfit.comhttp://www.classoutfit.com

   On 26 May 2011, at 19:07, Tufla wrote:

I have an app working in CakePHP 1.2.1.8004

Currently my ARO's table has up to 43000 rows, and the ARO's save
process, every time that a user creates an account, has became really
slow. It is taking around 10 seconds exactly in the point where the
save is made:

$aro-save(array(
         'model'=$model,
         'foreign_key'=$id,
         'parent_id'=$parent_id,
         'alias'=$alias)
);

More in deeply, the most time is spent processing the tree behavior in
the _setParent(...) method.

What can I do to improve the process performance ? Could it be an
issue in the table ?

Thank you in advanced for your help.

--
Our newest site for the community: CakePHP Video 
Tutorialshttp://tv.cakephp.org
Check out the new CakePHP Questions 
sitehttp://ask.cakephp.organdhelpothers with their CakePHP related 
questions.

To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this 
group athttp://groups.google.com/group/cake-php

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: One-way relationship

2011-05-30 Thread Shaz
You need the relationship both ways:

Item hasOne Unit
Unit belongsTo Item

Add a few items and units into the database. Then go back to the item
controller, edit action and make sure you get a list of all the units:

$this-Item-Unit-find('list'));

Hopefully that helps.


On May 29, 11:53 pm, Mondo mo...@nodegarden.net wrote:
 I have Items and Units, and want each Item to have one Unit, but that
 unit can be used by many.

 Items Table
 id - int
 name - varchar
 description varchar
 unit_id - int

 Units Table
 id - int
 name - varchar
 description - varchar

 Items Model
 var $hasOne = array( 'Units' = array( 'className' = 'Unit' ) );

 Units Model
 Nothing, but previously I tried:  var $belongsTo = array( 'Items' =
 array( 'className' = 'Item' ) );

 When I'm in the scaffolding (List Items) I get:
 Warning (512): SQL Error: 1054: Unknown column 'Units.item_id' in 'on
 clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]

 And in the Edit Item screen, the Units drop-down is empty. Any idea
 what I'm doing wrong? Essentially the Units table are just to populate
 a drop-down in the Item entry form, but I'd like it to auto-populate
 in scaffold.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form helper input select box customization

2011-05-30 Thread Shaz
Should be able to find what you're looking for at:

http://book.cakephp.org/view/1390/Automagic-Form-Elements

On May 29, 1:08 pm, Jae Choi hybm...@hotmail.com wrote:
 Hi all,

 Is there a way we can show multiple columns to select when selecting
 belongsto values in edit.ctp view rather than just column named with
 name?

 To rephrase, basically I want to view different column values under
 form helper input() rather than just one column value under select box
 as it will give additional information under edit.ctp or add.ctp views.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread Shaz
Was it an sql dump or just the schema? It might be a case of
rebuilding the ACL...

On May 27, 5:11 am, 8vius lmd...@gmail.com wrote:
 Hey all, I'm new to CakePHP and I'm using it at work. I have a Mac
 running Mac OS X Leopard at work as well as at home and a PC at work
 as well.

 I have the project I'm currently working on set up on all 3, it works
 fine at my work computers but on my home Mac I get the error in the
 title. The project is on SVN so I just checked it out ran the SQL
 script for my DB schema and set up the same user I have in my work DB
 and it will not work still.

 I also cleared out the cache folders as suggested in other posts with
 a similar problem and it still won't work.

 Obviously I have checked the database table and it is present in my
 DB. Anyone have any other clues as to what might be happening?

 SCREENSHOTS:

 Error Screen:http://yfrog.com/hsefg1p

 CakePHP database.php:http://yfrog.com/h3l1t4p

 DB tables:http://yfrog.com/h0v3ajp

 DB privileges:http://yfrog.com/h0eu71p

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: One-way relationship

2011-05-30 Thread ShadowCross
Your model relationship should actually be:

Item belongsTo Unit
Unit hasMany Items (optional)

In the Cookbook subsection 3.7.6.3 belongsTo (http://
book.cakephp.org/view/1039/Associations-Linking-Models-
Together#belongsTo-1042, part of 3.7.6 Associations: Linking Models
Together), there is a note:

If a model(table) contains a foreign key, it belongsTo the other
model(table).




On May 29, 3:53 pm, Mondo mo...@nodegarden.net wrote:
 I have Items and Units, and want each Item to have one Unit, but that
 unit can be used by many.

 Items Table
 id - int
 name - varchar
 description varchar
 unit_id - int

 Units Table
 id - int
 name - varchar
 description - varchar

 Items Model
 var $hasOne = array( 'Units' = array( 'className' = 'Unit' ) );

 Units Model
 Nothing, but previously I tried:  var $belongsTo = array( 'Items' =
 array( 'className' = 'Item' ) );

 When I'm in the scaffolding (List Items) I get:
 Warning (512): SQL Error: 1054: Unknown column 'Units.item_id' in 'on
 clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 684]

 And in the Edit Item screen, the Units drop-down is empty. Any idea
 what I'm doing wrong? Essentially the Units table are just to populate
 a drop-down in the Item entry form, but I'd like it to auto-populate
 in scaffold.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread ShadowCross
One of the troubleshooting steps I take whenever I have this error on
a project is to log onto the database using the same connection info
as in my database.php file.  The screen shot of MySQLWorkbench
indicates a connection using 'root', which can see all the tables in
all the databases; the screen shot of the PHPMyAdmin session seems to
also be from the 'root' user perspective.  It might be as simple as
granting user fonyk_db insert/update/delete privileges to the acos
table in the fonyk_db schema.


On May 26, 9:11 pm, 8vius lmd...@gmail.com wrote:
 Hey all, I'm new to CakePHP and I'm using it at work. I have a Mac
 running Mac OS X Leopard at work as well as at home and a PC at work
 as well.

 I have the project I'm currently working on set up on all 3, it works
 fine at my work computers but on my home Mac I get the error in the
 title. The project is on SVN so I just checked it out ran the SQL
 script for my DB schema and set up the same user I have in my work DB
 and it will not work still.

 I also cleared out the cache folders as suggested in other posts with
 a similar problem and it still won't work.

 Obviously I have checked the database table and it is present in my
 DB. Anyone have any other clues as to what might be happening?

 SCREENSHOTS:

 Error Screen:http://yfrog.com/hsefg1p

 CakePHP database.php:http://yfrog.com/h3l1t4p

 DB tables:http://yfrog.com/h0v3ajp

 DB privileges:http://yfrog.com/h0eu71p

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Form helper input select box customization

2011-05-30 Thread ShadowCross
The options displayed in the select box is usually generated with a
Model::find('list'), which you can adjust to display a specific column
from your model (see: 
http://book.cakephp.org/view/1017/Retrieving-Your-Data#find-list-1022).
If you are using CakePHP 1.3.x, you can use a virtual field composed
of several columns (see: http://book.cakephp.org/view/1608/Virtual-fields)
as the displayed field.

On May 29, 5:08 am, Jae Choi hybm...@hotmail.com wrote:
 Hi all,

 Is there a way we can show multiple columns to select when selecting
 belongsto values in edit.ctp view rather than just column named with
 name?

 To rephrase, basically I want to view different column values under
 form helper input() rather than just one column value under select box
 as it will give additional information under edit.ctp or add.ctp views.

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


.ctp files

2011-05-30 Thread Magician
Hello everyone,

I am trying to create a .ctp file for the tutorial program listed in
book.cakephp.org.  I have copied and pasted the exact .ctp code listed
and placed it in the proper file it asked for.  However, when I try to
access this file in either Windows IE or Firefox, it displays the code
and not the proper output.  Does anyone know how to remedy this
situation?

exact tutorial page:

http://book.cakephp.org/view/1536/Creating-Post-Views

Thanks!

Magician

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Find with $hasAndBelongsToMany

2011-05-30 Thread hill180
I saw that page in the manual, but glanced over the answer.  Thanks!

Shaz, this is what I did to solve the problem if you are still having
problems.

$this-Author-bindModel(array(
'hasAndBelongsToMany' = array(
'Category' = array('conditions'=array('Category.id'='5'))
)));
$this-Author-find('all', array('conditions'=array('Author.id'='2')));

On Mon, May 30, 2011 at 1:06 PM, Shaz shazam...@gmail.com wrote:

 I've just posted a similiar query!

 Googling around has given me the bindModel() method - which you can
 read at the bottom of the page here:

 http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM

 But I wasn't able to get it to work for me. There's also a method
 using manual joins and creating models for the join table and querying
 it - haven't tried either of the two and can't say if they'll work.

 On May 30, 5:14 pm, hill180 hill...@gmail.com wrote:
  I have three models
  Authors
  Books (hasandbelongstomany category)
  Category
 
  They are properly configured for $hasAndBelongsToMany (books/category)
  relationship.
 
  I need to get all books by an author in a certain category (5 in this
  example)
 
  Obviously the category id is not in the authors table so I am trying to
  figure out how to reference the category id.  I have tried below to no
  avail.
 
  $this-Category-Author-find('all',
  array('conditions'=array('Category.id'='5', 'Author.id'='2')));
  or
  $this-Author-find('all', array('conditions'=array('Category.id'='5',
  'Author.id'='2')));
 
  This is the first time I have done a HABTM query.  (searched manual and
 and
  a couple cake books - no help)
 
  Thanks!

 --
 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
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread BurningFuses

Make sure that your files (controllers) have the correct
capitalization.
Once I accidentaly typed an uppercase where it shouldn't be and it
brought chaos to my app.

On May 27, 1:11 am, 8vius lmd...@gmail.com wrote:
 Hey all, I'm new to CakePHP and I'm using it at work. I have a Mac
 running Mac OS X Leopard at work as well as at home and a PC at work
 as well.

 I have the project I'm currently working on set up on all 3, it works
 fine at my work computers but on my home Mac I get the error in the
 title. The project is on SVN so I just checked it out ran the SQL
 script for my DB schema and set up the same user I have in my work DB
 and it will not work still.

 I also cleared out the cache folders as suggested in other posts with
 a similar problem and it still won't work.

 Obviously I have checked the database table and it is present in my
 DB. Anyone have any other clues as to what might be happening?

 SCREENSHOTS:

 Error Screen:http://yfrog.com/hsefg1p

 CakePHP database.php:http://yfrog.com/h3l1t4p

 DB tables:http://yfrog.com/h0v3ajp

 DB privileges:http://yfrog.com/h0eu71p

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: .ctp files

2011-05-30 Thread Sathia S
Hi,


  However, when I try to
 access this file in either Windows IE or Firefox, it displays the code
 and not the proper output.  Does anyone know how to remedy this
 situation?



have you put '?php' php tag . you may not opened php tag.
please check that.






-- 
Regards

sathia
http://www.sathia27.wordpress.com

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Error: Database table acos for model Aco was not found.

2011-05-30 Thread 8vius
ShadowCross your solution worked, I seem to have forgotten those
permissions to the DB user and now it all works. Thank you

On May 30, 7:01 pm, ShadowCross adri...@jps.net wrote:
 One of the troubleshooting steps I take whenever I have this error on
 a project is to log onto the database using the same connection info
 as in my database.php file.  The screen shot of MySQLWorkbench
 indicates a connection using 'root', which can see all the tables in
 all the databases; the screen shot of the PHPMyAdmin session seems to
 also be from the 'root' user perspective.  It might be as simple as
 granting user fonyk_db insert/update/delete privileges to the acos
 table in the fonyk_db schema.

 On May 26, 9:11 pm, 8vius lmd...@gmail.com wrote:







  Hey all, I'm new to CakePHP and I'm using it at work. I have a Mac
  running Mac OS X Leopard at work as well as at home and a PC at work
  as well.

  I have the project I'm currently working on set up on all 3, it works
  fine at my work computers but on my home Mac I get the error in the
  title. The project is on SVN so I just checked it out ran the SQL
  script for my DB schema and set up the same user I have in my work DB
  and it will not work still.

  I also cleared out the cache folders as suggested in other posts with
  a similar problem and it still won't work.

  Obviously I have checked the database table and it is present in my
  DB. Anyone have any other clues as to what might be happening?

  SCREENSHOTS:

  Error Screen:http://yfrog.com/hsefg1p

  CakePHP database.php:http://yfrog.com/h3l1t4p

  DB tables:http://yfrog.com/h0v3ajp

  DB privileges:http://yfrog.com/h0eu71p

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Delete only one associated record

2011-05-30 Thread emmexx
I have 2 models with a hasMany/belongsTo relation. Let's say User/
Pictures: a user hasMany pictures and a picture belongs to a user.

I have a page where it is possible to enter data about the user and to
select pictures and enter data about them.
The problem: when I try to edit the data I can choose to remove one
or many pictures.
Is there a cake way to accomplish that?
If I simply remove the picture from the page and save cake doesn't
delete anything. Should I do that by hand, coding some code that
checks if the submitted data is different from the recorded data?

Thank you
maxx

-- 
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
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php