Re: Newbie question: Disable Cache

2012-01-26 Thread rocha9000
This issue has been resolved. It turned out to be my webhost caching the 
generated cache files. 

-- 
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: newbie question about weird legacy database schema

2011-08-01 Thread hxc
This link should give you all the information you need:

http://book.cakephp.org/#!/view/1039/Associations-Linking-Models-Together

On Jul 31, 5:08 pm, ubiquitous_tom  wrote:
> here's the current schema of my database
>
> /* First, create our thread table: */
> CREATE TABLE thread (
>     id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
>     dat_id INT,
>     title VARCHAR(50),
>     body TEXT,
>     created DATETIME DEFAULT NULL,
>     modified DATETIME DEFAULT NULL
> );
>
> CREATE TABLE dat_001 (
>     id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
>     thread_id INT,
>     title VARCHAR(50),
>     body TEXT,
>     created DATETIME DEFAULT NULL,
>     modified DATETIME DEFAULT NULL
> );
>
> CREATE TABLE dat_002 (
>     id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
>     thread_id INT,
>     title VARCHAR(50),
>     body TEXT,
>     created DATETIME DEFAULT NULL,
>     modified DATETIME DEFAULT NULL
> );
>
> and so on
>
> I know that this is not exactly how the cakephp database would be but
> i am a newbie at this and i would like to know
> how do i code this kinda relationship on cakephp. how do I do 1 to
> many relationship in cakephp.
> I know i can do this in codeigniter and that's what i used to use but
> I have to start workin on cakephp and i have found it to be quite good
> but run into this kinda problem
> so if anyone can help guide me toward to right way of doing this
> please let me know.

-- 
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: newbie question about databases

2011-07-31 Thread dewolfe001
Thanks, Simon! That did the trick!

- Mike

On Jul 31, 3:46 pm, Simon Males  wrote:
> On Mon, Aug 1, 2011 at 5:25 AM, dewolfe001  wrote:
> > Is there a way that I can generate app/config/schema PHP files from
> > the SQL or MySQL database tables? I tried "cake schema generate node"
> > from the console (node being the name of the table I wanted to pick
> > up). But that just gives me the "blogs" table that ships as an example
> > in CakePHP.
>
> The following command will dump the whole schema by looking at the DB,
> rather then the models.
>
> cake schema generate -f
>
> --
> Simon Males

-- 
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: newbie question about databases

2011-07-31 Thread Simon Males
On Mon, Aug 1, 2011 at 5:25 AM, dewolfe001  wrote:
> Is there a way that I can generate app/config/schema PHP files from
> the SQL or MySQL database tables? I tried "cake schema generate node"
> from the console (node being the name of the table I wanted to pick
> up). But that just gives me the "blogs" table that ships as an example
> in CakePHP.

The following command will dump the whole schema by looking at the DB,
rather then the models.

cake schema generate -f

-- 
Simon Males

-- 
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: Newbie Question - Controller Model Binding

2011-07-07 Thread Gary Herman
It was in a book I grabbed recently called "Beginning CakePHP: From Novice
to Professional".

Gary Herman
831.454.0850 x.13 (Office)


-Original Message-
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of euromark
Sent: Wednesday, July 06, 2011 8:05 AM
To: CakePHP
Subject: Re: Newbie Question - Controller Model Binding

where did you find that?
sounds totally wrong to be. but i would need to see the source in order to
tell you if its worthy to read.

you usually create
- model
- controller
- views
in this order (using the baking tools this is quite comfortable)


it is as alive as is gets :)
of course you turn up old results as the framework is already in existance
for quite some time and some issues from the past are cake1 oder cake1.2
related

nowadays with cake1.3 there might be other new issues - or the same ones in
a slightly different way


On 5 Jul., 20:37, gavrielh  wrote:
> Just jumping into CakePHP and while I've gotten quite deep in the code 
> already, awesome by the way, I found one article that threw me for a 
> loop.  Basically it suggested that one should only create controllers 
> for database tables and for nothing else.  This seems a bit strange, 
> why would I not be able to create a controller for a backend class or 
> something not directly tied to the model?
>
> Also, on a side note - I notice that a lot of my searches on Google 
> for CakePHP related topics return very old posts - is CakePHP still 
> alive and well?

--
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 
cake-php+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: Newbie Question - Controller Model Binding

2011-07-06 Thread euromark
where did you find that?
sounds totally wrong to be. but i would need to see the source in
order to tell you if its worthy to read.

you usually create
- model
- controller
- views
in this order (using the baking tools this is quite comfortable)


it is as alive as is gets :)
of course you turn up old results as the framework is already in
existance for quite some time
and some issues from the past are cake1 oder cake1.2 related

nowadays with cake1.3 there might be other new issues - or the same
ones in a slightly different way


On 5 Jul., 20:37, gavrielh  wrote:
> Just jumping into CakePHP and while I've gotten quite deep in the code
> already, awesome by the way, I found one article that threw me for a
> loop.  Basically it suggested that one should only create controllers
> for database tables and for nothing else.  This seems a bit strange,
> why would I not be able to create a controller for a backend class or
> something not directly tied to the model?
>
> Also, on a side note - I notice that a lot of my searches on Google
> for CakePHP related topics return very old posts - is CakePHP still
> alive and well?

-- 
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: newbie question - how to I find this particular value so I can pass it on via a redirect

2011-05-09 Thread barricades
Hey, that worked perfectly, thanks for the help :)

On May 8, 9:27 pm, dreamingmind  wrote:
> Barricades,
>
> I think your concern about the beforeSave/afterSave issues are red
> herrings. Since the first line of your code is:
>  if ($this->Campaign->save($this->data)) {  ...
> both the before and after are finished. And you are only getting
> inside the 'if' statement when the save was successful. Of course, in
> that case the slug exists but it isn't available in the way you are
> trying to get to it. That's why I suggested searching on the returned
> id of the created record. That will get you the slug value to pass on
> through to your redirect. To prove it to yourself, modify the if
> statement to read:
>
> if ($this->Campaign->save($this->data)) {
>  debug($this->Campaign->findById($this->Campaign->id,array('fields'=>'slug')));
>
>  die;
> ...
>
> }
>
> So using the find statement I've shown you in the debug function
> (above) you could do this:
>
> if ($this->Campaign->save($this->data)) {
>    $new_record = $this->Campaign->findById(
>         $this->Campaign->id,
>         array('fields'=>'slug')
>   );
>    $this->redirect(array(
>         'action' => 'view',
>         $new_record['Campaign']['slug']
>   ));
>
> } else {
>    
> }
>
> Regards,
> Don
>
> On May 8, 4:59 am, barricades  wrote:
>
>
>
>
>
>
>
> > Thanks for the reply :)
>
> > The find after the save isn't returning what I want it to. In fact I'm
> > not sure it's returning anything at all. Baring in mind I'm a total
> > newbie (not even that much of a php'er either yet) what I want it
> > simply somehow (what I've done is just my best guess - I've no idea
> > how to do this at all) to make it so that when I save a new Campaign,
> > if it's successful, it redirects to a view action and passes along the
> > slug, as a string I guess would be best(?), so that I can show the
> > details of the newly created Campaign on in the view.ctp.
>
> > The caveat being that I'm using sluggable behaviour which creates the
> > slug in a beforeSave and therefore the $slug to be passed on to the
> > view function has to be created after the save.
>
> > I hope that makes sense.
>
> > On May 8, 3:08 am, dreamingmind  wrote:
>
> > > Barricades,
>
> > > You don't really say WHERE the process seems to break down. The find
> > > after the save seems suspicious to me. Is that returning the proper
> > > slug to pass along to your view function? It looks like $slug will end
> > > up holding the returned data array rather than the returned string
> > > from the slug field (see below for more info)
>
> > > You might take advantage of the fact that the id property of the model
> > > is set to the id of the record that was created by save. So you should
> > > be able to set your slug value properly after:
>
> > > $this->Campaign->findById($this->Campaign-
>
> > > >id,,array('fields'=>'slug'));
>
> > > But you should also be aware that this will not return the slug field
> > > directly. It's going to be in the usual data array:
>
> > > Array
> > > (
> > >     [Campaign] => Array
> > >         (
> > >             [slug] => My_crazy_slug
> > >         )
> > > )
>
> > > Regards,
> > > Don
>
> > > On May 7, 9:22 am, barricades  wrote:
>
> > > > Hi, I'm new so please don't shout at me for the stupid question but...
>
> > > > When I save a record I want to redirect straight to the record I just
> > > > created. The record which I have just created uses sluggable behaviour
> > > > to create a slug in a beforeSave, so I can't just use 
> > > > $this->data['Campaign]['slug'] as it doesn't exist before I save my
>
> > > > campaign.
>
> > > > in my add function I've got:
>
> > > > 
> > > > if ($this->Campaign->save($this->data)) {
> > > >         $slug = $this->Campaign->find('first', array('fields' =>
> > > > 'Campaign.slug'));
> > > >         $this->redirect(array('action' => 'view', $slug));
> > > >         } else {
> > > >         $this->Session->setFlash(__('The campaign could not be saved. 
> > > > Please,
> > > > try again.', true));}
>
> > > > 
>
> > > > and then
>
> > > > 
> > > > function view($slug) {
> > > >         $campaign = $this->Campaign->find('first',
> > > > array('conditions'=>array('Campaign.slug'=>$slug), 'recursive'=>-1));
> > > >         $this->set(compact('campaign'));
> > > >         }
> > > > 
>
> > > > but that ain't working. I've tried a couple of other ways but I'm a
> > > > bit stumped.
>
> > > > How do I get the value that's in the slug column for the Campaign
> > > > which has just been saved and pass it on to the view function so that
> > > > I can display the right Campaign?
>
> > > > thanks in advance :)

-- 
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://

Re: newbie question - how to I find this particular value so I can pass it on via a redirect

2011-05-08 Thread BAIMA

$this->redirect(array('action' => 'view', 'id' => $slug));

hth... Claudio


On 7 maio, 13:22, barricades  wrote:
> Hi, I'm new so please don't shout at me for the stupid question but...
>
> When I save a record I want to redirect straight to the record I just
> created. The record which I have just created uses sluggable behaviour
> to create a slug in a beforeSave, so I can't just use 
> $this->data['Campaign]['slug'] as it doesn't exist before I save my
>
> campaign.
>
> in my add function I've got:
>
> 
> if ($this->Campaign->save($this->data)) {
>         $slug = $this->Campaign->find('first', array('fields' =>
> 'Campaign.slug'));
>         $this->redirect(array('action' => 'view', $slug));
>         } else {
>         $this->Session->setFlash(__('The campaign could not be saved. Please,
> try again.', true));}
>
> 
>
> and then
>
> 
> function view($slug) {
>         $campaign = $this->Campaign->find('first',
> array('conditions'=>array('Campaign.slug'=>$slug), 'recursive'=>-1));
>         $this->set(compact('campaign'));
>         }
> 
>
> but that ain't working. I've tried a couple of other ways but I'm a
> bit stumped.
>
> How do I get the value that's in the slug column for the Campaign
> which has just been saved and pass it on to the view function so that
> I can display the right Campaign?
>
> thanks in advance :)

-- 
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: newbie question - how to I find this particular value so I can pass it on via a redirect

2011-05-08 Thread dreamingmind
Barricades,

I think your concern about the beforeSave/afterSave issues are red
herrings. Since the first line of your code is:
 if ($this->Campaign->save($this->data)) {  ...
both the before and after are finished. And you are only getting
inside the 'if' statement when the save was successful. Of course, in
that case the slug exists but it isn't available in the way you are
trying to get to it. That's why I suggested searching on the returned
id of the created record. That will get you the slug value to pass on
through to your redirect. To prove it to yourself, modify the if
statement to read:

if ($this->Campaign->save($this->data)) {
 debug($this->Campaign->findById($this->Campaign-
>id,array('fields'=>'slug')));
 die;
...
}

So using the find statement I've shown you in the debug function
(above) you could do this:

if ($this->Campaign->save($this->data)) {
   $new_record = $this->Campaign->findById(
$this->Campaign->id,
array('fields'=>'slug')
  );
   $this->redirect(array(
'action' => 'view',
$new_record['Campaign']['slug']
  ));
} else {
   
}

Regards,
Don

On May 8, 4:59 am, barricades  wrote:
> Thanks for the reply :)
>
> The find after the save isn't returning what I want it to. In fact I'm
> not sure it's returning anything at all. Baring in mind I'm a total
> newbie (not even that much of a php'er either yet) what I want it
> simply somehow (what I've done is just my best guess - I've no idea
> how to do this at all) to make it so that when I save a new Campaign,
> if it's successful, it redirects to a view action and passes along the
> slug, as a string I guess would be best(?), so that I can show the
> details of the newly created Campaign on in the view.ctp.
>
> The caveat being that I'm using sluggable behaviour which creates the
> slug in a beforeSave and therefore the $slug to be passed on to the
> view function has to be created after the save.
>
> I hope that makes sense.
>
> On May 8, 3:08 am, dreamingmind  wrote:
>
>
>
>
>
>
>
> > Barricades,
>
> > You don't really say WHERE the process seems to break down. The find
> > after the save seems suspicious to me. Is that returning the proper
> > slug to pass along to your view function? It looks like $slug will end
> > up holding the returned data array rather than the returned string
> > from the slug field (see below for more info)
>
> > You might take advantage of the fact that the id property of the model
> > is set to the id of the record that was created by save. So you should
> > be able to set your slug value properly after:
>
> > $this->Campaign->findById($this->Campaign-
>
> > >id,,array('fields'=>'slug'));
>
> > But you should also be aware that this will not return the slug field
> > directly. It's going to be in the usual data array:
>
> > Array
> > (
> > [Campaign] => Array
> > (
> > [slug] => My_crazy_slug
> > )
> > )
>
> > Regards,
> > Don
>
> > On May 7, 9:22 am, barricades  wrote:
>
> > > Hi, I'm new so please don't shout at me for the stupid question but...
>
> > > When I save a record I want to redirect straight to the record I just
> > > created. The record which I have just created uses sluggable behaviour
> > > to create a slug in a beforeSave, so I can't just use 
> > > $this->data['Campaign]['slug'] as it doesn't exist before I save my
>
> > > campaign.
>
> > > in my add function I've got:
>
> > > 
> > > if ($this->Campaign->save($this->data)) {
> > > $slug = $this->Campaign->find('first', array('fields' =>
> > > 'Campaign.slug'));
> > > $this->redirect(array('action' => 'view', $slug));
> > > } else {
> > > $this->Session->setFlash(__('The campaign could not be saved. 
> > > Please,
> > > try again.', true));}
>
> > > 
>
> > > and then
>
> > > 
> > > function view($slug) {
> > > $campaign = $this->Campaign->find('first',
> > > array('conditions'=>array('Campaign.slug'=>$slug), 'recursive'=>-1));
> > > $this->set(compact('campaign'));
> > > }
> > > 
>
> > > but that ain't working. I've tried a couple of other ways but I'm a
> > > bit stumped.
>
> > > How do I get the value that's in the slug column for the Campaign
> > > which has just been saved and pass it on to the view function so that
> > > I can display the right Campaign?
>
> > > thanks in advance :)

-- 
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: newbie question - how to I find this particular value so I can pass it on via a redirect

2011-05-08 Thread barricades
Thanks for the reply :)

The find after the save isn't returning what I want it to. In fact I'm
not sure it's returning anything at all. Baring in mind I'm a total
newbie (not even that much of a php'er either yet) what I want it
simply somehow (what I've done is just my best guess - I've no idea
how to do this at all) to make it so that when I save a new Campaign,
if it's successful, it redirects to a view action and passes along the
slug, as a string I guess would be best(?), so that I can show the
details of the newly created Campaign on in the view.ctp.

The caveat being that I'm using sluggable behaviour which creates the
slug in a beforeSave and therefore the $slug to be passed on to the
view function has to be created after the save.

I hope that makes sense.



On May 8, 3:08 am, dreamingmind  wrote:
> Barricades,
>
> You don't really say WHERE the process seems to break down. The find
> after the save seems suspicious to me. Is that returning the proper
> slug to pass along to your view function? It looks like $slug will end
> up holding the returned data array rather than the returned string
> from the slug field (see below for more info)
>
> You might take advantage of the fact that the id property of the model
> is set to the id of the record that was created by save. So you should
> be able to set your slug value properly after:
>
> $this->Campaign->findById($this->Campaign-
>
> >id,,array('fields'=>'slug'));
>
> But you should also be aware that this will not return the slug field
> directly. It's going to be in the usual data array:
>
> Array
> (
>     [Campaign] => Array
>         (
>             [slug] => My_crazy_slug
>         )
> )
>
> Regards,
> Don
>
> On May 7, 9:22 am, barricades  wrote:
>
>
>
>
>
>
>
> > Hi, I'm new so please don't shout at me for the stupid question but...
>
> > When I save a record I want to redirect straight to the record I just
> > created. The record which I have just created uses sluggable behaviour
> > to create a slug in a beforeSave, so I can't just use 
> > $this->data['Campaign]['slug'] as it doesn't exist before I save my
>
> > campaign.
>
> > in my add function I've got:
>
> > 
> > if ($this->Campaign->save($this->data)) {
> >         $slug = $this->Campaign->find('first', array('fields' =>
> > 'Campaign.slug'));
> >         $this->redirect(array('action' => 'view', $slug));
> >         } else {
> >         $this->Session->setFlash(__('The campaign could not be saved. 
> > Please,
> > try again.', true));}
>
> > 
>
> > and then
>
> > 
> > function view($slug) {
> >         $campaign = $this->Campaign->find('first',
> > array('conditions'=>array('Campaign.slug'=>$slug), 'recursive'=>-1));
> >         $this->set(compact('campaign'));
> >         }
> > 
>
> > but that ain't working. I've tried a couple of other ways but I'm a
> > bit stumped.
>
> > How do I get the value that's in the slug column for the Campaign
> > which has just been saved and pass it on to the view function so that
> > I can display the right Campaign?
>
> > thanks in advance :)

-- 
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: newbie question - how to I find this particular value so I can pass it on via a redirect

2011-05-07 Thread dreamingmind
Barricades,

You don't really say WHERE the process seems to break down. The find
after the save seems suspicious to me. Is that returning the proper
slug to pass along to your view function? It looks like $slug will end
up holding the returned data array rather than the returned string
from the slug field (see below for more info)

You might take advantage of the fact that the id property of the model
is set to the id of the record that was created by save. So you should
be able to set your slug value properly after:

$this->Campaign->findById($this->Campaign-
>id,,array('fields'=>'slug'));

But you should also be aware that this will not return the slug field
directly. It's going to be in the usual data array:

Array
(
[Campaign] => Array
(
[slug] => My_crazy_slug
)
)

Regards,
Don

On May 7, 9:22 am, barricades  wrote:
> Hi, I'm new so please don't shout at me for the stupid question but...
>
> When I save a record I want to redirect straight to the record I just
> created. The record which I have just created uses sluggable behaviour
> to create a slug in a beforeSave, so I can't just use 
> $this->data['Campaign]['slug'] as it doesn't exist before I save my
>
> campaign.
>
> in my add function I've got:
>
> 
> if ($this->Campaign->save($this->data)) {
>         $slug = $this->Campaign->find('first', array('fields' =>
> 'Campaign.slug'));
>         $this->redirect(array('action' => 'view', $slug));
>         } else {
>         $this->Session->setFlash(__('The campaign could not be saved. Please,
> try again.', true));}
>
> 
>
> and then
>
> 
> function view($slug) {
>         $campaign = $this->Campaign->find('first',
> array('conditions'=>array('Campaign.slug'=>$slug), 'recursive'=>-1));
>         $this->set(compact('campaign'));
>         }
> 
>
> but that ain't working. I've tried a couple of other ways but I'm a
> bit stumped.
>
> How do I get the value that's in the slug column for the Campaign
> which has just been saved and pass it on to the view function so that
> I can display the right Campaign?
>
> thanks in advance :)

-- 
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: newbie question on custom function

2011-01-14 Thread jsalonen
> So how do I call the function within the same class

You'd use $this->multiexplode(...), but if it is just a simple function that 
doesn't need to maintain state you could just define it as a regular PHP 
function in bootstrap.php.nor 

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: newbie question on custom function

2011-01-13 Thread Dr. Loboto
You can just define your utils functions as functions in bootstrap.php
and they will be always accessible without create component overhead
and "use in controller only" restriction.

On Jan 13, 2:54 pm, roy  wrote:
> I am new to cakephp and i have go through those tutorials.
> May be I am too stubborn to the old php coding way so I face a problem
> when I am making my own Function.
>
> Say, I have my a "multiexplode" function that recursively explode a
> string given an array of delimiators,
> sth like:
>
> class UtilComponent extends Object {
>    function multiexplode ($delimiters,$string){
>   ..
>        $ary[$key] = multiexplode($delimiters, $val);  // recursive
> part
>   ..
>    }
> ..
>
> }
>
> and I and call
>
> $this->Util->multiexplode(...)
>
> to trigger the function.
>
> ps: Indeed I am not sure where to put this function at. So I ended up
> wrapping this function with a component. (don't know if it is
> appropriate)
>
> And then it gives me
>
> Call to undefined function multiexplode() ...
>
> error.
>
> So how do I call the function within the same class?
> Can I make my own function and call it from another function within
> the same component/ controller?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: newbie question on custom function

2011-01-13 Thread Stephen
Hi Roy

If you want to define custom functions the best place to pop it is inside
the app_controller.php

This way you can call $this->multiexplode( ... ) in any controller and it
will access it from the AppController.

Otherwise pop the function inside the controller you wish to use it.

It's also a good idea to prefix your functions with _ i.e. function
_multiexplode() {

This means that you won't be able to access the function via the URL
/controller/multiexplode

Hope this helps

-- 
Kind Regards
 Stephen @ NinjaCoderMonkey

 www.ninjacodermonkey.co.uk

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie question - having trouble with baked model associations

2010-10-15 Thread Jeremy Burns | Class Outfit
See here: 
http://groups.google.com/group/cake-php/browse_thread/thread/7bfef9785d10d2d5

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
(t) +44 (0) 208 123 3822
(m) +44 (0) 7973 481949
Skype: jeremy_burns
http://www.classoutfit.com

On 15 Oct 2010, at 13:52, deafpanda wrote:

> Hello,
> 
> Sorry if this question is really stupid, I'm new to cake and I'm sure
> I'm missing something obvious but Google isn't helping me...
> 
> I'm following the tutorials in the cakephp book, and am on to the ACL
> tutorial.  I created all the tables and baked the models, controllers
> and views but when I add a new user to the users table I do not see a
> select box for the "group" field, but a normal text input box.  There
> are no links to related users on the group views pages, no links on
> any of the pages to actions for related models.
> 
> Help much appreciated,
> 
> Will
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie question - having trouble with baked model associations

2010-10-15 Thread Jeremy Burns | Class Outfit
See here: 
http://groups.google.com/group/cake-php/browse_thread/thread/7bfef9785d10d2d5

Jeremy Burns
Class Outfit

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

On 15 Oct 2010, at 13:52, deafpanda wrote:

> Hello,
> 
> Sorry if this question is really stupid, I'm new to cake and I'm sure
> I'm missing something obvious but Google isn't helping me...
> 
> I'm following the tutorials in the cakephp book, and am on to the ACL
> tutorial.  I created all the tables and baked the models, controllers
> and views but when I add a new user to the users table I do not see a
> select box for the "group" field, but a normal text input box.  There
> are no links to related users on the group views pages, no links on
> any of the pages to actions for related models.
> 
> Help much appreciated,
> 
> Will
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie question: URL linking

2010-06-02 Thread Shaz
Try:





link($html->image('linkedin.gif', array ('alt' =>
'LinkedIn' , 'align' => 'bottom')), "{$user['social_media']
['linkedin']}", array(), null, false); ?>






Essentially store the value you wish to act as a URL in a variable and
call that variable. Also remember PHP treats single quotes as strings,
and will not search for variables inside them; whereas it will do so
in double quotes. If it's an array you're calling in double quotes,
remember to use curly brackets around it.


On 1 June, 20:27, bobbiloo  wrote:
> In this example:
>
> 
> 
> link($html->image('linkedin.gif', array ('alt' =>
> 'LinkedIn' , 'align' => 'bottom')), ' ', array(), null, false); ?>
> 
> 
>
> I am trying to use a field in my social_media table, entitled
> "linkedin," to be the url of my $html->link statement. But if I plug
> that php echo line in between the single quotes, I get a parse
> error.
>
> How can I retrieve this table field to be the URL in my $html->link
> statement?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie Question about Upgrading

2010-05-12 Thread Jeremy Burns
This is perhaps not a direct answer to your question, but another suggestion. 
It is possible that some of the finds in your site's code are not built well. 
I'd encourage you debug out the results of the slow queries and see how much 
data is being returned. It could be that your query is requesting too much 
unnecessary data that is causing the load problems, not the performance of 
MySQL.

Jeremy Burns
jeremybu...@me.com


On 12 May 2010, at 19:35, Ephs wrote:

> Hello,
> 
> About two years ago I had someone make a website for me, and he used
> CakePHP. Now, I'm slowly learning how cakephp works in order to make
> updates (I know PHP fairly well). I'm having some mysql problems
> server load problems, and believe that upgrading to the newest version
> might help solve the issue (such as using mysql_free_result() on every
> query, not just the last one).
> 
> The version in version.txt currently shows 1.1.19.6305, so it seems I
> have a fairly old version. How would I go about updating to a newer
> version? What do I need to know before I begin? What version can I
> upgrade to? I just don't want the functionality of the website to mess
> up.
> 
> Any help is appreciated.
> 
> Thanks a lot.
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie question for "best practice" on how to combine CakePHP with a (given) design

2010-03-31 Thread janitor048
Hey guys,

thanks a lot for these very useful hints. I will definitely do some
more reading and start experimenting along the lines of your
suggestions.
And probably come back with more specific questions then.. :-)

Cheers,
Oliver


On Mar 29, 6:05 pm, cricket  wrote:
> To add to Jeremy's comments,
>
> In your menu elements, you can refer to the present location with
> $this->here, so you can have logic for showing/hiding submenus, etc.
> and avoid having to create separate layouts for each menu situation.
>
> For my login_prompt element, I check if the user is already logged in
> like this:
>
> if (!$session->read('Auth.User'))
> {
>    // show "login" link}
>
> else
> {
>    // show "logout" and "profile" links
>
> }
>
> If your users table has an "admin" column (0 or 1) you can do if
> ($session->read('Auth.User.admin')) to test whether you should include
> admin-specific links or whatever. Note that User is uppercase, as
> that's the name of the model. In your controllers, though, you'd use
> AuthComponent's user() method: $this->Auth->user('admin').
>
> For including disparate bits of code you can place several $this->element() 
> calls and use requestAction() in the elements. Make sure
>
> you have caching enabled in core.php and specifify that you want the
> element to be cached because each requestAction() call creates an
> entirely new request through Cake, which is expensive. By caching the
> element you avoid doing that each time. See this article:
>
> http://bakery.cakephp.org/articles/view/creating-reusable-elements-wi...
>
> Or search for "cakephp requestaction cache" or similar.
>
> On Mar 29, 8:49 am, janitor048  wrote:
>
> > Hi there,
>
> > I'm pretty new to CakePHP (and MVC in general for that matter) and I'm
> > just working through the docs etc.
> > And since the cookbook is quite informative, I think I've got a pretty
> > good idea of what CakePHP could do for me by now.
>
> > However, I would like to ask a question on best or common practice on
> > how to actually integrate my pieces of cake with a given design.
> > So that I can keep these suggestions in mind when digging even deeper
> > into the documentation.
>
> > Say, I've got a webpage that features
> > - a main "view" area in the center
> > - a main menu at the top that stays constant over all pages
> > - a side menu to the left that stays constant over some pages but does
> > in general depend on the content of the central area
> > - a small side area to the right with some login / admin bits-and-
> > pieces.
>
> > Pretty common and probably pretty close to the actual project I'm
> > about to work on.
> > The general layout as described above I would like to design using
> > dreamweaver (for instance) and setting up a css formatted page using
> > divs.
>
> > The main toolbar would probably best go into a common cake layout
> > file. But what about the rest? View files with elements for left menu
> > and login-area on the right? Login stuff as an element and the left
> > menu in layout files that are selected by the controller accordingly?
>
> > Can I attach id-based css rules to a specific element created by a
> > (say) form helper? For positioning purposes and the like..
>
> > And finally: What is the best way to incorporate bits and pieces from
> > different models / controllers into a single view? That would
> > something like a summary page, e.g. showing the 5 latests news, the 3
> > latest pictures and the most popular comments (or whatever you like)
> > in different areas of a single page (as delivered to the user).
>
> > Any hints and suggestions would be highly appreciated.
> > Cheers,
> > Oliver

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe, reply using "remove me" as the subject.


Re: Newbie question for "best practice" on how to combine CakePHP with a (given) design

2010-03-29 Thread cricket
To add to Jeremy's comments,

In your menu elements, you can refer to the present location with
$this->here, so you can have logic for showing/hiding submenus, etc.
and avoid having to create separate layouts for each menu situation.

For my login_prompt element, I check if the user is already logged in
like this:

if (!$session->read('Auth.User'))
{
   // show "login" link
}
else
{
   // show "logout" and "profile" links
}

If your users table has an "admin" column (0 or 1) you can do if
($session->read('Auth.User.admin')) to test whether you should include
admin-specific links or whatever. Note that User is uppercase, as
that's the name of the model. In your controllers, though, you'd use
AuthComponent's user() method: $this->Auth->user('admin').

For including disparate bits of code you can place several $this-
>element() calls and use requestAction() in the elements. Make sure
you have caching enabled in core.php and specifify that you want the
element to be cached because each requestAction() call creates an
entirely new request through Cake, which is expensive. By caching the
element you avoid doing that each time. See this article:

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

Or search for "cakephp requestaction cache" or similar.

On Mar 29, 8:49 am, janitor048  wrote:
> Hi there,
>
> I'm pretty new to CakePHP (and MVC in general for that matter) and I'm
> just working through the docs etc.
> And since the cookbook is quite informative, I think I've got a pretty
> good idea of what CakePHP could do for me by now.
>
> However, I would like to ask a question on best or common practice on
> how to actually integrate my pieces of cake with a given design.
> So that I can keep these suggestions in mind when digging even deeper
> into the documentation.
>
> Say, I've got a webpage that features
> - a main "view" area in the center
> - a main menu at the top that stays constant over all pages
> - a side menu to the left that stays constant over some pages but does
> in general depend on the content of the central area
> - a small side area to the right with some login / admin bits-and-
> pieces.
>
> Pretty common and probably pretty close to the actual project I'm
> about to work on.
> The general layout as described above I would like to design using
> dreamweaver (for instance) and setting up a css formatted page using
> divs.
>
> The main toolbar would probably best go into a common cake layout
> file. But what about the rest? View files with elements for left menu
> and login-area on the right? Login stuff as an element and the left
> menu in layout files that are selected by the controller accordingly?
>
> Can I attach id-based css rules to a specific element created by a
> (say) form helper? For positioning purposes and the like..
>
> And finally: What is the best way to incorporate bits and pieces from
> different models / controllers into a single view? That would
> something like a summary page, e.g. showing the 5 latests news, the 3
> latest pictures and the most popular comments (or whatever you like)
> in different areas of a single page (as delivered to the user).
>
> Any hints and suggestions would be highly appreciated.
> Cheers,
> Oliver

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Newbie question for "best practice" on how to combine CakePHP with a (given) design

2010-03-29 Thread Jeremy Burns
Looks like a combination of layouts and elements. Don't forget you can create 
as many layouts as you want, and specify which one to use in your controller - 
either inside beforeFilter (so that it applies to all functions in the 
controller) or inside a controller function (which will override all other 
settings). The command is $this->layout = '*layout_name*';  '*layout_name*' can 
also be  variable, allowing you precise control.

You can customise your view at runtime by calling an element with a variable - 
echo $this->element($variable); You can also customise your elements at runtime 
by passing in variables - echo $this->element('*element_name*', 
array('variable' => 'value')); - and have your code react internally to the 
variable dynamically.

Here's a few ideas on dynamic menus: 
http://articles.classoutfit.com/2009/11/cakephp-dynamic-navigation-bars/

I'm sure there's lot of other ideas too.

Jeremy Burns
jeremybu...@me.com


On 29 Mar 2010, at 13:49, janitor048 wrote:

> Hi there,
> 
> I'm pretty new to CakePHP (and MVC in general for that matter) and I'm
> just working through the docs etc.
> And since the cookbook is quite informative, I think I've got a pretty
> good idea of what CakePHP could do for me by now.
> 
> However, I would like to ask a question on best or common practice on
> how to actually integrate my pieces of cake with a given design.
> So that I can keep these suggestions in mind when digging even deeper
> into the documentation.
> 
> Say, I've got a webpage that features
> - a main "view" area in the center
> - a main menu at the top that stays constant over all pages
> - a side menu to the left that stays constant over some pages but does
> in general depend on the content of the central area
> - a small side area to the right with some login / admin bits-and-
> pieces.
> 
> Pretty common and probably pretty close to the actual project I'm
> about to work on.
> The general layout as described above I would like to design using
> dreamweaver (for instance) and setting up a css formatted page using
> divs.
> 
> The main toolbar would probably best go into a common cake layout
> file. But what about the rest? View files with elements for left menu
> and login-area on the right? Login stuff as an element and the left
> menu in layout files that are selected by the controller accordingly?
> 
> Can I attach id-based css rules to a specific element created by a
> (say) form helper? For positioning purposes and the like..
> 
> And finally: What is the best way to incorporate bits and pieces from
> different models / controllers into a single view? That would
> something like a summary page, e.g. showing the 5 latests news, the 3
> latest pictures and the most popular comments (or whatever you like)
> in different areas of a single page (as delivered to the user).
> 
> 
> Any hints and suggestions would be highly appreciated.
> Cheers,
> Oliver
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> 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
> 
> To unsubscribe from this group, send email to 
> cake-php+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

To unsubscribe from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Newbie question

2009-12-03 Thread nurvzy
Take a look at the bakery:
http://bakery.cakephp.org/articles/view/ckeditor-3-x-new-fckeditor-version

Since CKeditor is a js library you can just add it to app/webroot/js
and all the right magic will happen when you include it and attach it
to a textarea.

In regards to routing issues for third party software you can get
around that in a few ways.   Number one, you can drop it into your
webroot folder and then you can navigate to it directly (ie drop
phplist into app/webroot/phplist, then navigate to http://yoursite.com/phplist/.
Number two, you can drop it in your vendors directory and then import
it from within your app somewhere -- App::import('Vendor', 'path/to/
file');

The latter is really for independent php classes that have some
utility you need/want that isn't dependent on cakephp.  Some examples
could be a class to resize an image, paypal's direct payment php
class, etc.. etc..

Hope that helps,
Nick
http://www.webtechnick.com

On Dec 2, 1:57 am, Dave  wrote:
> I apologize if my questions is obvious or has been answered before. I
> tried searching for the answer, but I don't know what best to search
> for, mostly likely because I am barely sure of what the terms are for
> the issue I am facing.
>
> I am *very* new to Cake, but I am picking it up pretty quickly. I was
> thinking about trying to build a test blog of sorts. I was thinking it
> would be nice to include a drop-in open source WYSIWYG editor
> (CKEditor, probably) to remove the hassle of coding a blog post in
> html.
>
> But I realized, because Cake maps URL requests other than the actual
> folder structure, the editor script might try to pull up some images
> for its UI and get sent elsewhere. Is this the case? Or do requests
> from the server itself map directly to folders? If the former, any
> suggestions on if it is possible to integrate third party widgets like
> this short of nitty gritty tying them directly to the Cake framework?
>
> I apologize if I am not being very clear - as I said, I feel like I am
> missing some terminology to aptly describe the situation. Let me know
> if I need to be clearer on any points!
>
> Thanks in advance,
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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: Newbie question: Query Table

2009-05-26 Thread Bysa

thanks alot.

On May 26, 8:34 pm, brian  wrote:
> app/config/core.php
>
> Configure::write('debug', 0);
>
> On Tue, May 26, 2009 at 11:45 AM, Bysa  wrote:
>
> > hi
> > i ask my question first:
> > How to remove the query table that is below of all my page, it shows
> > some query and affected, time, and some more. i built my first blog
> > application and i was wondering how to remove the below table, i
> > looked in files i created but no help.
>
> > im very new to cake but i know my question is very easy and newbie.
> > maybe i didn't know the correct name of it, i searched for "cakephp
> > remove table query" and similars but no help
>
> > 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: Newbie question: Query Table

2009-05-26 Thread brian

app/config/core.php

Configure::write('debug', 0);

On Tue, May 26, 2009 at 11:45 AM, Bysa  wrote:
>
> hi
> i ask my question first:
> How to remove the query table that is below of all my page, it shows
> some query and affected, time, and some more. i built my first blog
> application and i was wondering how to remove the below table, i
> looked in files i created but no help.
>
> im very new to cake but i know my question is very easy and newbie.
> maybe i didn't know the correct name of it, i searched for "cakephp
> remove table query" and similars but no help
>
> 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: Newbie question: Missing controller

2009-03-10 Thread Son Dat Giang
^^
@Robin, what is your cake version? and how about your mod_rewrite.

-
Best regards !
Giang Son Dat
Mobile: +84 988114164
Email giangson...@gmail.com, giangson...@yahoo.com


On Tue, Mar 10, 2009 at 12:20 AM, Robin  wrote:

>
> I am completely new to cakephp. I am having this error message as
> following, which I cannot figure out. Anyone please point me to the
> right direction please?
>
> When I put in "http://localhost/cake/"; in my address bar, it gives me
> the following error:
>
> 
> Missing Controller
> Error: Index.php&url=Controller could not be found.
>
> Error: Create the class Index.php&url=Controller below in file: app
> \controllers\index.php&url=controller.php
>
>  class Index.php&url=Controller extends AppController {
>
>var $name = 'Index.php&url=';
> }
> ?>
> Notice: If you want to customize this error message, create app\views
> \errors\missing_controller.ctp
>
> --
> While I was playing around with the code, it seems anytime there's
> something in the url after "http://localhost/cake/";, it will give a
> missing controller error. And the controller name is just whatever
> after the "http://localhost/cake/";. For example, in the message above,
> the missed controller name is the defaulted "index.php."
>
> Anyone has any idea how to fix that? Thanks in advance!!!
>
> >
>

--~--~-~--~~~---~--~~
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: Newbie-question: Store multiple model-objects with just one form

2008-12-18 Thread volka

Cool! That's exactly what I've been searching for! :-)
Thanks a lot!


--~--~-~--~~~---~--~~
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: Newbie-question: Store multiple model-objects with just one form

2008-12-17 Thread teknoid

That's exactly what saveAll() is for...
http://teknoid.wordpress.com/2008/08/01/practical-use-of-saveall-part-1-working-with-multiple-models/

There are a few other posts regarding this topic on my blog... Also,
it is covered in the manual ;)

On Dec 17, 4:38 pm, volka  wrote:
> Hi there,
> I'd like to implement a form with which I want to achieve that the
> parent model -objects and the child-models-objects (hasMany) are being
> stored in the database by clicking on one submit button.
> For example:
>
> Parent-Model 'book' (with attributes like 'author', 'title', etc)
> hasMany 'chapter' (with atrributes like 'headline', 'order',
> 'book_id')
> hasMany 'image' (with attributes like 'name', 'path', 'chapter_id').
>
> The action of the form sth. like 'app/book/add/.
>
> Does someone has a best practice for this?
> Is it clean designed to call /app/chapter/add and app/image/add from
> the book-controller function, or how would you do this? Does cakephp
> forsee a different design in terms of cakephp conventions/paradigms?
>
> I'm sure it is just a newbie question...sorry :-/
>
> Kind regards,
> volka.
--~--~-~--~~~---~--~~
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: Newbie question on form validating

2008-12-11 Thread gearvOsh

Yes, I was about to to point out that it might be because your model
file name is capitalized.

On Dec 11, 4:57 am, AJV  wrote:
> :D
>
> Well I guess I just confirmed my newbie status, I had written the
> names of the model files Capitalized. I noticed that small letters
> work much better :D
>
> Well, that was a fun couple of hours.
>
> Aapo
>
> On Dec 11, 2:49 pm, AJV  wrote:
>
> > I'm quessing this has something to do with communicating with the
> > model file. Even if I write die() or some broken code to the model,
> > nothing happens. Are there any ways to confirm that the controller
> > talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
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: Newbie question on form validating

2008-12-11 Thread AJV

:D

Well I guess I just confirmed my newbie status, I had written the
names of the model files Capitalized. I noticed that small letters
work much better :D

Well, that was a fun couple of hours.

Aapo

On Dec 11, 2:49 pm, AJV <[EMAIL PROTECTED]> wrote:
> I'm quessing this has something to do with communicating with the
> model file. Even if I write die() or some broken code to the model,
> nothing happens. Are there any ways to confirm that the controller
> talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

I'm quessing this has something to do with communicating with the
model file. Even if I write die() or some broken code to the model,
nothing happens. Are there any ways to confirm that the controller
talks to the model, and if not, how could it be fixed?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

OK, thanks for that info!

Still, the problem persists.

I installed a fresh cake and made this tutorial:

http://bakery.cakephp.org/articles/view/multiple-rules-of-validation-per-field-in-cakephp-1-2

But even though I followed every step, it just doesn't work, no
validation is happening.



On Dec 11, 1:48 pm, grigri <[EMAIL PROTECTED]> wrote:
> Yes; Cake supports dynamic models.
>
> If you don't create an actual model file, cake will instantiate an
> instance of AppModel with the name and useTable set up to work
> properly. This is only useful for basic models though as you can't
> specify associations, behaviors, validation or anything specific for
> the auto-model.
>
> Its main use is for join tables in HABTM.
>
> hth
> grigri
>
> On Dec 11, 11:29 am, AJV <[EMAIL PROTECTED]> wrote:
>
> > A small typo - the path to the model file is of course /app/models/.
>
> > BUT I just noticed that I can change the model file to whatever, even
> > remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread grigri

Yes; Cake supports dynamic models.

If you don't create an actual model file, cake will instantiate an
instance of AppModel with the name and useTable set up to work
properly. This is only useful for basic models though as you can't
specify associations, behaviors, validation or anything specific for
the auto-model.

Its main use is for join tables in HABTM.

hth
grigri

On Dec 11, 11:29 am, AJV <[EMAIL PROTECTED]> wrote:
> A small typo - the path to the model file is of course /app/models/.
>
> BUT I just noticed that I can change the model file to whatever, even
> remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

A small typo - the path to the model file is of course /app/models/.

BUT I just noticed that I can change the model file to whatever, even
remove it, and it still works. Is this normal?!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread AJV

I'm really confused with this - can't get even the simplest examples
working.

I set a test case like this:

 array(
'rule' => array('email', true),
'message' => 'Please supply a valid email address.'
)
);

}
?>

###
data ) ){

if ($this->Contact->validates()){
echo "yes";
}

if( $this->Contact->save( $this->data ) ){
$lastId = $this->Contact->getLastInsertId();
$this->flash('Your new user has been created.','/c/
contacts/view/'.$lastId );
}
}
}
}
?>




Enter Contact Information



label('Contact.email', "Contact's E-mail"); ?>
error('Contact.email'); ?>
text('Contact.email', array('size' => '80') ); ?
>

 
submit('Check validity'); ?>


When I submit anything, like "" or "1oi321" or whatever,
everything validates. The e-mail addresses also validate, which is
nice :) but it clearly isn't working at all. What am I missing? Wrong
configuration? My cake version is 1.2.0.7692 RC3.


On Dec 11, 11:38 am, gearvOsh <[EMAIL PROTECTED]> wrote:
> I just finished doing this today, these two links should help:
>
> http://book.cakephp.org/view/125/Data-Validationhttp://groups.google.com/group/cake-php/browse_thread/thread/d5e98df3...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question on form validating

2008-12-11 Thread gearvOsh

I just finished doing this today, these two links should help:

http://book.cakephp.org/view/125/Data-Validation
http://groups.google.com/group/cake-php/browse_thread/thread/d5e98df32a08c5cd#
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question

2008-10-20 Thread Amit Badkas
2008/10/21 . <[EMAIL PROTECTED]>

> hi i am looking at this geoip tutorial
>  http://bakery.cakephp.org/articles/view/geoip-component
>
>
> what does the following mean? echo h?
>
> echo h($geo->asXML());
>

- The function h() is equivalent to PHP's htmlspecialchars() function -
http://php.net/htmlspecialchars

-- 
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

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



Re: newbie question

2008-10-09 Thread Janis Rough

Disregard this message, sorry, I ran the query again without the word "default" 
and it worked without any errors.

- Original Message 
From: Janis Rough <[EMAIL PROTECTED]>
To: cake-php@googlegroups.com
Sent: Thursday, October 9, 2008 8:06:16 AM
Subject: Re: newbie question


I just installed it.  Sorry I didn't research the list further.  I do have 
another question on the tutorial.  I tried running these sql create statements 
and they didn't work.  I got 2 errors.  I wonder why?


1 
SQL query: 
CREATE TABLE posts(
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY ,
title VARCHAR( 50 ) ,
body TEXT,
created DATETIME DEFAULT NOT NULL ,
modified DATETIME DEFAULT NOT NULL ) 
MySQL said:  #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 'NOT NULL,
   modified DATETIME DEFAULT NOT NULL
   )' at line 5 
2

SQL query: 
1INSERT INTO posts( title, body, created )  VALUES (
'Title strikes back', 'This is really exciting Not.', NOW( ) );


MySQL said:  #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 '1INSERT INTO posts (title,body,created)
   VALUES ('Title strikes back', 'This ' at line 1 



here is the query  i didn't run it with the numbers.  The first error I got rid 
of was the word default on line 6.  Why can't the default be not null?:

1. /* First, create our posts table: */
2. CREATE TABLE posts (
3. id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
4. title VARCHAR(50),
5. body TEXT,
6. created DATETIME DEFAULT NOT NULL,
7. modified DATETIME DEFAULT NOT NULL
8. );
9. /* Then insert some posts for testing: */
10. INSERT INTO posts (title,body,created)
11. VALUES ('The title', 'This is the post body.', NOW());
12. INSERT INTO posts (title,body,created)
13. VALUES ('A title once again', 'And the post body follows.', NOW());
14. INSERT INTO posts (title,body,created)
15. VALUES ('Title strikes back', 'This is really exciting! Not.', 
NOW());This might be a mysql question but I'm trying to get the cake php 
tutorial to work.

- Original Message 
From: Gabriel Kolbe <[EMAIL PROTECTED]>
To: cake-php@googlegroups.com
Sent: Thursday, October 9, 2008 2:55:42 AM
Subject: Re: newbie question


I user Xampp, and it works like a dream !!

On Thu, Oct 9, 2008 at 4:09 AM,  <[EMAIL PROTECTED]> wrote:
>
> I think it may be best if you use a real server!
>
> On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>>
>> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
>> Windows just for testing or do I have to install it on a real server?
>>
>> thanks,
>>
>> >
>>
>
>
> --
> Xavier A. Mathews
> Student/Developer/Web-Master
> GG Client Based Tech Support Specialist
> Hazel Crest Illinois
> [EMAIL PROTECTED]
> "Fear of a name, only increases fear of the thing itself."
>
> >
>



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



Re: newbie question

2008-10-09 Thread Janis Rough

I just installed it.  Sorry I didn't research the list further.  I do have 
another question on the tutorial.  I tried running these sql create statements 
and they didn't work.  I got 2 errors.  I wonder why?


1 
SQL query: 
 CREATE TABLE posts(
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY ,
title VARCHAR( 50 ) ,
body TEXT,
created DATETIME DEFAULT NOT NULL ,
modified DATETIME DEFAULT NOT NULL ) 
MySQL said:  #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 'NOT NULL,
   modified DATETIME DEFAULT NOT NULL
   )' at line 5 
2

SQL query: 
1INSERT INTO posts( title, body, created )  VALUES (
'Title strikes back', 'This is really exciting Not.', NOW( ) );

 
MySQL said:  #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 '1INSERT INTO posts (title,body,created)
   VALUES ('Title strikes back', 'This ' at line 1 



here is the query  i didn't run it with the numbers.  The first error I got rid 
of was the word default on line 6.  Why can't the default be not null?:

1. /* First, create our posts table: */
2. CREATE TABLE posts (
3. id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
4. title VARCHAR(50),
5. body TEXT,
6. created DATETIME DEFAULT NOT NULL,
7. modified DATETIME DEFAULT NOT NULL
8. );
9. /* Then insert some posts for testing: */
10. INSERT INTO posts (title,body,created)
11. VALUES ('The title', 'This is the post body.', NOW());
12. INSERT INTO posts (title,body,created)
13. VALUES ('A title once again', 'And the post body follows.', NOW());
14. INSERT INTO posts (title,body,created)
15. VALUES ('Title strikes back', 'This is really exciting! Not.', 
NOW());This might be a mysql question but I'm trying to get the cake php 
tutorial to work.

- Original Message 
From: Gabriel Kolbe <[EMAIL PROTECTED]>
To: cake-php@googlegroups.com
Sent: Thursday, October 9, 2008 2:55:42 AM
Subject: Re: newbie question


I user Xampp, and it works like a dream !!

On Thu, Oct 9, 2008 at 4:09 AM,  <[EMAIL PROTECTED]> wrote:
>
> I think it may be best if you use a real server!
>
> On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>>
>> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
>> Windows just for testing or do I have to install it on a real server?
>>
>> thanks,
>>
>> >
>>
>
>
> --
> Xavier A. Mathews
> Student/Developer/Web-Master
> GG Client Based Tech Support Specialist
> Hazel Crest Illinois
> [EMAIL PROTECTED]
> "Fear of a name, only increases fear of the thing itself."
>
> >
>


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



Re: newbie question

2008-10-09 Thread Janis Rough

WEll this is just a test I'll do it on a server later



- Original Message 
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
To: cake-php@googlegroups.com
Sent: Wednesday, October 8, 2008 8:09:52 PM
Subject: Re: newbie question


I think it may be best if you use a real server!

On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>
> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
> Windows just for testing or do I have to install it on a real server?
>
> thanks,
>
> >
>


-- 
Xavier A. Mathews
Student/Developer/Web-Master
GG Client Based Tech Support Specialist
Hazel Crest Illinois
[EMAIL PROTECTED]
"Fear of a name, only increases fear of the thing itself."


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



Re: newbie question

2008-10-09 Thread Janis Rough

thanks,



- Original Message 
From: techiguy <[EMAIL PROTECTED]>
To: CakePHP 
Sent: Wednesday, October 8, 2008 8:44:23 PM
Subject: Re: newbie question


yes ofcource u can use with XAMPP on windows.

i am also working on that with out any problem.

before u start make sure u have checked the configuration of your
local server

http://book.cakephp.org/view/333/A-Note-on-mod_rewrite

hope this helps you

On Oct 9, 7:14 am, JRough <[EMAIL PROTECTED]> wrote:
> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
> Windows just for testing or do I have to install it on a real server?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question

2008-10-09 Thread xavierunited

Ok Great!

On 10/09/2008, Gabriel Kolbe <[EMAIL PROTECTED]> wrote:
>
> I user Xampp, and it works like a dream !!
>
> On Thu, Oct 9, 2008 at 4:09 AM,  <[EMAIL PROTECTED]> wrote:
>>
>> I think it may be best if you use a real server!
>>
>> On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>>>
>>> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
>>> Windows just for testing or do I have to install it on a real server?
>>>
>>> thanks,
>>>
>>> >
>>>
>>
>>
>> --
>> Xavier A. Mathews
>> Student/Developer/Web-Master
>> GG Client Based Tech Support Specialist
>> Hazel Crest Illinois
>> [EMAIL PROTECTED]
>> "Fear of a name, only increases fear of the thing itself."
>>
>> >
>>
>
> >
>


-- 
Xavier A. Mathews
Student/Developer/Web-Master
GG Client Based Tech Support Specialist
Hazel Crest Illinois
[EMAIL PROTECTED]
"Fear of a name, only increases fear of the thing itself."

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



Re: newbie question

2008-10-09 Thread Gabriel Kolbe

I user Xampp, and it works like a dream !!

On Thu, Oct 9, 2008 at 4:09 AM,  <[EMAIL PROTECTED]> wrote:
>
> I think it may be best if you use a real server!
>
> On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>>
>> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
>> Windows just for testing or do I have to install it on a real server?
>>
>> thanks,
>>
>> >
>>
>
>
> --
> Xavier A. Mathews
> Student/Developer/Web-Master
> GG Client Based Tech Support Specialist
> Hazel Crest Illinois
> [EMAIL PROTECTED]
> "Fear of a name, only increases fear of the thing itself."
>
> >
>

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



Re: newbie question

2008-10-09 Thread xavierunited

I think it may be best if you use a real server!

On 10/08/2008, JRough <[EMAIL PROTECTED]> wrote:
>
> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
> Windows just for testing or do I have to install it on a real server?
>
> thanks,
>
> >
>


-- 
Xavier A. Mathews
Student/Developer/Web-Master
GG Client Based Tech Support Specialist
Hazel Crest Illinois
[EMAIL PROTECTED]
"Fear of a name, only increases fear of the thing itself."

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



Re: newbie question

2008-10-08 Thread techiguy

yes ofcource u can use with XAMPP on windows.

i am also working on that with out any problem.

before u start make sure u have checked the configuration of your
local server

http://book.cakephp.org/view/333/A-Note-on-mod_rewrite

hope this helps you

On Oct 9, 7:14 am, JRough <[EMAIL PROTECTED]> wrote:
> I want to try out Cakephp.  Do you know if I can use it with XXAMP on
> Windows just for testing or do I have to install it on a real server?
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question on 'Views' on the Blog Tutorial

2008-09-28 Thread ManMetal

To resolve this issue I use the 1.2xxx and everything worked just
fine...

Jerry

On Sep 28, 12:19 pm, ManMetal <[EMAIL PROTECTED]> wrote:
> Hi There,
> I have been sucessful in configurating CakePHP and I have almost
> finished the Blog Tutorial. When I run the app I get an SQL error
> listed below. It appears there is some kind of error in the 'all LIMIT
> 1" at line 1 that mySQL does not like. I can't find where the SQL is
> located at nor do I know if I should edit it.
>
> Can someone help me to get the proper view or what to do next?
>
> Thanks,
> Jerry
>
> Query: SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`,
> `Post`.`created`, `Post`.`modified` FROM `posts` AS `Post` WHERE all
> LIMIT 1
> Warning: SQL Error: 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 'all LIMIT 1' at line 1 in C:\wamp\www\cake\cake
> \libs\model\datasources\dbo_source.php on line 440
> CakePHP Rapid Development
> Blog posts
>
> Warning: Invalid argument supplied for foreach() in C:\wamp\www\cake
> \app\views\posts\index.thtml on line 11
> Id      Title   Created
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: conditions on a find('all') for hasMany?

2008-07-01 Thread Mike

*laf*  This is totally awesome - I never would have thought of this,
but it looks like it does work.

Looking at the SQL, it looks like the initial query is unchanged:
SELECT `Term`.`id`, `Term`.`year`, `Term`.`quartername` FROM `terms`
AS `Term` WHERE 1 = 1 ORDER BY `year` DESC

But the next query has that condition tacked onto it:

SELECT `Course`.`id`, `Course`.`term_id` /* SNIP */ FROM `courses` AS
`Course`
WHERE `Course`.`id` =1
AND
 `Course`.`term_id` IN (3, 2, 1)

I'm guessing that it's best to immediately remove the condition after
doing this.

Thanks!
--Mike

On Jun 30, 11:51 pm, majna <[EMAIL PROTECTED]> wrote:
> First question: maybe with Containable behaviour?
>
> $this->Term->contain('Course' => array(
>     'conditions'=>array( 'Course.id' => 1),
>     'order' => 'year DESC',)
> );
>
> Damn, You can even be dirty  $this->Term->hasMany['Course']
> ['conditions'] =" Course.id =1;"    :)
>
> On Jul 1, 6:49 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
>
>
> > The documentation you are referring to is misleading - a join is only
> > used across a belongsTo association (and hasOne), never for hasMany.
>
> > Basically, you can't have query conditions across a hasMany
> > association.  You will have to either query the other way (as you saw,
> > the Course belongsTo Term, so you can put Term conditions in the
> > Course query), or do the filtering in PHP after retrieving all data.
> > The Containable behaviour will not help with this - it really just
> > does some tricky bind / unbind and sets the appropriate recursive for
> > the  query, it won't help with conditions.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: conditions on a find('all') for hasMany?

2008-07-01 Thread Mike

Thanks for the informative reply!  It was kinda looking like this was
the way things are, but I always wonder if I'm just missing
something :)

Thanks!
--Mike

On Jun 30, 9:49 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> The documentation you are referring to is misleading - a join is only
> used across a belongsTo association (and hasOne), never for hasMany.
>
> Basically, you can't have query conditions across a hasMany
> association.  You will have to either query the other way (as you saw,
> the Course belongsTo Term, so you can put Term conditions in the
> Course query), or do the filtering in PHP after retrieving all data.
> The Containable behaviour will not help with this - it really just
> does some tricky bind / unbind and sets the appropriate recursive for
> the query, it won't help with conditions.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: conditions on a find('all') for hasMany?

2008-06-30 Thread majna

First question: maybe with Containable behaviour?

$this->Term->contain('Course' => array(
'conditions'=>array( 'Course.id' => 1),
'order' => 'year DESC',)
);

Damn, You can even be dirty  $this->Term->hasMany['Course']
['conditions'] =" Course.id =1;":)





On Jul 1, 6:49 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> The documentation you are referring to is misleading - a join is only
> used across a belongsTo association (and hasOne), never for hasMany.
>
> Basically, you can't have query conditions across a hasMany
> association.  You will have to either query the other way (as you saw,
> the Course belongsTo Term, so you can put Term conditions in the
> Course query), or do the filtering in PHP after retrieving all data.
> The Containable behaviour will not help with this - it really just
> does some tricky bind / unbind and sets the appropriate recursive for
> the  query, it won't help with conditions.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: conditions on a find('all') for hasMany?

2008-06-30 Thread Grant Cox

The documentation you are referring to is misleading - a join is only
used across a belongsTo association (and hasOne), never for hasMany.

Basically, you can't have query conditions across a hasMany
association.  You will have to either query the other way (as you saw,
the Course belongsTo Term, so you can put Term conditions in the
Course query), or do the filtering in PHP after retrieving all data.
The Containable behaviour will not help with this - it really just
does some tricky bind / unbind and sets the appropriate recursive for
the query, it won't help with conditions.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie Question: conditions on a find('all') for hasMany?

2008-06-30 Thread floob

I'm not sure that either of these suggestions will help your problem, but ...

1) you should try using the latest CakePHP (revision 7296 last I
checked).  There have been a number of improvements and bug fixes
since 6311.
2) you've got an extra comma at the end of your find query
("'recursive' => 0,").  I don't see any reason why it would cause your
error, but it couldn't hurt to remove it.


On Mon, Jun 30, 2008 at 12:25 PM, Mike <[EMAIL PROTECTED]> wrote:
>
> Hello!
>
> I'm really sorry to post this, but I've looked around, and haven't
> been able to figure out how to do a find on a Model (named 'Term"),
> using conditions that restrict the results based on fields in another
> model (named "Course") that belongsTo the first model .  Term hasMany
> Course.
>
> In the manual (http://book.cakephp.org/view/66/models#retrieving-your-
> data-73), at the end of 3.7.4.2 ("Complex Find Conditions"), is says
> "These conditions are also infinitely nest-able. Let's say you had a
> hasMany/belongsTo relationship between Posts and Authors, which would
> result in a LEFT JOIN. Let's say you wanted to find all the posts that
> contained a certain keyword ("magic") or were created in the past two
> weeks, but you want to restrict your search to posts written by Bob",
> and has the example code of:
> "Author.name" => "Bob"
>
>
>
> So in my app, I want to have Terms (school terms - in the US,
> semesters, or maybe quarters, depending on the college), and Courses.
> I'd like to be able to ask for a list of all Terms, such that there's
> at least one course in that term.  I'd also like to figure out how to
> generally be able to filter my finds based on critieria :).  So to
> start, I figured that I'd just ask for all terms that have course #1
> in them (which should just be one term), in order to figure out how to
> use the find('all') conditions.
>
> (I've got all the code up at http://bin.cakephp.org/saved/34262, if
> it's more readable there)
>
> The problem is that if I try to do:
>
> $terms = $this->Term->find('all', array(
>  'conditions' => array('Course.id' => '1'),
>  'order' => 'year DESC',
>  'recursive' => 2,
>  )) ;
>
> The resulting SQL query looks like:
>
> SELECT `Term`.`id`, `Term`.`year`, `Term`.`quartername` FROM `terms`
> AS `Term` WHERE `Course`.`id` = 1 ORDER BY `year` DESC
>
> Which causes problems b/c it's only using the Term table, but my
> condition uses the Course field.  As far as I can tell, CakePHP will
> first query the terms table, then will separately query the Courses
> table, but it doesn't seem to be putting the 'Course.id' criteria on
> the right query.  Based on what I read in the manual, I would expect
> this to work, but it isn't.
>
> What's odd is that if I query the COURSE instead, like so:
>
> $terms = $this->Course->find('all', array(
>'conditions' => array('Term.id' => 1, 'Course.id' => 1),
>'order' => 'Term.year DESC',
>'recursive' => 0,
>)) ;
> $terms = Set::extract($terms, "{n}.Term"); // RC2: -> classicExtract
>
> Cake generates SQL kinda like:
> SELECT `Course`.`id`, `Course`.`term_id`, /*SNIP*/ `Term`.`id`,
> `Term`.`year`, `Term`.`quartername` FROM `courses` AS `Course` LEFT
> JOIN `terms` AS `Term` ON (`Course`.`term_id` = `Term`.`id`) WHERE
> `Term`.`id` = 1 AND `Course`.`id` = 1 ORDER BY `Term`.`year` DESC
>
> Since this query includes both tables, the condition works.  Using the
> Set::extract, I can then get back to my list of terms (which should
> work just fine, if my recursive level is high enough :) ).
>
>
> My first question: If Term hasMany Course, and I want a list of Terms
> (filtered, in part, based on Courses), shouldn't I be doing a find on
> Term (i.e., the first query)?
>
> Second question: If I wanted to get a list of Terms that have a non-
> empty sublist of Courses, can I do that by querying the Term?  The
> second query (i.e., the one on Course) does this for my by default),
> but it seems a tad bit odd.
>
>
> I'm trying to use the Cake 1.2.0.6311 (beta) distribution on XAMP, and
> I've tried it using both FireFox 3 and IE 7.0.5730.13, not that the
> client should matter.
>
>
>Quick Aside: I've looked at using the new ContainableBehavior, but
> as I understand it, I should be able to filter using the Find method.
> I _think_ that Containable will try to (un)bind models to restrict the
> query - I"m not sure if it'll actually put the conditions onto the
> query, or if it'll pull all the data back, then apply conditions in-
> memory.
>There's a note at the very end of the manual entry that says
> "Additional filtering can be performed by supplying the standard Model-
>>find() options" (http://book.cakephp.org/view/474/containable).  That
> said, if I'm wrong in my understanding of this, and Containable should
> be used here, please let me know!
>
> If anyone could help (or even just offer suggestions/hints), that
> would be great!
> Thanks!
> --Mike
> >
>

--~-

Re: Newbie question

2008-04-15 Thread José Selesán
It worked!! Thank you

Regards
José

Sam Sherlock escribió:
> try this in your .htaccess
> 
> RewriteEngine on
> RewriteRule   (phpmyadmin)/(.*)   -   [L]
> RewriteRule^$webroot/[L]
> RewriteRule(.*) webroot/$1[L]
>  
>
> On 16/04/2008, *José Selesán* <[EMAIL PROTECTED] 
> > wrote:
>
>
> Hi there! I'm starting to use Cake-PHP (I think it is grate!) and
> I have
> a problem with my production server. I've installed CakePHP on the
> server and it has also phpmyadmin, soy my root directory looks as
> this:
> /app
> /cake
> /phpmyadmin
> index.php
> .htaccess
>
> The problem happens when I try to use phpMyAdmin (browsing to
> http://www.domain.com/phpmyadmin): I get an error message saying I
> don't
> have a phpmyadminController class. I think is a routing problem.
>
> Somebody can help me?
> Thanks a log
>
>
>
> >


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



Re: Newbie question

2008-04-15 Thread Sam Sherlock
try this in your .htaccess

RewriteEngine on
RewriteRule   (phpmyadmin)/(.*)   -   [L]
RewriteRule^$webroot/[L]
RewriteRule(.*) webroot/$1[L]
 

On 16/04/2008, José Selesán <[EMAIL PROTECTED]> wrote:
>
>
> Hi there! I'm starting to use Cake-PHP (I think it is grate!) and I have
> a problem with my production server. I've installed CakePHP on the
> server and it has also phpmyadmin, soy my root directory looks as this:
> /app
> /cake
> /phpmyadmin
> index.php
> .htaccess
>
> The problem happens when I try to use phpMyAdmin (browsing to
> http://www.domain.com/phpmyadmin): I get an error message saying I don't
> have a phpmyadminController class. I think is a routing problem.
>
> Somebody can help me?
> Thanks a log
>
> >
>

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



Re: Newbie Question: How can I get return error details to client when save fails

2008-02-13 Thread Samuel DeVore

There might be some helpful suggestions here

http://groups.google.com/group/cake-php/search?group=cake-php&q=db+error&qt_g=Search+this+group



On Feb 13, 2008 2:14 PM, angusm <[EMAIL PROTECTED]> wrote:
>
> Hi All
>
> How can I get the error details of a failed save call into a local
> variable? Here is basically what I'm trying to do in controller, what
> can I use for  so I can send the error
> details back to client?
>
>   function save()
>   {
> $this->layout = 'json';
> $aResult = array();
> if ($this->Bond->save($this->data)) {
> $aResult['success'] = true;
> $aResult['data'] = array('Bond application succesfully
> saved...');
> } else {
> $aResult['success'] = false;
>$aResult['data'] = array();
> }
> $this->set('sResult', $this->json->encode($aResult));
> $this->render('json/response');
>   }
>
> Any help appreciated!
>
> Cheers
>
> >
>



-- 
-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/
http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/
http://blog.samdevore.com/cakephp-pages/i-cant-bake/

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



Re: newbie question how to get an element from a view

2008-02-05 Thread Matias Lespiau
You're almost right.

You'll have to make your controller return the data when you request the
data.
E.g.
if(isset($this->params['requested'])) {
 return $data;
}

And in your view:

$data = $this->requestAction('/sdts/singled_T);
//view code

Please check this article,
http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestactionto
see a great explanation about how to do this.

Good luck,

-- 
Matias Lespiau
http://www.gignus.com/


On Feb 3, 2008 4:12 PM, tomoenage <[EMAIL PROTECTED]> wrote:

>
> Hey,
>
> I'm trying to construct an element, which contains information from a
> database. This element should be used in default.thmtl.
> The databes holds a value describing a "single of the day", i wrote a
> model for that, i wrote a controller and i wrote a view . Everythings
> perfect, the view shows the expected value from the database.
> For constructing an element I moved the view-Code from app/views/sdts/
> singled_T.thtml to app/views/ELEMENTS/singled_T.thtml and inserted
> $this->renderElement ('singled_T'); into default.thtml.
> As long as I look on views in sdts everything is fine, but when i
> change to another view (example localhost/user instead of localhost/
> sdt), i get the message, that the variable in line 2 of the element
> singled_T.thmtl is undefined.
>
> I tried to add an $this->requestAction('/sdts/singled_T)  but the only
> effect is an dead apache Maybe that constructs a recursion?
>
> I'm shure,  that can't be a big problem, but I have no idea to
> test
> Anybody able (and willing) to help me?
>
> Thanks a lot
> Pit
>
> >
>

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



Re: Newbie Question about Cake

2008-02-02 Thread [EMAIL PROTECTED]

instead of http://localhost try http://localhost/

On Feb 2, 6:41 am, "David H. Trang" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm currently new to CakePHP and PHP in general.
>
> I currently have Apache , PostGres, PHP set up and working correctly.
> I also have CakePHP setup and working correctly but for some reason
> when I try to go tohttp://localhostI see my directory instead of it
> going to index.php. I have changed the DirectoryIndex index.html
> index.html.var index.ph but it still brings up my directory first. Am
> I missing something else?
>
> I have used this guide to set up cake (http://www.jamesfairhurst.co.uk/
> posts/view/installing_cakephp/) Except that I didn't do a virtual host
> like he did because I couldn't get that working either.
>
> Am I missing something in httpd?
>
> Regards,
>
> David H. Trang
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question - multiple functions in a page

2007-12-03 Thread Jon Miller

Thank you very much to everyone who replied to my question, your
advice and suggestions are much appreciated and very helpful.

Jon.

On Dec 3, 2007 3:16 PM, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> Yes, with your tag cloud example, the core functionality for this
> might be best placed in the model.
>
> One reason to go through requestAction to call the model functionality
> is to reuse views.
> For example, perhaps your list of top ten posts in a specified
> category should appear the same way in loads of your pages: in that
> case, it might be handy to have a controller aciton that calls the ´fat
> ´ model, and returns the completed view.
>
> If, however, you need multiple views of the same data, then as you say
> it might be better just to access the fat model in various different
> controllers, and pass this onto different views.
>
>
>
>
>
> On Dec 3, 2:42 pm, SeanW <[EMAIL PROTECTED]> wrote:
> > On Dec 2, 7:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> >
> > > Using elements is what you want. Inside the elements you can use
> > > requestAction to get at any data you wish to use. You can return an
> > > array of data directly, or render a view. See tutorial here for an
> > > example (and also how to cache the result)
> >
> > That tutorial certainly explains requestAction and how cool it is, but
> > I'm left thinking "what happened to the skinny controller, fat model"
> > concept?  Why am I going to wind my way (again) through the Cake
> > framework only to get at a piece of data that the model should know
> > about anyway?
> >
> > For example, tag cloud.  We have a tag model, presumably linked to
> > posts or something.  Within the tag model I'd have a function,
> > tagCloud, that would return the tag cloud in an array, something like
> >
> > $ret[0]["tag"] = "cake";
> > $ret[0]["count"] = "5";
> > $ret[1]["tag"] = "php";
> > $ret[1]["count"] = "6";
> >
> > In the controller generating the post, we'd add "Tags" to the $uses
> > array, and in the action do a
> >
> > $this->set("tagcloud", $this->Tag->tagCloud());
> >
> > The tag cloud HTML would be encapsulated in an element so that anyone
> > could use it from the view, $this->renderElement("tagcloud",
> > array("data" => $tagcloud))
> >
> > None of this precludes using requestAction...  In fact the reason I
> > arrived at this conclusion is by starting off there, realizing the job
> > of collecting the tag cloud data belongs in the model, realized we
> > need an element anyway, so why bother using requestAction when I can
> > just set() it in the controller and still be blissfully unaware about
> > how the data is constructed?
> >
> > BTW this extends to the other cases the OP mentioned, ie $this->Books-
> >
> > >getReadingList(5), etc.
> >
> > The post that opened my eyes to the fat model concept:
> >
> > http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model
> >
> > It's written for Ruby on Rails, but it's easy enough to translate to
> > PHP.
> >
> > Sean
> >
>

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



Re: newbie question - multiple functions in a page

2007-12-03 Thread the_woodsman

Yes, with your tag cloud example, the core functionality for this
might be best placed in the model.

One reason to go through requestAction to call the model functionality
is to reuse views.
For example, perhaps your list of top ten posts in a specified
category should appear the same way in loads of your pages: in that
case, it might be handy to have a controller aciton that calls the ´fat
´ model, and returns the completed view.

If, however, you need multiple views of the same data, then as you say
it might be better just to access the fat model in various different
controllers, and pass this onto different views.




On Dec 3, 2:42 pm, SeanW <[EMAIL PROTECTED]> wrote:
> On Dec 2, 7:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
>
> > Using elements is what you want. Inside the elements you can use
> > requestAction to get at any data you wish to use. You can return an
> > array of data directly, or render a view. See tutorial here for an
> > example (and also how to cache the result)
>
> That tutorial certainly explains requestAction and how cool it is, but
> I'm left thinking "what happened to the skinny controller, fat model"
> concept?  Why am I going to wind my way (again) through the Cake
> framework only to get at a piece of data that the model should know
> about anyway?
>
> For example, tag cloud.  We have a tag model, presumably linked to
> posts or something.  Within the tag model I'd have a function,
> tagCloud, that would return the tag cloud in an array, something like
>
> $ret[0]["tag"] = "cake";
> $ret[0]["count"] = "5";
> $ret[1]["tag"] = "php";
> $ret[1]["count"] = "6";
>
> In the controller generating the post, we'd add "Tags" to the $uses
> array, and in the action do a
>
> $this->set("tagcloud", $this->Tag->tagCloud());
>
> The tag cloud HTML would be encapsulated in an element so that anyone
> could use it from the view, $this->renderElement("tagcloud",
> array("data" => $tagcloud))
>
> None of this precludes using requestAction...  In fact the reason I
> arrived at this conclusion is by starting off there, realizing the job
> of collecting the tag cloud data belongs in the model, realized we
> need an element anyway, so why bother using requestAction when I can
> just set() it in the controller and still be blissfully unaware about
> how the data is constructed?
>
> BTW this extends to the other cases the OP mentioned, ie $this->Books-
>
> >getReadingList(5), etc.
>
> The post that opened my eyes to the fat model concept:
>
> http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model
>
> It's written for Ruby on Rails, but it's easy enough to translate to
> PHP.
>
> Sean
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question - multiple functions in a page

2007-12-03 Thread SeanW

On Dec 2, 7:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> Using elements is what you want. Inside the elements you can use
> requestAction to get at any data you wish to use. You can return an
> array of data directly, or render a view. See tutorial here for an
> example (and also how to cache the result)

That tutorial certainly explains requestAction and how cool it is, but
I'm left thinking "what happened to the skinny controller, fat model"
concept?  Why am I going to wind my way (again) through the Cake
framework only to get at a piece of data that the model should know
about anyway?

For example, tag cloud.  We have a tag model, presumably linked to
posts or something.  Within the tag model I'd have a function,
tagCloud, that would return the tag cloud in an array, something like

$ret[0]["tag"] = "cake";
$ret[0]["count"] = "5";
$ret[1]["tag"] = "php";
$ret[1]["count"] = "6";

In the controller generating the post, we'd add "Tags" to the $uses
array, and in the action do a

$this->set("tagcloud", $this->Tag->tagCloud());

The tag cloud HTML would be encapsulated in an element so that anyone
could use it from the view, $this->renderElement("tagcloud",
array("data" => $tagcloud))

None of this precludes using requestAction...  In fact the reason I
arrived at this conclusion is by starting off there, realizing the job
of collecting the tag cloud data belongs in the model, realized we
need an element anyway, so why bother using requestAction when I can
just set() it in the controller and still be blissfully unaware about
how the data is constructed?

BTW this extends to the other cases the OP mentioned, ie $this->Books-
>getReadingList(5), etc.

The post that opened my eyes to the fat model concept:

http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model

It's written for Ruby on Rails, but it's easy enough to translate to
PHP.

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



Re: newbie question - multiple functions in a page

2007-12-03 Thread maschoen


I'm fairly new to Cake too, so maybe I will hit something helpful
here.
The tutorial examples tend to make it look like 1 controller for 1
model
and 1 model for 1 controller.

This is not at all true.   A controller can also use many models or
even none.
I think of a controller as the organization of a page, just as a view
is its presentation.
A model set up to CHUD on one model has been a rarity for me except
for administration.

You can use controller's to render just a piece of the page using
requestAction.
The reason this is frowned upon is the idea that it exercises the
whole Cake mechanism, which maybe time consuming.
I'm not really sure if this is true or not, and I've not seen anyone
posting any statistics backing this up.
I agree that it intuitively feels correct, but as a 'C' programmer, my
initial intuition about PHP was, how was it going to get off the
ground? So intuition on a Gigahertz CPU is not always very accurate.

Elements do however seem to fill the bill as reusable mini-controllers
for rendering parts of the page.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question - multiple functions in a page

2007-12-02 Thread Adam Royle

Using elements is what you want. Inside the elements you can use
requestAction to get at any data you wish to use. You can return an
array of data directly, or render a view. See tutorial here for an
example (and also how to cache the result)

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

Bakery source can be found here:

http://cakeforge.org/projects/bakery/

Additionally, Jonathon Snook uses his own conditionalhelper to render
the elements based on certain conditions.

http://snook.ca/archives/cakephp/elemental_conditional_content_with_cakephp/

Hope this helps.

Adam

On Dec 3, 9:36 am, "Jon Miller" <[EMAIL PROTECTED]> wrote:
> Hi,
> Thanks for your help. I could use Ajax, you're right, but I'm sure
> there must be a simpler way - I just want a single homepage to show a
> list of my music, a list of my articles, and a list of my users, all
> of which come from different DB tables and have different models and
> controllers.
>
> Actually I've just found a much better page to frame my question
> around... see this one:http://bakery.cakephp.org/
>
> Here you have a list of recent articles, a tag cloud of popular terms,
> a list of recent news items etc.
>
> I've never seen a tutorial on how to build a page like this in Cake.
> The most you get might be a page telling you how to make a page that
> lists one of those elements, but not one combining them.
>
> If I was to scaffold each of these I could go to
> bakery.cakephp.org/articles, bakery.cakephp.org/news,
> bakery.cakephp.org/tags etc. and get your CRUD for each of the
> elements, which would give me lots of seperate views, but I've no idea
> how to combine the individual views for these elements into one
> homepage, as most sites on the web do, including lots that claim they
> are built with Cake.
>
> Jon.
>
> On Dec 2, 2007 10:55 PM, ldb <[EMAIL PROTECTED]> wrote:
>
>
>
> > G'day
>
> > Would the Ajax helper be what you are looking for, or have I
> > misunderstood? I did visit your link..;-)
>
> > On Dec 2, 5:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > > Hi everyone,
> > > Apologies if this is a silly question, I'm brand new to Cake (and
> > > frameworks in general!).
>
> > > Every tutorial under the sun shows you how to make a view with another
> > > page for editing, another page for adding etc., but nobody seems to be
> > > able to show an example of an everyday web page, with lots of
> > > different dynamic systems built into a single page.
>
> > > I'm thinking of how you'd extend a site wirh a basic layout that looks
> > > like this one:http://www.snook.ca/archives/cakephp
>
> > > Presumably all the ads, book lists and things come from included
> > > elements - I've got that far, but how to make these dynamic? What if I
> > > wanted the left nav to be a list of users, with Edit and Delete links
> > > next to their names, while the main content panel gives me my editable
> > > list of articles. And what if at the bottom of the page I wanted to
> > > display my CD list?
>
> > > I can build a full class for music, articles and users, and they can
> > > work fine seperately (one view for listing my music, in the music
> > > folder, another view for editing my articles, in the articles folder
> > > etc.), but how does one combine them into a single view? I just can't
> > > see what you're supposed to do to combine lots of interactions into a
> > > single page, and where you're supposed to put view files with multiple
> > > functionality. If someone can explain, or point me to a tutorial, I'd
> > > be most grateful!
>
> > > Jon.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question - multiple functions in a page

2007-12-02 Thread [EMAIL PROTECTED]

Many thanks for the suggestion, I'd heard of requestAction but had
also heard that it wasn't recommended, so assumed there must be an
easier way as so many sites seem to combine elements.

I'll give it a try anyway - as you say, it will be good for learning
as I'm just starting out so I could always try a different way later
(and when I've got an app up and running to ask for suggestions on!).

Cheers,
Jon.

On Dec 2, 2007 11:28 PM, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> Here's my interpretation of your question
>
> The simplest way to do this is to call requestAction directly from
> your view; allowing you to retrieve other views and combine them in
> one page.
>
> Continuing with your example of the Snook page, you might build it
> something like this:
>
> - The main content would be retrieved by calling requestAction on some
> method in the controller responsible for posts, with whatever
> parameters it takes to get them by category.
>
> - In the left hand panel, the about text might be static on the page.
>
> - the get email updates form might be a call to requestAction to run
> an action in the controller responsible for subscribed users.
>
> - The books might be retrieved by a requestAction call to index() of
> the books controller.
>
> Hope that makes some sense!!
>
> You can also call request action in controllers, and collect the
> pieces of your page in your controller, before passing them onto your
> view.
>
> Bear in mind however that, to my knowledge, excessive direct use of
> requestAction isnt considered best practice.
>
> I think theres an article in the bakery on using Elements to achieve a
> similar effect (and I think that article is linked from the FAQ).
>
> However, using requestAction like this might be a good intro to how it
> all works.
>
> And of course, if you want to add loads of mini forms on these
> composite pages, Ajax might be a nice finishing touch.
>
> Enjoy!

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



Re: newbie question - multiple functions in a page

2007-12-02 Thread Jon Miller

Hi,
Thanks for your help. I could use Ajax, you're right, but I'm sure
there must be a simpler way - I just want a single homepage to show a
list of my music, a list of my articles, and a list of my users, all
of which come from different DB tables and have different models and
controllers.

Actually I've just found a much better page to frame my question
around... see this one:
http://bakery.cakephp.org/

Here you have a list of recent articles, a tag cloud of popular terms,
a list of recent news items etc.

I've never seen a tutorial on how to build a page like this in Cake.
The most you get might be a page telling you how to make a page that
lists one of those elements, but not one combining them.

If I was to scaffold each of these I could go to
bakery.cakephp.org/articles, bakery.cakephp.org/news,
bakery.cakephp.org/tags etc. and get your CRUD for each of the
elements, which would give me lots of seperate views, but I've no idea
how to combine the individual views for these elements into one
homepage, as most sites on the web do, including lots that claim they
are built with Cake.

Jon.

On Dec 2, 2007 10:55 PM, ldb <[EMAIL PROTECTED]> wrote:
>
> G'day
>
> Would the Ajax helper be what you are looking for, or have I
> misunderstood? I did visit your link..;-)
>
>
>
>
> On Dec 2, 5:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > Hi everyone,
> > Apologies if this is a silly question, I'm brand new to Cake (and
> > frameworks in general!).
> >
> > Every tutorial under the sun shows you how to make a view with another
> > page for editing, another page for adding etc., but nobody seems to be
> > able to show an example of an everyday web page, with lots of
> > different dynamic systems built into a single page.
> >
> > I'm thinking of how you'd extend a site wirh a basic layout that looks
> > like this one:http://www.snook.ca/archives/cakephp
> >
> > Presumably all the ads, book lists and things come from included
> > elements - I've got that far, but how to make these dynamic? What if I
> > wanted the left nav to be a list of users, with Edit and Delete links
> > next to their names, while the main content panel gives me my editable
> > list of articles. And what if at the bottom of the page I wanted to
> > display my CD list?
> >
> > I can build a full class for music, articles and users, and they can
> > work fine seperately (one view for listing my music, in the music
> > folder, another view for editing my articles, in the articles folder
> > etc.), but how does one combine them into a single view? I just can't
> > see what you're supposed to do to combine lots of interactions into a
> > single page, and where you're supposed to put view files with multiple
> > functionality. If someone can explain, or point me to a tutorial, I'd
> > be most grateful!
> >
> > Jon.
> >
>

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



Re: newbie question - multiple functions in a page

2007-12-02 Thread the_woodsman

Here's my interpretation of your question

The simplest way to do this is to call requestAction directly from
your view; allowing you to retrieve other views and combine them in
one page.

Continuing with your example of the Snook page, you might build it
something like this:

- The main content would be retrieved by calling requestAction on some
method in the controller responsible for posts, with whatever
parameters it takes to get them by category.

- In the left hand panel, the about text might be static on the page.

- the get email updates form might be a call to requestAction to run
an action in the controller responsible for subscribed users.

- The books might be retrieved by a requestAction call to index() of
the books controller.

Hope that makes some sense!!

You can also call request action in controllers, and collect the
pieces of your page in your controller, before passing them onto your
view.

Bear in mind however that, to my knowledge, excessive direct use of
requestAction isnt considered best practice.

I think theres an article in the bakery on using Elements to achieve a
similar effect (and I think that article is linked from the FAQ).

However, using requestAction like this might be a good intro to how it
all works.

And of course, if you want to add loads of mini forms on these
composite pages, Ajax might be a nice finishing touch.

Enjoy!


On Dec 2, 7:55 pm, ldb <[EMAIL PROTECTED]> wrote:
> G'day
>
> Would the Ajax helper be what you are looking for, or have I
> misunderstood? I did visit your link..;-)
>
> On Dec 2, 5:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everyone,
> > Apologies if this is a silly question, I'm brand new to Cake (and
> > frameworks in general!).
>
> > Every tutorial under the sun shows you how to make a view with another
> > page for editing, another page for adding etc., but nobody seems to be
> > able to show an example of an everyday web page, with lots of
> > different dynamic systems built into a single page.
>
> > I'm thinking of how you'd extend a site wirh a basic layout that looks
> > like this one:http://www.snook.ca/archives/cakephp
>
> > Presumably all the ads, book lists and things come from included
> > elements - I've got that far, but how to make these dynamic? What if I
> > wanted the left nav to be a list of users, with Edit and Delete links
> > next to their names, while the main content panel gives me my editable
> > list of articles. And what if at the bottom of the page I wanted to
> > display my CD list?
>
> > I can build a full class for music, articles and users, and they can
> > work fine seperately (one view for listing my music, in the music
> > folder, another view for editing my articles, in the articles folder
> > etc.), but how does one combine them into a single view? I just can't
> > see what you're supposed to do to combine lots of interactions into a
> > single page, and where you're supposed to put view files with multiple
> > functionality. If someone can explain, or point me to a tutorial, I'd
> > be most grateful!
>
> > Jon.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: newbie question - multiple functions in a page

2007-12-02 Thread ldb

G'day

Would the Ajax helper be what you are looking for, or have I
misunderstood? I did visit your link..;-)



On Dec 2, 5:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> Apologies if this is a silly question, I'm brand new to Cake (and
> frameworks in general!).
>
> Every tutorial under the sun shows you how to make a view with another
> page for editing, another page for adding etc., but nobody seems to be
> able to show an example of an everyday web page, with lots of
> different dynamic systems built into a single page.
>
> I'm thinking of how you'd extend a site wirh a basic layout that looks
> like this one:http://www.snook.ca/archives/cakephp
>
> Presumably all the ads, book lists and things come from included
> elements - I've got that far, but how to make these dynamic? What if I
> wanted the left nav to be a list of users, with Edit and Delete links
> next to their names, while the main content panel gives me my editable
> list of articles. And what if at the bottom of the page I wanted to
> display my CD list?
>
> I can build a full class for music, articles and users, and they can
> work fine seperately (one view for listing my music, in the music
> folder, another view for editing my articles, in the articles folder
> etc.), but how does one combine them into a single view? I just can't
> see what you're supposed to do to combine lots of interactions into a
> single page, and where you're supposed to put view files with multiple
> functionality. If someone can explain, or point me to a tutorial, I'd
> be most grateful!
>
> Jon.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-12-02 Thread Eemerge

Thanks for the tip, i was actually modifying app_controller from cake/
dir :)

On Dec 1, 2:14 am, "Dardo Sordi Bogado" <[EMAIL PROTECTED]> wrote:
> Don't touch cake/ dir, copy the app_controller.php into app/, then the
> that one takes precedence, so tweak as needed.
>
> 2007/11/30, Eemerge <[EMAIL PROTECTED]>:
>
>
>
> > Ok i added that line in cake/app_controller.php and so far so good.
>
> > Thanks for the help :)
>
> > On Nov 30, 11:41 pm, "Christopher E. Franklin, Sr."
> > <[EMAIL PROTECTED]> wrote:
> > > My bad, it's at the very end of helpers section which makes no sense
> > > to me since it should be at the very top.  It is also in the
> > > controllers section:
> > > ---
> > > $helpers
>
> > > Use this variable to have your controller load helpers into its views.
> > > The HTML helper is automatically loaded, but you can use this variable
> > > to specify a few others:
> > > var $helpers = array('Html','Ajax','Javascript');
>
> > > Remember that you will need to include the HtmlHelper in the $helpers
> > > array if you intend to use it. It is normally available by default,
> > > but if you define $helpers without it, you'll get error messages in
> > > your views.
> > > ---
> > > On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > > Thanks for the answer, one more thing though, should i use it in every
> > > > controller or just the main app controller?
>
> > > > Christopher E. Franklin, Sr. : i will check again, though i checked
> > > > several times.maybe it slipped :)
>
> > > > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
>
> > > > > G'day
>
> > > > > Hopefully I'm not misunderstanding.
>
> > > > > In your controller, make sure you have it defined. "var $helpers =
> > > > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> > > > > for context.
> > > > > That will work for just Javascript.
> > > > > If you use any helpers that are not built in, just make sure you put a
> > > > > copy of the helper is in "app/views/helpers" and then add the name,
> > > > > just like you did with 'Javascript'.
>
> > > > > You should now have access.:-)
>
> > > > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > > > > Sorry to ask such a newbie question, but i didnt find anything about
> > > > > > it in the manual. Maybe i missed it, but anyway:
>
> > > > > > how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Dardo Sordi Bogado

Don't touch cake/ dir, copy the app_controller.php into app/, then the
that one takes precedence, so tweak as needed.

2007/11/30, Eemerge <[EMAIL PROTECTED]>:
>
> Ok i added that line in cake/app_controller.php and so far so good.
>
> Thanks for the help :)
>
> On Nov 30, 11:41 pm, "Christopher E. Franklin, Sr."
> <[EMAIL PROTECTED]> wrote:
> > My bad, it's at the very end of helpers section which makes no sense
> > to me since it should be at the very top.  It is also in the
> > controllers section:
> > ---
> > $helpers
> >
> > Use this variable to have your controller load helpers into its views.
> > The HTML helper is automatically loaded, but you can use this variable
> > to specify a few others:
> > var $helpers = array('Html','Ajax','Javascript');
> >
> > Remember that you will need to include the HtmlHelper in the $helpers
> > array if you intend to use it. It is normally available by default,
> > but if you define $helpers without it, you'll get error messages in
> > your views.
> > ---
> > On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote:
> >
> > > Thanks for the answer, one more thing though, should i use it in every
> > > controller or just the main app controller?
> >
> > > Christopher E. Franklin, Sr. : i will check again, though i checked
> > > several times.maybe it slipped :)
> >
> > > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
> >
> > > > G'day
> >
> > > > Hopefully I'm not misunderstanding.
> >
> > > > In your controller, make sure you have it defined. "var $helpers =
> > > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> > > > for context.
> > > > That will work for just Javascript.
> > > > If you use any helpers that are not built in, just make sure you put a
> > > > copy of the helper is in "app/views/helpers" and then add the name,
> > > > just like you did with 'Javascript'.
> >
> > > > You should now have access.:-)
> >
> > > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
> >
> > > > > Sorry to ask such a newbie question, but i didnt find anything about
> > > > > it in the manual. Maybe i missed it, but anyway:
> >
> > > > > how do i load the javascript helper?
> >
>

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



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Eemerge

Ok i added that line in cake/app_controller.php and so far so good.

Thanks for the help :)

On Nov 30, 11:41 pm, "Christopher E. Franklin, Sr."
<[EMAIL PROTECTED]> wrote:
> My bad, it's at the very end of helpers section which makes no sense
> to me since it should be at the very top.  It is also in the
> controllers section:
> ---
> $helpers
>
> Use this variable to have your controller load helpers into its views.
> The HTML helper is automatically loaded, but you can use this variable
> to specify a few others:
> var $helpers = array('Html','Ajax','Javascript');
>
> Remember that you will need to include the HtmlHelper in the $helpers
> array if you intend to use it. It is normally available by default,
> but if you define $helpers without it, you'll get error messages in
> your views.
> ---
> On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > Thanks for the answer, one more thing though, should i use it in every
> > controller or just the main app controller?
>
> > Christopher E. Franklin, Sr. : i will check again, though i checked
> > several times.maybe it slipped :)
>
> > On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
>
> > > G'day
>
> > > Hopefully I'm not misunderstanding.
>
> > > In your controller, make sure you have it defined. "var $helpers =
> > > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> > > for context.
> > > That will work for just Javascript.
> > > If you use any helpers that are not built in, just make sure you put a
> > > copy of the helper is in "app/views/helpers" and then add the name,
> > > just like you did with 'Javascript'.
>
> > > You should now have access.:-)
>
> > > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > > Sorry to ask such a newbie question, but i didnt find anything about
> > > > it in the manual. Maybe i missed it, but anyway:
>
> > > > how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Christopher E. Franklin, Sr.

My bad, it's at the very end of helpers section which makes no sense
to me since it should be at the very top.  It is also in the
controllers section:
---
$helpers

Use this variable to have your controller load helpers into its views.
The HTML helper is automatically loaded, but you can use this variable
to specify a few others:
var $helpers = array('Html','Ajax','Javascript');

Remember that you will need to include the HtmlHelper in the $helpers
array if you intend to use it. It is normally available by default,
but if you define $helpers without it, you'll get error messages in
your views.
---
On Nov 30, 12:36 pm, Eemerge <[EMAIL PROTECTED]> wrote:
> Thanks for the answer, one more thing though, should i use it in every
> controller or just the main app controller?
>
> Christopher E. Franklin, Sr. : i will check again, though i checked
> several times.maybe it slipped :)
>
> On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
>
> > G'day
>
> > Hopefully I'm not misunderstanding.
>
> > In your controller, make sure you have it defined. "var $helpers =
> > array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> > for context.
> > That will work for just Javascript.
> > If you use any helpers that are not built in, just make sure you put a
> > copy of the helper is in "app/views/helpers" and then add the name,
> > just like you did with 'Javascript'.
>
> > You should now have access.:-)
>
> > On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > > Sorry to ask such a newbie question, but i didnt find anything about
> > > it in the manual. Maybe i missed it, but anyway:
>
> > > how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Eemerge

Thanks for the answer, one more thing though, should i use it in every
controller or just the main app controller?


Christopher E. Franklin, Sr. : i will check again, though i checked
several times.maybe it slipped :)

On Nov 30, 7:02 pm, ldb <[EMAIL PROTECTED]> wrote:
> G'day
>
> Hopefully I'm not misunderstanding.
>
> In your controller, make sure you have it defined. "var $helpers =
> array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
> for context.
> That will work for just Javascript.
> If you use any helpers that are not built in, just make sure you put a
> copy of the helper is in "app/views/helpers" and then add the name,
> just like you did with 'Javascript'.
>
> You should now have access.:-)
>
> On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
>
> > Sorry to ask such a newbie question, but i didnt find anything about
> > it in the manual. Maybe i missed it, but anyway:
>
> > how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread Christopher E. Franklin, Sr.

It is in the helpers section of the manual ;)

On Nov 30, 8:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
> Sorry to ask such a newbie question, but i didnt find anything about
> it in the manual. Maybe i missed it, but anyway:
>
> how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question: how do i load the javascript helper ?

2007-11-30 Thread ldb

G'day

Hopefully I'm not misunderstanding.

In your controller, make sure you have it defined. "var $helpers =
array('Html', 'Form','Javascript', 'Ajax' );" is the full line I have
for context.
That will work for just Javascript.
If you use any helpers that are not built in, just make sure you put a
copy of the helper is in "app/views/helpers" and then add the name,
just like you did with 'Javascript'.

You should now have access.:-)


On Nov 30, 11:31 am, Eemerge <[EMAIL PROTECTED]> wrote:
> Sorry to ask such a newbie question, but i didnt find anything about
> it in the manual. Maybe i missed it, but anyway:
>
> how do i load the javascript helper?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Newbie question re URLs

2007-10-19 Thread Wayne Fay

To put it simply, there is magic happening that you don't see.

If you don't call it yourself in the Controller method,
$this->render() is called for you. Other magic finds the correct view
name to use based on the action name (though you can override this to
specify an alternate) and which layout to use (unless you override).

Wayne

On 10/19/07, jakeone <[EMAIL PROTECTED]> wrote:
>
> I'm confused.  Why do URLs in Cake typically point to "controller/
> action" and not "view/action"?  I would have thought a link was
> presenting something to the user, i.e. a view, not an action.
>
> The Cake manual's blog tutorial has a link as follows:
>
> echo $html->link('Add Post', '/posts/add');
>
> and when you look at the Post controller's add action you see:
>
> function add()
> {
>   if (!empty($this->data))
>   {
> if ("this->Post->save(%this->data))
> {
>   $this->flash('Your post has been saved.', '/posts');
> }
>   }
> }
>
> I don't see how that displays the Add Post form (i.e. view) to the
> user... Or am I missing the point?
>
> Thanks.
>
>
> >
>

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



Re: newbie question about model visibility

2007-08-16 Thread Grant Cox

var $uses = array('User',"Status')

then you can use $this->Status.  Or, just use $this->User->Status (the
Status instance will be created on the User because of the
association).


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



Re: Newbie question: how to save a HABTM association

2007-07-18 Thread Langdon Stevenson

Hi bingomanatee

This topic is covered in the manual, and extensively in this group's 
archive.  I have just had to refresh myself today on how it all work to 
change some code.

So, have a look through the HABTM section of the Manual, then search the 
group and I am sure you will get your answers.

Regards,
Langdon


bingomanatee wrote:
> Simple question: how do you save a HABTM association? do you have to
> cretae a model for the joining table or can you do if from one of the
> two related model classes?
> 
> i.e., if I have a table TableA and a TableB and in TableA's model
> class I've created a HABTM association through tableC (= tablea_id:
> int, tableb_int), is there a method I can call on tableA that will
> save an association to tableB in tableC, or do I have to do it
> manually by cretaing a model class for tableC and manually inserting
> IDs into its fields for the tableB and tableA records?
> 
> Thanks

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



Re: newbie question...creating a 'login' element

2007-04-24 Thread Sliv

Maybe try putting this in a beforeRender() function in your Users
controller?:

if(!isset($this->viewVars['error'])) {
 $this->set('error', false);
}

On Apr 23, 8:24 pm, Stacey <[EMAIL PROTECTED]> wrote:
> hi all,
>
> i read a post in here about having a login form built into the default
> layout. it suggested using an element, so i created one. i'm having
> one small problem with variables, and i'm hoping someone can help me
> out. what i'm trying to accomplish, is having the login form in the
> right column...but, after they login, i want to replace the form with
> a logout button. so, i figured the default layout would be the best
> place for this logic.
>
> ok...here's the login element :
>
> 
> Incorrect Username/Password p>
> 
> Login/Register
> 
> 
> Username
> input('User/username', array('id' =>
> 'user_username', 'size' => '40', 'class' => 'textbox')) ?>
> tagErrorMsg('User/username', 'Username
> required') ?>
> 
> 
> Password
> input('User/passwd', array('id' =>
> 'user_passwd', 'size' => '40', 'type'=>"password", 'class' =>
> 'textbox')) ?>
> tagErrorMsg('User/passwd', 'Password required') ?
>
> 
> checkbox("User/cookie");?> Remember
> Me
>
> 
> 
>   
>   [Forgot Password?]
>   Not Registered? Sign Up!
> 
> 
>
> the 'error' variable is being passed from the login function in my
> users controller...
>
> function login()
> {
> $this->set('error', false);
> if(isset($this->params['data']))
> {
> if ($this->params['data']['User']['username']=='')
> {
> $this->User->invalidate('username');
> }
> else if ($this->params['data']['User']['passwd']=='')
> {
> $this->User->invalidate('passwd');
> }
> else
> {
>   $this->set('error', true);
> }
> $auth_num = $this->othAuth->login($this->params['data']
> ['User']);
> $this->set('auth_msg', $this->othAuth->getMsg($auth_num));
> }
> }
>
> and, here is the call from my default.thtml:
>
> renderElement("login",array("error"=>$error)); ?>
>
> my problem is, i get an 'undefined variable : error' if the page is
> loaded from anywhere but the login function. i understand why this is
> happening, but i'm not sure how to fix it. i tried using isset above
> the call to renderElement, to try and set the variable to false if
> it's not valid, but it won't let me do that...and, i think that's not
> the right way anyway.
>
> can someone point me in the right direction to do this.
>
> thanks


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



Re: newbie question about multiple databases

2007-04-11 Thread Sergei Gerasenko

Well, it turns out that it's a bug that first appeared in 1.1.14. It
seems that it was first reported on the 8th. The ticket number is 2370.

On Wed, Apr 11, 2007 at 09:25:39AM -0400, Sergei Gerasenko wrote:
> 
> I had an email hiccup yesterday, so I'm not sure if you got my last
> message. Just in case I'll update you on what I've found. 
> 
> The bottom line is that it works in 1.1.11.4064 and doesn't in
> 1.1.14.4797. I don't know if a bug was introduced in 1.1.14, but I
> guess it's possible.

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



Re: newbie question about multiple databases

2007-04-11 Thread Sergei Gerasenko

I had an email hiccup yesterday, so I'm not sure if you got my last
message. Just in case I'll update you on what I've found. 

The bottom line is that it works in 1.1.11.4064 and doesn't in
1.1.14.4797. I don't know if a bug was introduced in 1.1.14, but I
guess it's possible.

Is there a way to inform the developers? The bug theory doesn't quite
stand since you were able to do it even with the alpha. What version of
php are you using?


On Tue, Apr 10, 2007 at 12:05:23PM -0400, Sergei Gerasenko wrote:
> 
> OK, I duplicated the setup at work and everything went great. So there
> must be something with my setup at home. I'll try not to bug you guys
> about this anymore until I find out what's causing it.
> 
> 

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



Re: newbie question about multiple databases

2007-04-10 Thread BlenderStyle

Two different servers can act differently. I have a SUSE LAMP server
at work and an Ubuntu LAMP server at home, and they experience
different issues. I think I must have compiled Apache and PHP
differently.

On Apr 10, 9:05 am, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> OK, I duplicated the setup at work and everything went great. So there
> must be something with my setup at home. I'll try not to bug you guys
> about this anymore until I find out what's causing it.


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



Re: newbie question

2007-04-10 Thread mindcharger

That's a tough one! :-)

I cannot give you a straight answer for that one because I never
needed that but I can try to give you some clues. Please note that
these are just ideas and they might not even be possible.

Also, please check that Cake cannot supply to DB connections to the
same Model before getting in this trouble (AFAIK, 1 connection per
Model...but I might be wrong...) :-)

There's a class on the Cake API named "DboMysql" that provides a
connection with a MySQL DB. I think that somewhere "under the hood"
there should be an instance of this class on the Model. You can
override Cake's native Model and thus create ANOTHER MySQL connection
(look in the manual for the procedure to do so...). By then you can
have TWO DB connections on the same Model. This solves one part of the
problem.

The other is the relationship between the tables. I'm pretty sure that
this is the easy part. By messing with the Model's vars and by
creating a couple of methods to encapsulate the database switching you
can "emulate" Cake's 'belongsTo' behaviour for certain.

One extra tip: you can use Model's method execute() to force the DB
change:

//...on the Model

function aMethod($param)
{
  $this->execute("USE B");
 ...
}

function anotherMethod($param)
{
 $this->execute("USE A");
...
}

I hope I have pointed some direction for your problem's solution.

Good luck and don't forget to report back here if you find a
solution... :-)
You might save someone else a lot of work... :-)

> Let's say I have a MySQL database named "A" and another one named "B".
> Within "A", I have a table named A1. Within "B" I have a table
> named B1. Let us now say that A.A1 has a foreign key in B.B1.
>
> So, I'm trying to write a model for A.A1 with a foreign key to B.B1.
> Here's where I get stuck:
>
> class A1 extends AppModel
> {
>   var $name = 'A1';
>   var $useDbConfig = 'dbConfig_A';
>
>   var $belongsTo = array('B1' => array('className' => 'B1'));
>
> }
>
> I think the above is more or less correct, but as you can see B1 will be
> searched within database "A", not database "B". And that's the problem I
> was describing.
>
> Even though I could specify a database connection in a model, here I
> have a situation where I need both connections because the tables are in
> different databases (although both are under the same instance of the
> MySQL server).
>
> Hope there's a simple answer to this problem. Thanks for all your help.

> Best regards,
>   Sergei
>
>
>
> > Good luck.
>
> > On Apr 8, 2:53 pm, "[EMAIL PROTECTED]"
> > <[EMAIL PROTECTED]> wrote:
> > > Hi everybody,
>
> > > I'm considering converting my application into CakePHP.
>
> > > Currently I have 3 databases within my application and the first one
> > > has several tables that are referenced by tables in the other two
> > > databases.
>
> > > Problem 1. I have tables that are named the same in at least two
> > > databases. Can models, controllers and views be isolated to a folder
> > > that would correspond to a specific database? Cake Views are already
> > > in a folder by the controller name but models and controllers exist in
> > > the same directories.
>
> > > Problem 2. I don't know how to describe a model that has a
> > > relationship with a table from a different database.
>
> > > What's the best way to handle this situation in Cake?
>
> --
>
> Sergei Gerasenko
> IT Department
> PublicSchoolWORKS
> Phone: (513)-631-6111


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



Re: newbie question about multiple databases

2007-04-10 Thread Sergei Gerasenko

OK, I duplicated the setup at work and everything went great. So there
must be something with my setup at home. I'll try not to bug you guys
about this anymore until I find out what's causing it.

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



Re: newbie question about multiple databases

2007-04-10 Thread Sergei Gerasenko

No, unfortunately that didn't help.

On Tue, Apr 10, 2007 at 11:29:44AM -0400, Sergei Gerasenko wrote:
> 
> I think my directory structure is not quite right. Don't know how it
> happened but I'm sure that's the reason. I'll check it tonight and let
> you know.
> 
> 

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



Re: newbie question about multiple databases

2007-04-10 Thread Sergei Gerasenko

I think my directory structure is not quite right. Don't know how it
happened but I'm sure that's the reason. I'll check it tonight and let
you know.

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



Re: newbie question about multiple databases

2007-04-10 Thread Sergei Gerasenko

Nope, neither distribution worked.

On Tue, Apr 10, 2007 at 04:26:55AM -, BlenderStyle wrote:
> 
> Did migrating to 1.2.0.4798alpha fix your problem? I've found, that
> even though it's an alpha, 1.2 works pretty well.
> 
> On Apr 9, 6:06 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> wrote:
> > I was using 1.1.14 but then when I got the error I tried the
> > 1.2.0.4798-alpha. That is, I replaced the 1.1.14 cake directory
> > with the cake directory from the alpha distribution.

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

Did migrating to 1.2.0.4798alpha fix your problem? I've found, that
even though it's an alpha, 1.2 works pretty well.

On Apr 9, 6:06 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> I was using 1.1.14 but then when I got the error I tried the
> 1.2.0.4798-alpha. That is, I replaced the 1.1.14 cake directory
> with the cake directory from the alpha distribution.
>
>
>
> On Tue, Apr 10, 2007 at 12:46:22AM -, BlenderStyle wrote:
>
> > What version of Cake are you using?
>
> > On Apr 9, 5:40 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> > wrote:
> > > Thanks for the quick response. Unfortunately, that didn't do it.
>
> > > Here's the modified app/config/database.php
>
> > > class DATABASE_CONFIG
> > > {
> > >   var $default = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'publicschoolworks',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > >   var $pbs = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'pbs',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > >   var $test = array('driver' => 'mysql',
> > >   'connect' => 'mysql_connect',
> > >   'host' => 'localhost',
> > >   'login' => 'user',
> > >   'password' => 'password',
> > >   'database' => 'project_name-test',
> > >   'prefix' => '');
>
> > > }
>
> > > And the models:
>
> > >  > > class Customer extends AppModel
> > > {
> > >   var $name = 'Customer';}
>
> > > ?>
>
> > >  > > class Student extends AppModel
> > > {
> > >   var $name = 'Student';
> > >   var $useDbConfig = 'pbs';
>
> > >   var $belongsTo = array(
> > > 'Customer' => array('className' => 'Customer')
> > >   );}
>
> > > ?>
>
> > > Let me know if you can think of something else.
>
> > > Thanks,
> > >   Sergei
>
> > > On Tue, Apr 10, 2007 at 12:05:05AM -, BlenderStyle wrote:
>
> > > > I ran into this too. One of the database configs has to be default. So
> > > > change $psw to $default, and remove var $useConfig in your customer
> > > > model (it uses default by, well, default).
>
> > > > If persistent is set to true,  you can't use two configs
> > > > simultaneously. I'm guessing if persistent is true, and the default
> > > > database config (host, username, password, database) is used, it keeps
> > > > that connection open. Then, when your other model comes into play it
> > > > will try to use the same connection.
>
> > > > On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> > > > wrote:
> > > > > > You're welcome. In doing this, I learned about the persistent key, 
> > > > > > so
> > > > > > everyone wins. Let us know how it goes.
>
> > > > > Just tried this at home and I'm baffled with this error: Cannot 
> > > > > redeclare class dbosource in 
> > > > > /var/www/cake/cake/libs/model/datasources/dbo_source.php
>
> > > > > Here's my setup:
>
> > > > > app/config/database.php:
> > > > > ===
>
> > > > >   var $psw = array('driver' => 'mysql',
> > > > > 'connect' => 'mysql_connect',
> > > > > 'host' => 'localhost',
> > > > > 'login' => '***',
> > > > > 'password' => '***',
> > > > > 'database' => 'psw',
> > > > > 'persistent' => false,
> > > > > 'prefix' => '');
>
> > > > >   var $pbs = array('driver' => 'mysql',
> > > > > 'connect' => 'mysql_connect',
> > > > > 'host' => 'localhost',
> > > > > 'login' => '***',
> > > > > 'password' => '***',
> > > > > 'database' => 'pbs',
> > > > > 'persistent' => false,
> > > > > 'prefix' => '');
>
> > > > > app/models/student.php
> > > > > ===
> > > > >  > > > > class Student extends AppModel
> > > > > {
> > > > >   var $name = 'Student';
> > > > >   var $useDbConfig = 'pbs';
>
> > > > >   var $belongsTo = array(
> > > > > 'Customer' => array('className' => 'Customer')
> > > > >   );}
>
> > > > > ?>
>
> > > > > app/models/customer.php
> > > > > ===
> > > > >  > > > > class Customer extends AppModel
> > > > > {
> > > > >   var $name = 'Customer';
> > > > >   var $useDbConfig = 'psw';}
>
> > > > > ?>
>
> > > > > Am I missing something?
>
> > > --
>
> > > Sergei Gerasenko
> > > IT Department
> > > PublicSchoolWORKS
> > > Phone: (513)-631-6111
>
> --
>
> Sergei Gerasenko
> IT Department
> PublicSchoolWORKS
> Phone: (513)-631-6111


--~--~-~--~~~---~--~~
You received this messa

Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

I was using 1.1.14 but then when I got the error I tried the
1.2.0.4798-alpha. That is, I replaced the 1.1.14 cake directory
with the cake directory from the alpha distribution.

On Tue, Apr 10, 2007 at 12:46:22AM -, BlenderStyle wrote:
> 
> What version of Cake are you using?
> 
> On Apr 9, 5:40 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> wrote:
> > Thanks for the quick response. Unfortunately, that didn't do it.
> >
> > Here's the modified app/config/database.php
> >
> > class DATABASE_CONFIG
> > {
> >   var $default = array('driver' => 'mysql',
> > 'connect' => 'mysql_connect',
> > 'host' => 'localhost',
> > 'login' => '***',
> > 'password' => '***',
> > 'database' => 'publicschoolworks',
> > 'persistent' => false,
> > 'prefix' => '');
> >
> >   var $pbs = array('driver' => 'mysql',
> > 'connect' => 'mysql_connect',
> > 'host' => 'localhost',
> > 'login' => '***',
> > 'password' => '***',
> > 'database' => 'pbs',
> > 'persistent' => false,
> > 'prefix' => '');
> >
> >   var $test = array('driver' => 'mysql',
> >   'connect' => 'mysql_connect',
> >   'host' => 'localhost',
> >   'login' => 'user',
> >   'password' => 'password',
> >   'database' => 'project_name-test',
> >   'prefix' => '');
> >
> > }
> >
> > And the models:
> >
> >  > class Customer extends AppModel
> > {
> >   var $name = 'Customer';}
> >
> > ?>
> >
> >  > class Student extends AppModel
> > {
> >   var $name = 'Student';
> >   var $useDbConfig = 'pbs';
> >
> >   var $belongsTo = array(
> > 'Customer' => array('className' => 'Customer')
> >   );}
> >
> > ?>
> >
> > Let me know if you can think of something else.
> >
> > Thanks,
> >   Sergei
> >
> >
> >
> > On Tue, Apr 10, 2007 at 12:05:05AM -, BlenderStyle wrote:
> >
> > > I ran into this too. One of the database configs has to be default. So
> > > change $psw to $default, and remove var $useConfig in your customer
> > > model (it uses default by, well, default).
> >
> > > If persistent is set to true,  you can't use two configs
> > > simultaneously. I'm guessing if persistent is true, and the default
> > > database config (host, username, password, database) is used, it keeps
> > > that connection open. Then, when your other model comes into play it
> > > will try to use the same connection.
> >
> > > On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> > > wrote:
> > > > > You're welcome. In doing this, I learned about the persistent key, so
> > > > > everyone wins. Let us know how it goes.
> >
> > > > Just tried this at home and I'm baffled with this error: Cannot 
> > > > redeclare class dbosource in 
> > > > /var/www/cake/cake/libs/model/datasources/dbo_source.php
> >
> > > > Here's my setup:
> >
> > > > app/config/database.php:
> > > > ===
> >
> > > >   var $psw = array('driver' => 'mysql',
> > > > 'connect' => 'mysql_connect',
> > > > 'host' => 'localhost',
> > > > 'login' => '***',
> > > > 'password' => '***',
> > > > 'database' => 'psw',
> > > > 'persistent' => false,
> > > > 'prefix' => '');
> >
> > > >   var $pbs = array('driver' => 'mysql',
> > > > 'connect' => 'mysql_connect',
> > > > 'host' => 'localhost',
> > > > 'login' => '***',
> > > > 'password' => '***',
> > > > 'database' => 'pbs',
> > > > 'persistent' => false,
> > > > 'prefix' => '');
> >
> > > > app/models/student.php
> > > > ===
> > > >  > > > class Student extends AppModel
> > > > {
> > > >   var $name = 'Student';
> > > >   var $useDbConfig = 'pbs';
> >
> > > >   var $belongsTo = array(
> > > > 'Customer' => array('className' => 'Customer')
> > > >   );}
> >
> > > > ?>
> >
> > > > app/models/customer.php
> > > > ===
> > > >  > > > class Customer extends AppModel
> > > > {
> > > >   var $name = 'Customer';
> > > >   var $useDbConfig = 'psw';}
> >
> > > > ?>
> >
> > > > Am I missing something?
> >
> > --
> >
> > Sergei Gerasenko
> > IT Department
> > PublicSchoolWORKS
> > Phone: (513)-631-6111
> 
> 
> > 

-- 

Sergei Gerasenko
IT Department
PublicSchoolWORKS
Phone: (513)-631-6111

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

What version of Cake are you using?

On Apr 9, 5:40 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> Thanks for the quick response. Unfortunately, that didn't do it.
>
> Here's the modified app/config/database.php
>
> class DATABASE_CONFIG
> {
>   var $default = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'publicschoolworks',
> 'persistent' => false,
> 'prefix' => '');
>
>   var $pbs = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'pbs',
> 'persistent' => false,
> 'prefix' => '');
>
>   var $test = array('driver' => 'mysql',
>   'connect' => 'mysql_connect',
>   'host' => 'localhost',
>   'login' => 'user',
>   'password' => 'password',
>   'database' => 'project_name-test',
>   'prefix' => '');
>
> }
>
> And the models:
>
>  class Customer extends AppModel
> {
>   var $name = 'Customer';}
>
> ?>
>
>  class Student extends AppModel
> {
>   var $name = 'Student';
>   var $useDbConfig = 'pbs';
>
>   var $belongsTo = array(
> 'Customer' => array('className' => 'Customer')
>   );}
>
> ?>
>
> Let me know if you can think of something else.
>
> Thanks,
>   Sergei
>
>
>
> On Tue, Apr 10, 2007 at 12:05:05AM -, BlenderStyle wrote:
>
> > I ran into this too. One of the database configs has to be default. So
> > change $psw to $default, and remove var $useConfig in your customer
> > model (it uses default by, well, default).
>
> > If persistent is set to true,  you can't use two configs
> > simultaneously. I'm guessing if persistent is true, and the default
> > database config (host, username, password, database) is used, it keeps
> > that connection open. Then, when your other model comes into play it
> > will try to use the same connection.
>
> > On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> > wrote:
> > > > You're welcome. In doing this, I learned about the persistent key, so
> > > > everyone wins. Let us know how it goes.
>
> > > Just tried this at home and I'm baffled with this error: Cannot redeclare 
> > > class dbosource in 
> > > /var/www/cake/cake/libs/model/datasources/dbo_source.php
>
> > > Here's my setup:
>
> > > app/config/database.php:
> > > ===
>
> > >   var $psw = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'psw',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > >   var $pbs = array('driver' => 'mysql',
> > > 'connect' => 'mysql_connect',
> > > 'host' => 'localhost',
> > > 'login' => '***',
> > > 'password' => '***',
> > > 'database' => 'pbs',
> > > 'persistent' => false,
> > > 'prefix' => '');
>
> > > app/models/student.php
> > > ===
> > >  > > class Student extends AppModel
> > > {
> > >   var $name = 'Student';
> > >   var $useDbConfig = 'pbs';
>
> > >   var $belongsTo = array(
> > > 'Customer' => array('className' => 'Customer')
> > >   );}
>
> > > ?>
>
> > > app/models/customer.php
> > > ===
> > >  > > class Customer extends AppModel
> > > {
> > >   var $name = 'Customer';
> > >   var $useDbConfig = 'psw';}
>
> > > ?>
>
> > > Am I missing something?
>
> --
>
> Sergei Gerasenko
> IT Department
> PublicSchoolWORKS
> Phone: (513)-631-6111


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



Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

Thanks for the quick response. Unfortunately, that didn't do it.

Here's the modified app/config/database.php

class DATABASE_CONFIG
{
  var $default = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => '***',
'password' => '***',
'database' => 'publicschoolworks',
'persistent' => false,
'prefix' => '');

  var $pbs = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => '***',
'password' => '***',
'database' => 'pbs',
'persistent' => false,
'prefix' => '');

  var $test = array('driver' => 'mysql',
  'connect' => 'mysql_connect',
  'host' => 'localhost',
  'login' => 'user',
  'password' => 'password',
  'database' => 'project_name-test',
  'prefix' => '');
}

And the models:



 array('className' => 'Customer')
  );
}
?>

Let me know if you can think of something else.

Thanks,
  Sergei

On Tue, Apr 10, 2007 at 12:05:05AM -, BlenderStyle wrote:
> 
> I ran into this too. One of the database configs has to be default. So
> change $psw to $default, and remove var $useConfig in your customer
> model (it uses default by, well, default).
> 
> If persistent is set to true,  you can't use two configs
> simultaneously. I'm guessing if persistent is true, and the default
> database config (host, username, password, database) is used, it keeps
> that connection open. Then, when your other model comes into play it
> will try to use the same connection.
> 
> On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> wrote:
> > > You're welcome. In doing this, I learned about the persistent key, so
> > > everyone wins. Let us know how it goes.
> >
> > Just tried this at home and I'm baffled with this error: Cannot redeclare 
> > class dbosource in /var/www/cake/cake/libs/model/datasources/dbo_source.php
> >
> > Here's my setup:
> >
> > app/config/database.php:
> > ===
> >
> >   var $psw = array('driver' => 'mysql',
> > 'connect' => 'mysql_connect',
> > 'host' => 'localhost',
> > 'login' => '***',
> > 'password' => '***',
> > 'database' => 'psw',
> > 'persistent' => false,
> > 'prefix' => '');
> >
> >   var $pbs = array('driver' => 'mysql',
> > 'connect' => 'mysql_connect',
> > 'host' => 'localhost',
> > 'login' => '***',
> > 'password' => '***',
> > 'database' => 'pbs',
> > 'persistent' => false,
> > 'prefix' => '');
> >
> > app/models/student.php
> > ===
> >  > class Student extends AppModel
> > {
> >   var $name = 'Student';
> >   var $useDbConfig = 'pbs';
> >
> >   var $belongsTo = array(
> > 'Customer' => array('className' => 'Customer')
> >   );}
> >
> > ?>
> >
> > app/models/customer.php
> > ===
> >  > class Customer extends AppModel
> > {
> >   var $name = 'Customer';
> >   var $useDbConfig = 'psw';}
> >
> > ?>
> >
> > Am I missing something?
> 
> 
> > 

-- 

Sergei Gerasenko
IT Department
PublicSchoolWORKS
Phone: (513)-631-6111

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

I ran into this too. One of the database configs has to be default. So
change $psw to $default, and remove var $useConfig in your customer
model (it uses default by, well, default).

If persistent is set to true,  you can't use two configs
simultaneously. I'm guessing if persistent is true, and the default
database config (host, username, password, database) is used, it keeps
that connection open. Then, when your other model comes into play it
will try to use the same connection.

On Apr 9, 4:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> > You're welcome. In doing this, I learned about the persistent key, so
> > everyone wins. Let us know how it goes.
>
> Just tried this at home and I'm baffled with this error: Cannot redeclare 
> class dbosource in /var/www/cake/cake/libs/model/datasources/dbo_source.php
>
> Here's my setup:
>
> app/config/database.php:
> ===
>
>   var $psw = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'psw',
> 'persistent' => false,
> 'prefix' => '');
>
>   var $pbs = array('driver' => 'mysql',
> 'connect' => 'mysql_connect',
> 'host' => 'localhost',
> 'login' => '***',
> 'password' => '***',
> 'database' => 'pbs',
> 'persistent' => false,
> 'prefix' => '');
>
> app/models/student.php
> ===
>  class Student extends AppModel
> {
>   var $name = 'Student';
>   var $useDbConfig = 'pbs';
>
>   var $belongsTo = array(
> 'Customer' => array('className' => 'Customer')
>   );}
>
> ?>
>
> app/models/customer.php
> ===
>  class Customer extends AppModel
> {
>   var $name = 'Customer';
>   var $useDbConfig = 'psw';}
>
> ?>
>
> Am I missing something?


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



Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

> You're welcome. In doing this, I learned about the persistent key, so
> everyone wins. Let us know how it goes.

Just tried this at home and I'm baffled with this error: Cannot redeclare class 
dbosource in /var/www/cake/cake/libs/model/datasources/dbo_source.php

Here's my setup:

app/config/database.php:
===

  var $psw = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => '***',
'password' => '***',
'database' => 'psw',
'persistent' => false,
'prefix' => '');

  var $pbs = array('driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => '***',
'password' => '***',
'database' => 'pbs',
'persistent' => false,
'prefix' => '');



app/models/student.php
===
 array('className' => 'Customer')
  );
}
?>

app/models/customer.php
===


Am I missing something?

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



Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

I must admit that I should have asked you about what you found about
the persistent key thingy. Should it be set to "false" in this
situation? And if so, why do you think it's the case? Sorry if it sounds
like an interview question :)

On Mon, Apr 09, 2007 at 08:49:17PM -, BlenderStyle wrote:
> 
> You're welcome. In doing this, I learned about the persistent key, so
> everyone wins. Let us know how it goes.
> 
> On Apr 9, 1:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
> wrote:
> > Matt, thanks so much for all the time you took to test this thing. I
> > can see how it could work now. I'm off and running now.
> >
> > Thanks!!!
> >
> >
> >
> > On Mon, Apr 09, 2007 at 07:59:26PM -, BlenderStyle wrote:
> >
> > > Okay, I just tried it, and it worked. Here's what I did:
> >
> > > Downloaded cake_1.2.0.4798alpha, extracted it, and made app/tmp
> > > writeable.
> > > I created the following databases/users/tables:
> >
> > > database: multidbtest_a
> > > user: multidbtest_a
> > > table: users (id, name)
> >
> > > database: multidbtest_b
> > > user:multidbtest_b
> > > table: profiles (id, user_id, name)
> >
> > > I setup app/config/database.php as follows:
> > > var $default = array(
> > > 'driver' => 'mysql',
> > > 'persistent' => false,
> > > 'host' => 'localhost',
> > > 'login' => 'multidbtest_a',
> > > 'password' => 'NNJdALDhvm6Uqm8,',
> > > 'database' => 'multidbtest_a',
> > > 'prefix' => ''
> > > );
> >
> > > var $dbb = array(
> > > 'driver' => 'mysql',
> > > 'persistent' => false,
> > > 'host' => 'localhost',
> > > 'login' => 'multidbtest_b',
> > > 'password' => ':.bwaJ6wXCDQs8Q:',
> > > 'database' => 'multidbtest_b',
> > > 'prefix' => ''
> > > );
> >
> > > I created two models with two controllers. The first model is User:
> > > class User extends AppModel
> > > {
> > > var $name = 'User';
> > > var $useDbConfig = 'default';
> > > var $useTable = 'users';
> >
> > > var $hasOne = array(
> > > 'Profile' => array(
> > > 'className'=> 'Profile',
> > > 'foreignKey'   => 'user_id'
> > > )
> > > );
> > > }
> >
> > > The other model is Profile:
> > > class Profile extends AppModel
> > > {
> > > var $name = 'Profile';
> > > var $useDbConfig = 'dbb';
> > > var $useTable = 'profiles';
> >
> > > var $belongsTo = array(
> > > 'User' => array(
> > > 'className'=> 'User',
> > > 'foreignKey'   => 'user_id'
> > > )
> > > );
> > > }
> >
> > > Then, my two controllers:
> > > class UsersController extends AppController
> > > {
> > > var $name = 'users';
> > > var $scaffold;
> > > }
> >
> > > class ProfilesController extends AppController
> > > {
> > > var $name = 'profiles';
> > > var $scaffold;
> > > }
> >
> > > I browsed to somesite.com/users and created a couple of users, then
> > > went over to somesite.com/profiles and created some profiles for those
> > > users. That's it. Took about 5 minutes to get this up and running. The
> > > real key to making this work is the persistent key (ha! a pun) in the
> > > database configs. I think 1.2 defaults to persistent false, where 1.1
> > > doesn't.
> >
> > > Matt Bowden
> >
> > > On Apr 9, 10:10 am, Sergei Gerasenko <[EMAIL PROTECTED]>
> > > wrote:
> > > > > Yes, that should work. I haven't tried it, and I don't know how Cake
> > > > > queries in a situation like this, but it doesn't hurt to try. Try it
> > > > > out with scaffolding, and see if it works. Let us know.
> >
> > > > I think it would definitely stop working if database "B" has another
> > > > username/password combination. This whole issue could throw a big 
> > > > wrench into
> > > > the gears. But I'll try tonight anyway and will let you know.
> >
> > --
> >
> > Sergei Gerasenko
> > IT Department
> > PublicSchoolWORKS
> > Phone: (513)-631-6111
> 
> 
> > 

-- 

Sergei Gerasenko
IT Department
PublicSchoolWORKS
Phone: (513)-631-6111

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

You're welcome. In doing this, I learned about the persistent key, so
everyone wins. Let us know how it goes.

On Apr 9, 1:15 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> Matt, thanks so much for all the time you took to test this thing. I
> can see how it could work now. I'm off and running now.
>
> Thanks!!!
>
>
>
> On Mon, Apr 09, 2007 at 07:59:26PM -, BlenderStyle wrote:
>
> > Okay, I just tried it, and it worked. Here's what I did:
>
> > Downloaded cake_1.2.0.4798alpha, extracted it, and made app/tmp
> > writeable.
> > I created the following databases/users/tables:
>
> > database: multidbtest_a
> > user: multidbtest_a
> > table: users (id, name)
>
> > database: multidbtest_b
> > user:multidbtest_b
> > table: profiles (id, user_id, name)
>
> > I setup app/config/database.php as follows:
> > var $default = array(
> > 'driver' => 'mysql',
> > 'persistent' => false,
> > 'host' => 'localhost',
> > 'login' => 'multidbtest_a',
> > 'password' => 'NNJdALDhvm6Uqm8,',
> > 'database' => 'multidbtest_a',
> > 'prefix' => ''
> > );
>
> > var $dbb = array(
> > 'driver' => 'mysql',
> > 'persistent' => false,
> > 'host' => 'localhost',
> > 'login' => 'multidbtest_b',
> > 'password' => ':.bwaJ6wXCDQs8Q:',
> > 'database' => 'multidbtest_b',
> > 'prefix' => ''
> > );
>
> > I created two models with two controllers. The first model is User:
> > class User extends AppModel
> > {
> > var $name = 'User';
> > var $useDbConfig = 'default';
> > var $useTable = 'users';
>
> > var $hasOne = array(
> > 'Profile' => array(
> > 'className'=> 'Profile',
> > 'foreignKey'   => 'user_id'
> > )
> > );
> > }
>
> > The other model is Profile:
> > class Profile extends AppModel
> > {
> > var $name = 'Profile';
> > var $useDbConfig = 'dbb';
> > var $useTable = 'profiles';
>
> > var $belongsTo = array(
> > 'User' => array(
> > 'className'=> 'User',
> > 'foreignKey'   => 'user_id'
> > )
> > );
> > }
>
> > Then, my two controllers:
> > class UsersController extends AppController
> > {
> > var $name = 'users';
> > var $scaffold;
> > }
>
> > class ProfilesController extends AppController
> > {
> > var $name = 'profiles';
> > var $scaffold;
> > }
>
> > I browsed to somesite.com/users and created a couple of users, then
> > went over to somesite.com/profiles and created some profiles for those
> > users. That's it. Took about 5 minutes to get this up and running. The
> > real key to making this work is the persistent key (ha! a pun) in the
> > database configs. I think 1.2 defaults to persistent false, where 1.1
> > doesn't.
>
> > Matt Bowden
>
> > On Apr 9, 10:10 am, Sergei Gerasenko <[EMAIL PROTECTED]>
> > wrote:
> > > > Yes, that should work. I haven't tried it, and I don't know how Cake
> > > > queries in a situation like this, but it doesn't hurt to try. Try it
> > > > out with scaffolding, and see if it works. Let us know.
>
> > > I think it would definitely stop working if database "B" has another
> > > username/password combination. This whole issue could throw a big wrench 
> > > into
> > > the gears. But I'll try tonight anyway and will let you know.
>
> --
>
> Sergei Gerasenko
> IT Department
> PublicSchoolWORKS
> Phone: (513)-631-6111


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



Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

Matt, thanks so much for all the time you took to test this thing. I
can see how it could work now. I'm off and running now. 

Thanks!!!

On Mon, Apr 09, 2007 at 07:59:26PM -, BlenderStyle wrote:
> 
> Okay, I just tried it, and it worked. Here's what I did:
> 
> Downloaded cake_1.2.0.4798alpha, extracted it, and made app/tmp
> writeable.
> I created the following databases/users/tables:
> 
> database: multidbtest_a
> user: multidbtest_a
> table: users (id, name)
> 
> database: multidbtest_b
> user:multidbtest_b
> table: profiles (id, user_id, name)
> 
> I setup app/config/database.php as follows:
> var $default = array(
> 'driver' => 'mysql',
> 'persistent' => false,
> 'host' => 'localhost',
> 'login' => 'multidbtest_a',
> 'password' => 'NNJdALDhvm6Uqm8,',
> 'database' => 'multidbtest_a',
> 'prefix' => ''
> );
> 
> var $dbb = array(
> 'driver' => 'mysql',
> 'persistent' => false,
> 'host' => 'localhost',
> 'login' => 'multidbtest_b',
> 'password' => ':.bwaJ6wXCDQs8Q:',
> 'database' => 'multidbtest_b',
> 'prefix' => ''
> );
> 
> I created two models with two controllers. The first model is User:
> class User extends AppModel
> {
> var $name = 'User';
> var $useDbConfig = 'default';
> var $useTable = 'users';
> 
> var $hasOne = array(
> 'Profile' => array(
> 'className'   => 'Profile',
> 'foreignKey'  => 'user_id'
> )
> );
> }
> 
> The other model is Profile:
> class Profile extends AppModel
> {
> var $name = 'Profile';
> var $useDbConfig = 'dbb';
> var $useTable = 'profiles';
> 
> var $belongsTo = array(
> 'User' => array(
> 'className'   => 'User',
> 'foreignKey'  => 'user_id'
> )
> );
> }
> 
> Then, my two controllers:
> class UsersController extends AppController
> {
> var $name = 'users';
> var $scaffold;
> }
> 
> class ProfilesController extends AppController
> {
> var $name = 'profiles';
> var $scaffold;
> }
> 
> 
> I browsed to somesite.com/users and created a couple of users, then
> went over to somesite.com/profiles and created some profiles for those
> users. That's it. Took about 5 minutes to get this up and running. The
> real key to making this work is the persistent key (ha! a pun) in the
> database configs. I think 1.2 defaults to persistent false, where 1.1
> doesn't.
> 
> Matt Bowden
> 
> On Apr 9, 10:10 am, Sergei Gerasenko <[EMAIL PROTECTED]>
> wrote:
> > > Yes, that should work. I haven't tried it, and I don't know how Cake
> > > queries in a situation like this, but it doesn't hurt to try. Try it
> > > out with scaffolding, and see if it works. Let us know.
> >
> > I think it would definitely stop working if database "B" has another
> > username/password combination. This whole issue could throw a big wrench 
> > into
> > the gears. But I'll try tonight anyway and will let you know.
> 
> 
> > 

-- 

Sergei Gerasenko
IT Department
PublicSchoolWORKS
Phone: (513)-631-6111

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

Okay, I just tried it, and it worked. Here's what I did:

Downloaded cake_1.2.0.4798alpha, extracted it, and made app/tmp
writeable.
I created the following databases/users/tables:

database: multidbtest_a
user: multidbtest_a
table: users (id, name)

database: multidbtest_b
user:multidbtest_b
table: profiles (id, user_id, name)

I setup app/config/database.php as follows:
var $default = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'multidbtest_a',
'password' => 'NNJdALDhvm6Uqm8,',
'database' => 'multidbtest_a',
'prefix' => ''
);

var $dbb = array(
'driver' => 'mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'multidbtest_b',
'password' => ':.bwaJ6wXCDQs8Q:',
'database' => 'multidbtest_b',
'prefix' => ''
);

I created two models with two controllers. The first model is User:
class User extends AppModel
{
var $name = 'User';
var $useDbConfig = 'default';
var $useTable = 'users';

var $hasOne = array(
'Profile' => array(
'className' => 'Profile',
'foreignKey'=> 'user_id'
)
);
}

The other model is Profile:
class Profile extends AppModel
{
var $name = 'Profile';
var $useDbConfig = 'dbb';
var $useTable = 'profiles';

var $belongsTo = array(
'User' => array(
'className' => 'User',
'foreignKey'=> 'user_id'
)
);
}

Then, my two controllers:
class UsersController extends AppController
{
var $name = 'users';
var $scaffold;
}

class ProfilesController extends AppController
{
var $name = 'profiles';
var $scaffold;
}


I browsed to somesite.com/users and created a couple of users, then
went over to somesite.com/profiles and created some profiles for those
users. That's it. Took about 5 minutes to get this up and running. The
real key to making this work is the persistent key (ha! a pun) in the
database configs. I think 1.2 defaults to persistent false, where 1.1
doesn't.

Matt Bowden

On Apr 9, 10:10 am, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> > Yes, that should work. I haven't tried it, and I don't know how Cake
> > queries in a situation like this, but it doesn't hurt to try. Try it
> > out with scaffolding, and see if it works. Let us know.
>
> I think it would definitely stop working if database "B" has another
> username/password combination. This whole issue could throw a big wrench into
> the gears. But I'll try tonight anyway and will let you know.


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



Re: newbie question about multiple databases

2007-04-09 Thread Sergei Gerasenko

> Yes, that should work. I haven't tried it, and I don't know how Cake
> queries in a situation like this, but it doesn't hurt to try. Try it
> out with scaffolding, and see if it works. Let us know.

I think it would definitely stop working if database "B" has another
username/password combination. This whole issue could throw a big wrench into
the gears. But I'll try tonight anyway and will let you know.

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



Re: newbie question about multiple databases

2007-04-09 Thread BlenderStyle

Yes, that should work. I haven't tried it, and I don't know how Cake
queries in a situation like this, but it doesn't hurt to try. Try it
out with scaffolding, and see if it works. Let us know.

On Apr 8, 1:49 pm, Sergei Gerasenko <[EMAIL PROTECTED]>
wrote:
> On Sun, Apr 08, 2007 at 06:58:33PM -, BlenderStyle wrote:
>
> > A brief overview.
>
> > You need to create separate entries in your database config file, one
> > for each database. In your model, specify which database to use. Then,
> > in your controller, specify which models to use. You can use multiple
> > models in your controller. If you need to know the specifics of each
> > of these steps, search or ask here.
>
> Well, the problem I have is that in one of the models that belongs to
> database "A" I needed to include a "belongsTo" relationship with a model
> in database "B". Is that possible?


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



Re: newbie question

2007-04-09 Thread Sergei Gerasenko

Hello,

> I assume that you mean "3 schemas" when you say "3 databases".

I meant "database" as in the "CREATE DATABASE" statement in MySQL.

> I think you can select which schema you want to use on the fly.
> You can define the dbconfigs on the appropriate file and then switch
> between them using the model's $useDbConfig var.

Yep, that far I succeeded.

> As of putting the models and controllers on different folders, I'm
> pretty sure you can hack some way to get it to work, but I think
> that's definitely a bad practice, so I wouldn't advise you to do so.

I was suspecting that it wouldn't be possible but decided to run it by
you guys. Thank you for clarifying this. 

> As a complement of this brief explanation and also to answer to your
> 'Problem 2.' please read the Model section fo Cake Manual. I'm pretty
> sure you'll find useful information there, as well as clear answers to
> your questions.

See, I did read the Model portion of the manual but I don't think it
answers my question. Let me go into a little more detail.

Let's say I have a MySQL database named "A" and another one named "B".
Within "A", I have a table named A1. Within "B" I have a table
named B1. Let us now say that A.A1 has a foreign key in B.B1.

So, I'm trying to write a model for A.A1 with a foreign key to B.B1.
Here's where I get stuck:

class A1 extends AppModel
{
  var $name = 'A1';
  var $useDbConfig = 'dbConfig_A';

  var $belongsTo = array('B1' => array('className' => 'B1'));
}

I think the above is more or less correct, but as you can see B1 will be
searched within database "A", not database "B". And that's the problem I
was describing. 

Even though I could specify a database connection in a model, here I
have a situation where I need both connections because the tables are in
different databases (although both are under the same instance of the
MySQL server).

Hope there's a simple answer to this problem. Thanks for all your help.

Best regards,
  Sergei

> Good luck.
> 
> On Apr 8, 2:53 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> > Hi everybody,
> >
> > I'm considering converting my application into CakePHP.
> >
> > Currently I have 3 databases within my application and the first one
> > has several tables that are referenced by tables in the other two
> > databases.
> >
> > Problem 1. I have tables that are named the same in at least two
> > databases. Can models, controllers and views be isolated to a folder
> > that would correspond to a specific database? Cake Views are already
> > in a folder by the controller name but models and controllers exist in
> > the same directories.
> >
> > Problem 2. I don't know how to describe a model that has a
> > relationship with a table from a different database.
> >
> > What's the best way to handle this situation in Cake?
> 
> 
> > 

-- 

Sergei Gerasenko
IT Department
PublicSchoolWORKS
Phone: (513)-631-6111

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



Re: newbie question

2007-04-09 Thread Jan Boonen

Hi,

You can also use different names for your models. With the class
variable $useTable, you can let the model point to any table in your
schema. As mindcharger already said, you can use the class variable
$useDbConfig to let the model use the correct schema/database.

Cheers,

Jan


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



Re: newbie question

2007-04-09 Thread mindcharger

Hello,

I assume that you mean "3 schemas" when you say "3 databases".

I think you can select which schema you want to use on the fly.
You can define the dbconfigs on the appropriate file and then switch
between them using the model's $useDbConfig var.

As of putting the models and controllers on different folders, I'm
pretty sure you can hack some way to get it to work, but I think
that's definitely a bad practice, so I wouldn't advise you to do so.

As a complement of this brief explanation and also to answer to your
'Problem 2.' please read the Model section fo Cake Manual. I'm pretty
sure you'll find useful information there, as well as clear answers to
your questions.

Good luck.

On Apr 8, 2:53 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi everybody,
>
> I'm considering converting my application into CakePHP.
>
> Currently I have 3 databases within my application and the first one
> has several tables that are referenced by tables in the other two
> databases.
>
> Problem 1. I have tables that are named the same in at least two
> databases. Can models, controllers and views be isolated to a folder
> that would correspond to a specific database? Cake Views are already
> in a folder by the controller name but models and controllers exist in
> the same directories.
>
> Problem 2. I don't know how to describe a model that has a
> relationship with a table from a different database.
>
> What's the best way to handle this situation in Cake?


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



Re: newbie question about multiple databases

2007-04-08 Thread Sergei Gerasenko

On Sun, Apr 08, 2007 at 06:58:33PM -, BlenderStyle wrote:
> 
> A brief overview.
> 
> You need to create separate entries in your database config file, one
> for each database. In your model, specify which database to use. Then,
> in your controller, specify which models to use. You can use multiple
> models in your controller. If you need to know the specifics of each
> of these steps, search or ask here.

Well, the problem I have is that in one of the models that belongs to
database "A" I needed to include a "belongsTo" relationship with a model
in database "B". Is that possible?

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



Re: newbie question about multiple databases

2007-04-08 Thread BlenderStyle

A brief overview.

You need to create separate entries in your database config file, one
for each database. In your model, specify which database to use. Then,
in your controller, specify which models to use. You can use multiple
models in your controller. If you need to know the specifics of each
of these steps, search or ask here.

Matt

On Apr 8, 9:09 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hmm, I posted this a couple of hours ago but couldn't find it in the
> post list. So, I'm posting it again. Sorry if this is the second time
> you guys are getting it.
>
> ===
> Hi everybody,
>
> I'm considering converting my application into CakePHP.
>
> Currently I have 3 databases within my application and the first one
> has several tables that are referenced by tables in the other two
> databases.
>
> Problem 1. I have tables that are named the same in at least two
> databases. Can models, controllers and views be isolated to a folder
> that would correspond to a specific database? Cake Views are already
> in a folder by the controller name but models and controllers exist in
> the same directories.
>
> Problem 2. I don't know how to describe a model that has a
> relationship to a table from a different database.
>
> What's the best way to handle this situation in Cake?


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



  1   2   >