Re: generateList() returning SQL error.

2009-07-04 Thread centr0

thanks for the reply!  im currently using 1.2 following a book thats
using 1.1 i guess.  find('list') worked perfectly.

ill make sure to post the models next question i have.

is there a way to have my code formatted as code on here?  new to
google groups and groups in general.

On Jul 4, 10:03 pm, Hendry  wrote:
> What cake version are you using now? If it is cake 1.2, generateList
> is deprecated, you should use find('list').
> Also, would be more helpful if you post your Book and Author model and
> its relationship here.
>
> ~hendry
>
> On Sun, Jul 5, 2009 at 12:53 PM, centr0 wrote:
> > the error msg is:
> > 1064: You have an error in your SQL syntax; check the manual that
> > corresponds to your MySQL server version for the right syntax to use
> > near 'generateList' at line 1
>
> > im using xampp on win xp so im guessing everything is up to date.  my
> > db_config uses mysqli.
>
> > any ideas?  thanks in advance for response.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: generateList() returning SQL error.

2009-07-04 Thread Hendry

What cake version are you using now? If it is cake 1.2, generateList
is deprecated, you should use find('list').
Also, would be more helpful if you post your Book and Author model and
its relationship here.

~hendry

On Sun, Jul 5, 2009 at 12:53 PM, centr0 wrote:
> the error msg is:
> 1064: You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near 'generateList' at line 1
>
> im using xampp on win xp so im guessing everything is up to date.  my
> db_config uses mysqli.
>
> any ideas?  thanks in advance for response.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



generateList() returning SQL error.

2009-07-04 Thread centr0

my db is designed as one author can have many books.  books belongsto
authors.  when i call generateList() i get a 1064 SQL error.

here is my add action:

public function add() {
if(!empty($this->data)) {
$this->Book->create();
$this->Book->save($this->data);
$this->redirect(array('action' => 'index'));
}
$authors = $this->Book->Author->generateList();
$this->set('authors', $authors);
}

and my view:

create('Book'); ?>

Add a new book:
input('isbn');
echo $form->input('title');
echo $form->input('description');
echo $form->input('author_id');
?>

end('Submit'); ?>

the error msg is:
1064: You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'generateList' at line 1

im using xampp on win xp so im guessing everything is up to date.  my
db_config uses mysqli.

any ideas?  thanks in advance for response.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Problems w/ Commentia Behavior

2009-07-04 Thread Kyle Decot

I'm attempting to implement the Commentia Behavior into my website but
I'm having some problems. When I submit/save a comment, the comment is
saved to the comments table and then it precedes to insert blank rows
until it runs out of memory. Any ideas of why this is happening?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Forms with multiple tables

2009-07-04 Thread Hendry

Hi Travis,

Please read http://book.cakephp.org/view/438/displayField

Regards,
Hendry

On Sun, Jul 5, 2009 at 7:36 AM, Travis wrote:
> Thanks, That worked.
>
> I have one more question, is there a way I can tell it what field to
> put in the select, right now it is using the field "name" and I would
> like it to use the field "common_name" since as you can figure out
> common name is what we call it, as apposed to the government assigned
> name.
>
> Travis

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Forms with multiple tables

2009-07-04 Thread Travis

Thanks, That worked.

I have one more question, is there a way I can tell it what field to
put in the select, right now it is using the field "name" and I would
like it to use the field "common_name" since as you can figure out
common name is what we call it, as apposed to the government assigned
name.

Travis

On Jul 3, 10:13 pm, "Paul"  wrote:
> Sorry last post sent in error
>
> So you have your view with some fields in it, including your forign key -
> here assuming farm_id
>
> views/fields/add.ctp
>
> create('Field')?>
> input('name')?>
> input('another')?>
> input('yet_another')?>
> input('farm_id')?>
> end('Submit')?>
>
> And in your controller action add ( as long as you have your association set
> up correctly which we'll assume you do as you mention it)
>
> controllers/fields_controller.php
>
> function add(){
> ~
>         $this->set('farms', $this->Field->Farm->find('list'));
>
> }
>
> This will set values to your view that the form helper will automatically
> pick up and set as the values of your Field.farm_id input - which will
> become a select.
>
>
>
> -Original Message-
> From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf
>
> Of Travis
> Sent: Saturday, 4 July 2009 3:34 a.m.
> To: CakePHP
> Subject: Forms with multiple tables
>
> I am new to cakePHP and am in the process of learning to use it.
>
> I am wondering how I can have a form element populated with elements
> from a different table than the model, for example
>
> I am wanting to write a farm manager using cakePHP as the framework,
> if I have fields that belong to farms, when you create a new field I
> want to be able to select from a list of farms, and have it link
> (insert farm's id as a foreign key), I have currently setup my
> belongsto relationship so I can view but I cannot add.
>
> my original thought was to create a $options array and just loop
> through the table, but I cannot do that if I do not have access to the
> farms table.
>
> Help!
>
> __ Information from ESET NOD32 Antivirus, version of virus signature
> database 4214 (20090703) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> __ Information from ESET NOD32 Antivirus, version of virus signature
> database 4215 (20090704) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: jquery cakephp post data problem

2009-07-04 Thread stZen

Thanks for responding. I tried that and
changed the controller to

$this->log("getindicator called".$this->data['ajax']);

but didnt change anything.

On Jul 4, 3:31 pm, Miles J  wrote:
> Try changing this:
>
> data: "ajax=true&id="+selected,
>
> To:
>
> data: "data[ajax]=true&data[id]="+selected,
>
> And then you can grab the data with $this->data['ajax'];
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: jquery cakephp post data problem

2009-07-04 Thread Miles J

Try changing this:

data: "ajax=true&id="+selected,

To:

data: "data[ajax]=true&data[id]="+selected,

And then you can grab the data with $this->data['ajax'];
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread eMilk

Hi - using that line doesn't work either. So did I mess up with the
AuthComponent implementation then?
The Auth implementation is based heavily on what I could read up on
here: 
http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-auth-users-habtm-groups-cakephp

When looking at the 'username' field in my 'posts' table, all the
posts I tried (including the one with the modification you suggested)
turns out as NULL.
http://imgur.com/NfwUY.png - see.

On Jul 4, 9:35 pm, Hendry  wrote:
> Hi,
>
> That's weird, could you test using this line, just to make sure you
> implement the AuthComponent correctly:
>
> $this->data['Post']['username'] = 'Hendry';
>
> Regards,
> Hendry
>
> On Sun, Jul 5, 2009 at 3:28 AM, eMilk wrote:
> > Hi Hendry,
>
> > Thanks - didn't fix it though - still no data being added to the
> > 'username' field automatically yet. :(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Write to log table for every successful update/delete

2009-07-04 Thread Hendry

THanks Chris, I'm testing it now ;)

Regards,
Hendry

On Sat, Jul 4, 2009 at 6:25 AM, BlueC wrote:
> You could use the logablebehavior I have used it and it is really
> excellent!! It even integrates with auth component so you can log and
> see who did what. It can also log inserts too.
>
> http://code.google.com/p/alkemann/wiki/LogableBehavior
> http://bakery.cakephp.org/articles/view/logablebehavior
>
> Enjoy!
>
> Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread Hendry

Hi,

should be Post not Posts:

$this->data['Post']['username'] = $this->Auth->user('username');

Regards,
Hendry

On Sun, Jul 5, 2009 at 2:58 AM, eMilk wrote:
> This is my PostsController::add():
>        function add() {
>                        if (!empty($this->data)) {
>                                $this->data['Posts']['username'] = 
> $this->Auth->user
> ('username');
>                        if  ($this->Post->save($this->data)) {
>                                $this->Session->setFlash('Your robot has been 
> saved.');
>                                $this->redirect(array('action' => 'index'));
>                        }
>                }
>        }

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread Hendry

Hi,

That's weird, could you test using this line, just to make sure you
implement the AuthComponent correctly:

$this->data['Post']['username'] = 'Hendry';

Regards,
Hendry



On Sun, Jul 5, 2009 at 3:28 AM, eMilk wrote:
> Hi Hendry,
>
> Thanks - didn't fix it though - still no data being added to the
> 'username' field automatically yet. :(

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread fain182

>> > This is my PostsController::add():
>> >        function add() {
>> >                        if (!empty($this->data)) {
>> >                                $this->data['Posts']['username'] = 
>> > $this->Auth->user
>> > ('username');
>> >                        if  ($this->Post->save($this->data)) {
>> >                                $this->Session->setFlash('Your robot has 
>> > been saved.');
>> >                                $this->redirect(array('action' => 'index'));
>> >                        }
>> >                }
>> >        }
I think you should place
  $this->data['Post']['username'] = $this->Auth->user
after the post->save...

-- 
pietro

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: posts not appearing

2009-07-04 Thread Gwoo

Please read the about page: http://groups.google.com/group/cake-php/about
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread eMilk

Hi Hendry,

Thanks - didn't fix it though - still no data being added to the
'username' field automatically yet. :(

On Jul 4, 9:21 pm, Hendry  wrote:
> Hi,
>
> should be Post not Posts:
>
> $this->data['Post']['username'] = $this->Auth->user('username');
>
> Regards,
> Hendry
>
> On Sun, Jul 5, 2009 at 2:58 AM, eMilk wrote:
> > This is my PostsController::add():
> >        function add() {
> >                        if (!empty($this->data)) {
> >                                $this->data['Posts']['username'] = 
> > $this->Auth->user
> > ('username');
> >                        if  ($this->Post->save($this->data)) {
> >                                $this->Session->setFlash('Your robot has 
> > been saved.');
> >                                $this->redirect(array('action' => 'index'));
> >                        }
> >                }
> >        }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Whether cakephp server dependent

2009-07-04 Thread Gwoo

Leaving the salt blank would be bad idea as you would be making
hashing less secure. Just change the value to something other than the
default because leaving the default would be as insecure as leaving it
blank.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Baking. First day at cake

2009-07-04 Thread Gwoo

You are not supposed to call the scripts directly. Please see the
documentation for the proper usage. Also checkout http://cakephp.org/screencasts
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



posts not appearing

2009-07-04 Thread deshane joseph
Hi I added couple of new posts, but they have not appeared (about an hour
ago) . Is there a delay in messages showing up?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



jquery cakephp post data problem

2009-07-04 Thread stZen

I am trying to get a simple example working integrating jquery with
cakephp.

here is the view:


create('Booking',array('class'=>'ajax_page'));
 echo $form->input('country_id',array(
'label'=>'Country')) ;

   echo $form->end();
   ?>

The javascript:


$('#BookingCountryId').blur(function(){

// selected value
var selected = $(this).val();
// set loading image
//ajax_loading_image('.ajax_loading_image');
// ajax
$.ajax({
type: "POST",
url: 'categories/getIndications',
data: "ajax=true&id="+selected,
success: function(msg){
//console.log(msg);
//$('.ajax_location_id').html(msg);
// remove loading image
   // ajax_remove_loading_image
('.ajax_loading_image');
}
});
});

and the controller:

class CategoriesController extends AppController
{
   var $uses =  "Indication";
   var $components = array("RequestHandler");

function getIndications() {

$this->log("getindicator called".$this->params['form']['id']);

return "ind1";
}
}


The problem is that the function getIndications get called, but $this->
['form']['id'] doesnt contain the submitted
value. What am I doing wrong?

Thanks.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread eMilk

Alright, after some messing around, I cant seem to work this thing
out. I've attached some dumps:

My 'posts' table, after running the
  ALTER TABLE ORDERS
  ADD FOREIGN KEY (`username`) REFERENCES users(`username`);
command:

-
CREATE TABLE `posts` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `created` datetime default NULL,
  `username` varchar(50) default NULL,
  `name` varchar(15) NOT NULL,
  `year` date NOT NULL,
  `country` varchar(12) NOT NULL,
  `origin` varchar(40) NOT NULL,
  `video` varchar(60) NOT NULL,
  `picture` varchar(100) NOT NULL,
  `text` text NOT NULL,
  `rating` varchar(3) NOT NULL,
  `keywords` varchar(100) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `username` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;


-- Dumping data for table `posts`

INSERT INTO `posts` VALUES(1, '1984-10-26 00:00:00', 'Me', 'R2-D2',
'1977-05-25', 'USA', 'Star Wars', 'http://www.youtube.com/watch?
v=gQCWV4vuz', 'http://localhost/images/r2d2.jpg', 'R2-D2 (phonetically
spelled Artoo-Detoo)', '02', 'cyborg, assassin, military, war');

The 'posts' data is just some dummy data I typed in manually..

This is my PostsController::add():
function add() {
if (!empty($this->data)) {
$this->data['Posts']['username'] = 
$this->Auth->user
('username');
if  ($this->Post->save($this->data)) {
$this->Session->setFlash('Your robot has been 
saved.');
$this->redirect(array('action' => 'index'));
}
}
}


And just in case, here's my users table:
CREATE TABLE `users` (
  `id` int(11) NOT NULL auto_increment,
  `username` char(50) NOT NULL,
  `password` char(50) NOT NULL,
  `active` tinyint(4) NOT NULL default '0',
  `email` varchar(255) NOT NULL,
  `created` datetime default NULL,
  `modified` datetime default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;

Thanks again - I really hope you can tell me where I've made a
mistake.


On Jul 4, 8:00 pm, eMilk  wrote:
> Hi Brian,
>
> Thanks - will try that out right away! :)
>
> On Jul 4, 7:12 pm, brian  wrote:
>
> > Add a user_id column to the posts table. You should use that as your
> > foreign key.
>
> > As for filling it in automatically, you can do that right before
> > save() in PostsController::add()
>
> > $this->data['Posts']['user_id'] = $this->Auth->user('id');
>
> > On Sat, Jul 4, 2009 at 12:55 PM, eMilk wrote:
>
> > > Hi all you experienced bakers.
>
> > > I'm new to the world of CakePHP, so forgive me if this is a very basic
> > > question.
> > > I followed a few tutorials, and have a question about getting
> > > information filled automagically into the different fields of the
> > > table.
>
> > > First off, I extended the blog tutorial with a simple implementation
> > > of Auth, based heavily on what I could find here:
> > >http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-aut...
>
> > > Then, I've extended on the blog tutorial, and have been adding new
> > > fields to the "posts" table from the example. One of the new fields, I
> > > created is 'username'.
>
> > > Here's the deal: I'd really like to have the 'username' field being
> > > filled automagically based on what user is logged in, just like it
> > > does to both the 'modified' and 'created' fields by default in the
> > > blog-tutorial.
>
> > > From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database]
> > > "Check out "CakePHP Conventions" for more information, but suffice it
> > > to say that naming our table 'posts' automatically hooks it to our
> > > Post model, and having fields called 'modified' and 'created' will be
> > > automagically managed by Cake."
>
> > > Thanks in advance!
> > > Best regards,
> > > Emil K
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread eMilk

Hi Brian,

Thanks - will try that out right away! :)

On Jul 4, 7:12 pm, brian  wrote:
> Add a user_id column to the posts table. You should use that as your
> foreign key.
>
> As for filling it in automatically, you can do that right before
> save() in PostsController::add()
>
> $this->data['Posts']['user_id'] = $this->Auth->user('id');
>
> On Sat, Jul 4, 2009 at 12:55 PM, eMilk wrote:
>
> > Hi all you experienced bakers.
>
> > I'm new to the world of CakePHP, so forgive me if this is a very basic
> > question.
> > I followed a few tutorials, and have a question about getting
> > information filled automagically into the different fields of the
> > table.
>
> > First off, I extended the blog tutorial with a simple implementation
> > of Auth, based heavily on what I could find here:
> >http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-aut...
>
> > Then, I've extended on the blog tutorial, and have been adding new
> > fields to the "posts" table from the example. One of the new fields, I
> > created is 'username'.
>
> > Here's the deal: I'd really like to have the 'username' field being
> > filled automagically based on what user is logged in, just like it
> > does to both the 'modified' and 'created' fields by default in the
> > blog-tutorial.
>
> > From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database]
> > "Check out "CakePHP Conventions" for more information, but suffice it
> > to say that naming our table 'posts' automatically hooks it to our
> > Post model, and having fields called 'modified' and 'created' will be
> > automagically managed by Cake."
>
> > Thanks in advance!
> > Best regards,
> > Emil K
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Accessing name of the current plugin from inside a model

2009-07-04 Thread Pixelastic

Hello,

I would have wanted to know if there is a way to find the name of the
actual plugin being executed from inside a model method (this model
being part of the plugin).

Here is my setup : I have a plugin containing a model, a view and a
controller. When inside the view or the controller I can access the
actual plugin with $this->plugin and $this->params['plugin'] but I
can't find a way to access this same information from the model scope.

I need this information because I'm working with I18n and I'm
splitting my translations into different .mo/.po files, named
according to the plugin name. And I have some translation occuring in
the __construct() method of my model and can't find a way to
automatically detect the plugin name.

Thanks in advance for any pointers
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automagically filling table-fields?

2009-07-04 Thread brian

Add a user_id column to the posts table. You should use that as your
foreign key.

As for filling it in automatically, you can do that right before
save() in PostsController::add()

$this->data['Posts']['user_id'] = $this->Auth->user('id');

On Sat, Jul 4, 2009 at 12:55 PM, eMilk wrote:
>
> Hi all you experienced bakers.
>
> I'm new to the world of CakePHP, so forgive me if this is a very basic
> question.
> I followed a few tutorials, and have a question about getting
> information filled automagically into the different fields of the
> table.
>
> First off, I extended the blog tutorial with a simple implementation
> of Auth, based heavily on what I could find here:
> http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-auth-users-habtm-groups-cakephp
>
> Then, I've extended on the blog tutorial, and have been adding new
> fields to the "posts" table from the example. One of the new fields, I
> created is 'username'.
>
> Here's the deal: I'd really like to have the 'username' field being
> filled automagically based on what user is logged in, just like it
> does to both the 'modified' and 'created' fields by default in the
> blog-tutorial.
>
> From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database]
> "Check out "CakePHP Conventions" for more information, but suffice it
> to say that naming our table 'posts' automatically hooks it to our
> Post model, and having fields called 'modified' and 'created' will be
> automagically managed by Cake."
>
> Thanks in advance!
> Best regards,
> Emil K
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Whether cakephp server dependent

2009-07-04 Thread Vijay Kumbhar
Hello Boobalan,

I had got the same problem.
Please delete the security salt & leave it blank. It will work.


On Sat, Jul 4, 2009 at 5:08 PM, boobalan  wrote:

>
> Hi to all ,
>  Friends whether the installation or development is web/
> application server dependent.
> Bcoz, i've came across some problems like
> 1. I've installed cakePHP in EasyPHP , it works fine until i extend DB
> connection.
> 2. After it says 1024 error, in security salt. No DB connection
> extended-even though i have created DB schema.
> These all overcome when i use WAMP server. Y this
>
> Thanks
> Boobalan.M
>
> >
>


-- 
Thanks & Regards,
Vijayk.
Co-founder (www.weboniselab.com)

"You Bring the Dreams, We'll Bring the Means"

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Automagically filling table-fields?

2009-07-04 Thread eMilk

Hi all you experienced bakers.

I'm new to the world of CakePHP, so forgive me if this is a very basic
question.
I followed a few tutorials, and have a question about getting
information filled automagically into the different fields of the
table.

First off, I extended the blog tutorial with a simple implementation
of Auth, based heavily on what I could find here:
http://mrphp.com.au/code/code-category/cakephp/cakephp-1-2/simple-auth-users-habtm-groups-cakephp

Then, I've extended on the blog tutorial, and have been adding new
fields to the "posts" table from the example. One of the new fields, I
created is 'username'.

Here's the deal: I'd really like to have the 'username' field being
filled automagically based on what user is logged in, just like it
does to both the 'modified' and 'created' fields by default in the
blog-tutorial.

>From the blog-tutorial, bottom: [10.1.2 Creating the Blog Database]
"Check out "CakePHP Conventions" for more information, but suffice it
to say that naming our table 'posts' automatically hooks it to our
Post model, and having fields called 'modified' and 'created' will be
automagically managed by Cake."

Thanks in advance!
Best regards,
Emil K

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Form Validation: Opposite of EqualTo (NotEqualTo, Does Not Equal)

2009-07-04 Thread jperras

http://book.cakephp.org/view/139/comparison

-j.

On Jul 2, 5:13 pm, hoyos  wrote:
> Hey,
>
> Simple question, is there a built-in form validation function to
> validate that a field DOES NOT EQUAL a certain value?
>
> For example: 'password' => array( 'rule' => array('notEqualTo',
> 'password'), 'message'=>'Please choose a more unique password.');
>
> Thanks,
> Andy
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Whether cakephp server dependent

2009-07-04 Thread boobalan

Hi to all ,
  Friends whether the installation or development is web/
application server dependent.
Bcoz, i've came across some problems like
1. I've installed cakePHP in EasyPHP , it works fine until i extend DB
connection.
2. After it says 1024 error, in security salt. No DB connection
extended-even though i have created DB schema.
These all overcome when i use WAMP server. Y this

Thanks
Boobalan.M

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Baking. First day at cake

2009-07-04 Thread Taff

Hopefully someone can help me. I am trying to follow the acl tutorial,
and due to my lack of experience with CAKE have come to a standstill.
I have no prior knowledge of putty or other things like that, so as
you can imagine, it has been quite a learning curve. I have dabbled in
other frameworks such as CodeIgniter with a reasonible amount of
success.

When I call mycakeapp/cake/console/libs/bake.php I get the following
error.


Fatal error: Class bakeshell:  Cannot inherit from undefined class
shell in /var/www/www.softselect.de/www-data/live/cake/mycakeapp/cake/
console/libs/bake.php

I read that that was because my paths weren't defined correctly, but
where can I define them? I looked in the config files to no avail. I'm
not sure if I should be amending on the the "Current Paths" below, and
would appreciate any help!

Thanks,
Taff

Welcome to CakePHP v1.2.1.8004 Console
---
Current Paths:
 -app: app
 -working: /path/to/cake/mycakeapp/app
 -root: /path/to/cake/mycakeapp
 -core: /path/to/cake/mycakeapp

Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp

Available Shells:

 CORE/app/vendors/shells:
- none

 CORE/vendors/shells:
- none

 CORE/cake/console/libs:
acl
api
bake
console
i18n
schema
testsuite

To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'
softsel...@softselect:~/path/to/cake/mycakeapp/cake/console$
cake bake help
-bash: cake: command not found
softsel...@softselect:~/path/to/cake/mycakeapp/cake/console$

Fatal error: Class bakeshell:  Cannot inherit from undefined class
shell in /path/to/cake/mycakeapp/cake/console/libs/bake.php

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Count RS for element

2009-07-04 Thread bramu...@gmail.com

I am new to Cake PHP but I can give you the sql to get the count


select count(*), maincategory
from maincategories mc, subcategories sc, recipes_subcategories rsc
where mc.id = sc.maincategory_id
AND sc.id = rsc.subcategory_id
AND mc.id = $this->params["category_id"]
group by mc.id


Thanks,
Ramu.


On Jul 3, 8:25 pm, Luke  wrote:
> Hi,
>
> I have the following issue where I am a bit stuck. I have 3 tables
>
> maincategories
> - id
> - maincategory
>
> subcategories
> - id
> - subcategory
> - maincategory_id
>
> recipes_subcategories
> - id
> - recipe_id
> - subcategory_id
>
> The Maincategories are shown as a Navigation. I created an element for
> this. Everything works fine. The next step I would like to achieve is
> to count the amount of recipes for each maincategory.
>
> Right now I use this code in my maincategories_controller:
>
> if(isset($this->params['requested'])) {
>      return $this->Maincategory->find('all', array('order'=>array
> ('Maincategory'=>'asc'), 'recursive' => 0));
>
> }
>
> How do I get the amount of recipes shown with my above Database
> struktur? Could someone give me a hint? I am pretty stuck with it and
> can't think of a solution. Thank you very much in advance.
>
> Regards Luke

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---