Re: Plugin questions

2007-06-18 Thread AD7six



On Jun 19, 12:39 am, Geoff Ford <[EMAIL PROTECTED]> wrote:
> Thanks AD, I'll be integrating 1897 and 2526 into my install. It lloks
> like they will solve my problems.
>
> I will still need to look into the behaviours issue though I think.
> It would be really great if these would work as expected.

I get the feeling that it will be a short lived problem.

If you are impatient ( :) ), you might manage to get what you want if
you put a call to this method in your plugin somewhere (e.g. in the
plugin app model file, outside the class).
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/configure.php?rev=5132#L419

You would normally just define the $behaviorPaths var in your
bootstrap (__loadBootstrap in that file would pick up your definition
and add it), but unless you scan and add all plugins model behavior
folders (overhead) or make an assumption from the url and include a
plugin, that's too early.

hth,

AD


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



Re: problem with switching layouts

2007-06-18 Thread sushil

Thanks for pointing out my error. It works now. Thanks again.

On Jun 18, 6:01 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 6/18/07, sushil <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi All,
> > I have again come across a problem. I have static page (rendered by
> > pages controller) - loginbox and I have a layout for it.
>
> > While running the application, if a session is set, then the app will
> > run else a login box is to be displayed. For the login box, there is
> > different layout (loginbox.thtml). The code to change layout is:
> > --
> >  if($this->name ='Pages')
> > {
> > if($this->action = 'loginbox')
> > {
> > $this->layout = 'loginbox';
> > }
> > }
> > else
> > $this->layout = 'default';
> > -
>
> I'm hoping it's a typo in you code, but shouldn't it say:
>
> if ($this->name == 'Pages')
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



Re: cakex html inside controller

2007-06-18 Thread francky06l

you can do this using ajax and some javascript (have a look to the CJS
from Rosssoft)

On Jun 19, 6:13 am, pete <[EMAIL PROTECTED]> wrote:
> hm..you are right, the thing is i want to have the "add-form" on the
> same page as where i show the data.
> is there a way to assign('add') the view.html code?
>
> something like
>   $objResponse->assign('add', 'innerHTML',$??view.thtml??);
>
> thanks pete
>
> On Jun 18, 8:40 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
> > I wouldn't be doing it
>
> >  - Breaks MVC putting html in the controller.
> >  - Mixing presentation with business logic is never good
> >  - Harder to update
> >  - DOes not allow for multiple presentation types
>
> > On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
>
> > > hi,
> > > im using cakex (xajax) for my project. i'm just curious if its a good
> > > idea to put html code inside the controller
> > > for example i have a ajax "addForm".
> > > Do you think this is a good idea to do it or is it better to have all
> > > html code inside a view.thtml ?
>
> > > thanks
>
> > > pete
>
> > > VIEW
> > > link('Add new item', '/phases/formAdd/'); ?>
> > > 
>
> > > CONTROLLER
>
> > >  function formAdd(){
> > >$this->autoRender = false;
> > >$objResponse =& $this->Cakex->response;
> > >$objResponse = new xajaxResponse();
>
> > >$html = '
> > > 
> > > 
> > > 
> > > Last Name*
> > >  > > id="lastname" name="lastname"
> > > size="25">fff
> > > 
>
> > > 
> > >  > > id="submitButton" onClick=
> > > \'...\'>Continue
> > > 
> > > 
> > >'
> > >   $objResponse->assign('add', 'innerHTML',$html);
>
> > > }
> > > }


--~--~-~--~~~---~--~~
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: updating records without forms

2007-06-18 Thread BoSc

Thanks, works like a charm.

The problem was I didn't know how to create a reference to a certain
row, so this line helped me crack it: $this->Country->id =
$item['Country']['id'];

Thanks.

On Jun 18, 7:23 pm, "John David Anderson (_psychic_)"
<[EMAIL PROTECTED]> wrote:
> On Jun 18, 2007, at 11:15 AM, BoSc wrote:
>
>
>
> > Hi,
>
> > I want to use a update function in my controller that flips a boolean
> > field only.
>
> > I call the page withhttp://website/mode/flip/slug
>
> > When this function is called, it should check whether the database
> > entry for "slug" in "model" contains a 0 or a 1, additionaly it should
> > write the opposite value back. How should I accomplish this?
>
> > i used
>
> > $item = $this->Country->findBySlug($slug);
>
> $this->Country->id = $item['Country']['id'];
>
> if($item['Country']['nameofbooleanfield'])
> {
> $this->Country->saveField('nameofbooleanfield', 0);}
>
> else
> {
> $this->Country->saveField('nameofbooleanfield', 1);
>
> }
>
> You'd want to throw in some error checking (to make sure the Country
> with the slug is found, etc.), but this is one way you could do it.
>
> -- John


--~--~-~--~~~---~--~~
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: cakex html inside controller

2007-06-18 Thread pete

hm..you are right, the thing is i want to have the "add-form" on the
same page as where i show the data.
is there a way to assign('add') the view.html code?

something like
  $objResponse->assign('add', 'innerHTML',$??view.thtml??);

thanks pete


On Jun 18, 8:40 pm, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I wouldn't be doing it
>
>  - Breaks MVC putting html in the controller.
>  - Mixing presentation with business logic is never good
>  - Harder to update
>  - DOes not allow for multiple presentation types
>
> On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
>
> > hi,
> > im using cakex (xajax) for my project. i'm just curious if its a good
> > idea to put html code inside the controller
> > for example i have a ajax "addForm".
> > Do you think this is a good idea to do it or is it better to have all
> > html code inside a view.thtml ?
>
> > thanks
>
> > pete
>
> > VIEW
> > link('Add new item', '/phases/formAdd/'); ?>
> > 
>
> > CONTROLLER
>
> >  function formAdd(){
> >$this->autoRender = false;
> >$objResponse =& $this->Cakex->response;
> >$objResponse = new xajaxResponse();
>
> >$html = '
> > 
> > 
> > 
> > Last Name*
> >  > id="lastname" name="lastname"
> > size="25">fff
> > 
>
> > 
> >  > id="submitButton" onClick=
> > \'...\'>Continue
> > 
> > 
> >'
> >   $objResponse->assign('add', 'innerHTML',$html);
>
> > }
> > }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



More about Behaviors ?

2007-06-18 Thread Max

Hi All,

I've been trying to find more about behaviors to start with them. But
I dont seem to find much information about them anywhere on the
CakePHP sites/Internet..

However, There are a lot of behaviors code snippets available, but
what I'm looking after is some more basic information like - why we
use them ? what are the advantages ? etc...

I would appreciate your response. Thanks a lot...

Max


--~--~-~--~~~---~--~~
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: Session expire after browser window close

2007-06-18 Thread Sergei

Ok thanks.

So as I understand sessions in CakePHP right, setting session security
to HIGH and needed timeout will give me desired behaviour with session
cookie with lifetime=0, true?


> I am no expert on the ways that firefox and IE or any other's may handle
>
> sessions and thier destruction upon close, but is it possible that you are
> looking from one point of view in this matter? Does this issue replicate
> itself in any other browsers? If so which?


--~--~-~--~~~---~--~~
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: cakex html inside controller

2007-06-18 Thread Geoff Ford

I wouldn't be doing it

 - Breaks MVC putting html in the controller.
 - Mixing presentation with business logic is never good
 - Harder to update
 - DOes not allow for multiple presentation types

On Jun 19, 12:52 pm, pete <[EMAIL PROTECTED]> wrote:
> hi,
> im using cakex (xajax) for my project. i'm just curious if its a good
> idea to put html code inside the controller
> for example i have a ajax "addForm".
> Do you think this is a good idea to do it or is it better to have all
> html code inside a view.thtml ?
>
> thanks
>
> pete
>
> VIEW
> link('Add new item', '/phases/formAdd/'); ?>
> 
>
> CONTROLLER
>
>  function formAdd(){
>$this->autoRender = false;
>$objResponse =& $this->Cakex->response;
>$objResponse = new xajaxResponse();
>
>$html = '
> 
> 
> 
> Last Name*
>  id="lastname" name="lastname"
> size="25">fff
> 
>
> 
>  id="submitButton" onClick=
> \'...\'>Continue
> 
> 
>'
>   $objResponse->assign('add', 'innerHTML',$html);
>
> }
> }


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cakex html inside controller

2007-06-18 Thread pete

hi,
im using cakex (xajax) for my project. i'm just curious if its a good
idea to put html code inside the controller
for example i have a ajax "addForm".
Do you think this is a good idea to do it or is it better to have all
html code inside a view.thtml ?

thanks

pete



VIEW
link('Add new item', '/phases/formAdd/'); ?>


CONTROLLER

 function formAdd(){
   $this->autoRender = false;
   $objResponse =& $this->Cakex->response;
   $objResponse = new xajaxResponse();

   $html = '



Last Name*
fff



Continue


 '
  $objResponse->assign('add', 'innerHTML',$html);
}
}


--~--~-~--~~~---~--~~
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: Session expire after browser window close

2007-06-18 Thread Ronald Chaplin
On 6/18/07, Sergei <[EMAIL PROTECTED]> wrote:
>
>
> On 18 июн, 21:08, Grant Cox <[EMAIL PROTECTED]> wrote:
> > > How to make session expire after browser close? It's a default PHP
> > > session behaviour,
> >
> > Really?  In my experience closing the browser causes the browser to
> > forget your session cookie (as that's what it is meant to do), but the
> > server is not informed of this and keeps the session active for the
>
>
> Yes I know.
>
>
> > normal amount of time.  I have not seen any change in this behaviour
> > with CakePHP.
> >
> > How are you finding that Cake is not expiring the session, where a
> > "normal" PHP script does?  Are you looking at the server side session
> > files?  Can you post a sample PHP script that automatically destroys
> > this session with just a browser close?
>
> Well, it's true but.. seems strange that it's holding session longer.
> Have you ever logged such way to any site when you close the browser
> then go to site again and see that session expired? Of course you
> have. That's what I'm talking about.
>
> Thank you.
>
> I am no expert on the ways that firefox and IE or any other's may handle
sessions and thier destruction upon close, but is it possible that you are
looking from one point of view in this matter? Does this issue replicate
itself in any other browsers? If so which?


-- 
Thanks,
Ron Chaplin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
T73 Software & Design
www.t73-softdesign.com
We'll make all of your wildest
e-Commerce dreams come true!

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



Re: Is the bakery source code broken?

2007-06-18 Thread Sebastian Macias

Sorry for posting the same message twice.. it was google groups
caching fault :)

On Jun 18, 7:01 pm, Sebastian Macias <[EMAIL PROTECTED]>
wrote:
> I just tried it out with the latest 1.2.x nightly build and got the
> same errors; then I tried it with an old 1.2x copy I had and this time
> I got less error but new ones appeared like user record no being
> created after user signup even thought confirmation message does
> appear.
>
> is there anyway we can know what when was the last time thebakery
> cake folder was updated so we can try to download a revision that
> matches that date?
>
> Thanks,
>
> Sebastian Macias
>
> -- Forwarded message --
> From: "Jonathan Langevin" <[EMAIL PROTECTED]>
> Date: Jun 17, 7:15 pm
> Subject: Is thebakerysource codebroken?
> To: Cake PHP
>
> ha, that might explain thebrokenfeatures :-)
>
> On 6/17/07, Larry E. Masters aka PhpNut <[EMAIL PROTECTED]> wrote:
>
> > Thebakeryuses the 1.2 branch of the code.
> > All of out sites are running on the latest svn co of the 1.2 branch. Do
> > not confuse it with the trunk code, which is merged after the branches have
> > been tested.
>
> > The nightly builds of 1.2.x.x are also from the same branch that the
> >bakeryis using.
>
> > --
> > /**
> > * @author Larry E. Masters
> > * @var string $userName
> > * @param string $realName
> > * @returns string aka PhpNut
> > * @access  public
> > */


--~--~-~--~~~---~--~~
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: Is the bakery source code broken?

2007-06-18 Thread Sebastian Macias

I just tried it out with the latest 1.2.x nightly build and got the
same errors; then I tried it with an old 1.2x copy I had and this time
I got less error but new ones appeared like user record no being
created after user signup even thought confirmation message does
appear.

is there anyway we can know what when was the last time the bakery
cake folder was updated so we can try to download a revision that
matches that date?

Thanks,

Sebastian Macias


-- Forwarded message --
From: "Jonathan Langevin" <[EMAIL PROTECTED]>
Date: Jun 17, 7:15 pm
Subject: Is the bakery source code broken?
To: Cake PHP


ha, that might explain the broken features :-)

On 6/17/07, Larry E. Masters aka PhpNut <[EMAIL PROTECTED]> wrote:



> The bakery uses the 1.2 branch of the code.
> All of out sites are running on the latest svn co of the 1.2 branch. Do
> not confuse it with the trunk code, which is merged after the branches have
> been tested.

> The nightly builds of 1.2.x.x are also from the same branch that the
> bakery is using.

> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */


--~--~-~--~~~---~--~~
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: Is the bakery source code broken?

2007-06-18 Thread Sebastian Macias

I just downloaded the cakephp nightly build 1.2.x.x_17.06.2007.zip and
the latest bakery revision to give it a try and I still got the same
errors. Registration goes to a blank page, etc.. then I decided to try
with an old cakephp 1.2.x copy that I had and this time I got less
errors but some new errors appeared like user record not being created
when user signs up even thought account creation message is
displayed.

Is there anyway we can know the exact revision the bakery is running
on? or the date it was last updated so we can try to download a
revision that matches the date from SVN.

Thanks,

Sebastian Macias

On Jun 17, 5:58 pm, "Larry E. Masters aka PhpNut" <[EMAIL PROTECTED]>
wrote:
> The bakery uses the 1.2 branch of the code.
> All of out sites are running on the latest svn co of the 1.2 branch. Do not
> confuse it with the trunk code, which is merged after the branches have been
> tested.
>
> The nightly builds of 1.2.x.x are also from the same branch that the bakery
> is using.
>
> --
> /**
> * @author Larry E. Masters
> * @var string $userName
> * @param string $realName
> * @returns string aka PhpNut
> * @access  public
> */


--~--~-~--~~~---~--~~
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: Session expire after browser window close

2007-06-18 Thread Sergei

On 18 июн, 21:08, Grant Cox <[EMAIL PROTECTED]> wrote:
> > How to make session expire after browser close? It's a default PHP
> > session behaviour,
>
> Really?  In my experience closing the browser causes the browser to
> forget your session cookie (as that's what it is meant to do), but the
> server is not informed of this and keeps the session active for the


Yes I know.


> normal amount of time.  I have not seen any change in this behaviour
> with CakePHP.
>
> How are you finding that Cake is not expiring the session, where a
> "normal" PHP script does?  Are you looking at the server side session
> files?  Can you post a sample PHP script that automatically destroys
> this session with just a browser close?

Well, it's true but.. seems strange that it's holding session longer.
Have you ever logged such way to any site when you close the browser
then go to site again and see that session expired? Of course you
have. That's what I'm talking about.

Thank you.


--~--~-~--~~~---~--~~
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: upload behavior

2007-06-18 Thread mastorna

Just wanted to quickly say thanks to this thread, I got the uploader
script running quite easily!  Thanks Geoff for you're great post,
which really clarified the details of this script.  Has anyone been
keen on adding in an Ajax progress bar?  Right now, I've got a simple
gif displayed on submit, but would love to see a nice helper for the
visual display of the file being uploaded.

-lm

On Jun 15, 4:10 am, "Tane Piper" <[EMAIL PROTECTED]>
wrote:
> Hmm - Now I get the same thing, but the images are readable from my
> website, it's only when I view them in Gnome that I can't see the
> uploaded image, but can see the thumbnails.
>
> I think it's due to the permissions with the www-data user, which
> means apache should have no problem reading them.  If you want to view
> the files you should add yourself to the group.
>
> On 6/15/07, luke BAKING barker <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > I get the same thing when I look at the file put in images/  I cannot
> > read it, but all the generated thumbs are readable, how should th
> > epermissions be on directory /files/images then on a Unix system so
> > that when PHP moves the uploaded image to the directory it and all the
> > created thumbs are rendered readable by a website visitor?
>
> > Great behavior though Tane, thanks, of course,  to Chris P too for his
> > work.
>
> > Thanks,
>
> > Luke
>
> > On Jun 15, 2:27 am, Chris Partridge <[EMAIL PROTECTED]> wrote:
> > > Here we go:http://bin.cakephp.org/view/871631430
>
> > > Don't think I changed anything else apart from the callback, however
> > > this was only added in the later revisions of 1.2 from what I can see
> > > (as I had to manually add it to the model at one stage).
>
> > > On Jun 14, 11:16 pm, "Tane Piper" <[EMAIL PROTECTED]>
> > > wrote:
>
> > > > Please do, it sounds like a much better idea to do it before validation!
>
> > > > On 6/14/07, Chris Partridge <[EMAIL PROTECTED]> wrote:
>
> > > > > Looks good Tane.
>
> > > > > One thing I have changed in my latest version is the callback where
> > > > > the behavior is executed, moving it from beforeSafe to beforeValidate
> > > > > - that way the file canupload(or attempt to), making it easier to
> > > > > use standard cake validation.
>
> > > > > I'll paste it in the bin tomorrow.
>
> > > > > Cheers,
> > > > > Chris
>
> > > > > On Jun 14, 8:15 pm, "Tane Piper" <[EMAIL PROTECTED]>
> > > > > wrote:
> > > > > > OK Folks, I've uploaded 1.1 of the behaviour.  Until the article is
> > > > > > approved again on the Bakery, I've also added it to the bin:
>
> > > > > >http://bin.cakephp.org/view/82605077
>
> > > > > > On 6/14/07, Allen Romero <[EMAIL PROTECTED]> wrote:
>
> > > > > > > actually this was one of the problems. the directories were 
> > > > > > > writable
> > > > > > > by the app but not readable by me. chmod 755'ing everything fixed 
> > > > > > > the
> > > > > > > what appeared to be corrupt image problem. :-)
>
> > > > > > > thx.
>
> > > > > > > allen
>
> > > > > > > On 6/14/07, Allen Romero <[EMAIL PROTECTED]> wrote:
> > > > > > > > On 6/13/07, Joshua McFarren <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > I know this sounds really obvious, but these obvious things 
> > > > > > > > > are
> > > > > > > > > usually what I overlook and get stuck on:
>
> > > > > > > > > Is the directory you're trying to save the image to writable 
> > > > > > > > > by the
> > > > > > > > > app?
>
> > > > > > > > Yep. Checked this. doesn't seem to be the problem. thx. for the 
> > > > > > > > pointer though.
>
> > > > > > > > > On my Debian GNU/Linux server Apache is in the group 
> > > > > > > > > www-data, so for
> > > > > > > > > this example you would need to:
> > > > > > > > > $ sudo chgrp www-data 
> > > > > > > > > /var/www/cakex/app/webroot/files/Image
> > > > > > > > > $ sudo chown g=rwX /var/www/cakex/app/webroot/files/Image
>
> > > > > > > > > You'll need to change the groups and paths for your 
> > > > > > > > > configuration
> > > > > > > > > or all the syntax if you're not on a *nix system.
>
> > > > > > --
> > > > > > Tane Piperhttp://webrocket.wordpress.com
>
> > > > > > This email is: [ ] blogable [ x ] ask first [ ] private
>
> > > > --
> > > > Tane Piperhttp://digitalspaghetti.tooum.net
>
> > > > This email is: [ ] blogable [ x ] ask first [ ] private
>
> --
> Tane Piperhttp://digitalspaghetti.tooum.net
>
> This email is: [ ] blogable [ x ] ask first [ ] private


--~--~-~--~~~---~--~~
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: Please help with the structure of my code

2007-06-18 Thread Grant Cox

With in-query search like this I use named parameters - ie
/locations/find/term:leeds/field:city

This way the parameter order is not important, and it is easy to
substitute default values for anything not provided.  My specific
implementation is something like:


function index()
{
$conditions = array();

// get any conditions from the search / find url parameters
$url_conditions = $this->_url_conditions('MyModel');
if ( !empty($url_conditions) ){
$conditions[] = $url_conditions;
}

$data = $this->MyModel->findAll( $conditions );

$view_data = array(
'data' => $data
);
$this->set( $view_data );
}


function _url_conditions( $model )
{
$conditions = array();

// check if named parameters were provided
$passed_search_term = val( @$this->passedArgs['search'], @$this-
>passedArgs['find'] );

if ( !empty($passed_search_term) ){
$passed_search_term = urldecode($passed_search_term);

// we want to search for this value
loadModel( $model );
$this->{$model} = new $model();

$search_fields = array();
$search_conditions = array();

if ( !empty($this->passedArgs['field']) ){
// a specific field was given
$search_fields = array( 
$this->passedArgs['field'] );

} else {
// use all of the model's search fields
if ( !empty($this->{$model}->searchFields) and 
is_array($this-
>{$model}->searchFields) ){
$search_fields = 
$this->{$model}->searchFields;
} else {
$search_fields = array( 'title', 
'name', 'description' );
}
}

// now check that these fields exist
foreach ( $search_fields as $search_field ){
if ( $this->{$model}->hasField($search_field) ){
$field_type = 
$this->{$model}->getColumnType($search_field);

if ( $field_type == 'string' or 
$field_type == 'text' ){
$search_conditions[ 
$model.'.'.$search_field ] = 'LIKE %'.
$passed_search_term.'%';
} else {
$search_conditions[ 
$model.'.'.$search_field ] =
$passed_search_term;
}
}
}

if ( !empty($search_conditions) ){
if (count($search_conditions) > 1){
$conditions['OR'] = $search_conditions;
} else {
$conditions = $search_conditions;
}
}
}

return $conditions;
}


--~--~-~--~~~---~--~~
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: Design questions

2007-06-18 Thread [EMAIL PROTECTED]

Thanks for the suggestions. I'll have to try that out when i get out
of work.

On Jun 17, 5:28 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> I would keep the functionality in separate controllers, not bloat your
> Users one just because you want to access the User model.  To ensure
> that users cannot view/edit someone elses data you just need to
> incorporate this into whatever ACL you use.  For our application I
> have a function in app_model called isUserOwned( $user_id, $row_id ),
> which just does a lookup to see if the requested row is owned by the
> passed user id.  This can easily be included in all my controller
> actions before allowing the request to proceed.


--~--~-~--~~~---~--~~
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: Plugin questions

2007-06-18 Thread Geoff Ford

Thanks AD, I'll be integrating 1897 and 2526 into my install. It lloks
like they will solve my problems.

I will still need to look into the behaviours issue though I think.
It would be really great if these would work as expected.

Cheers,
Geoff

On Jun 18, 4:52 pm, AD7six <[EMAIL PROTECTED]> wrote:
> On Jun 18, 3:45 am,GeoffFord<[EMAIL PROTECTED]> wrote:
>
>
>
> > I have just started making a plugin for cakephp 1.2 and have noticed a
> > few oddities.
>
> > The first was that the official testsuite does not include support for
> > plugin tests.  I have put in a ticket on trac (https://
> > trac.cakephp.org/ticket/2777) with a partial patch that allows you to
> > run tests stored in app/plugins/plugin_name/tests through a browser.
> > (Still worrking on the TextManager).  Is this something that the Test
> > Suite team is working on? Or are plugins not going to be supported?
>
> > The second is that plugins can't load behaviours from within
> > themselves, only application level behaviours.  I have not tested but
> > assume that components and helpers are similar.  This makes it hard to
> > make a plugin self contained.
>
> > Third, I think /app/plugins/plugin_name/routes.php should be supported
> > and possibly self contained css, img and js.
>
> > I have not had a look at doing anything for 2 and 3 so I have no idea
> > how easy/viable this would be, but I think it would be a great help to
> > make plugins as fully self contained as possible.
>
> > Is this a goal for plugins or am I on my own here?
>
> I think enabling plugin tests for the test suite is desirable, I know
> I want it to work, for the rest have a look at existing tickets
> (https://trac.cakephp.org/search?ticket=on&q=plugin),
>
> namely:https://trac.cakephp.org/ticket/2447
> mildly 
> relaventhttps://trac.cakephp.org/ticket/1897https://trac.cakephp.org/ticket/2526
>
> Reading routes from a plugin is imo not necessary - it's impractical
> to try to load plugin routes (you need to load all routes before
> parsing the url, i.e. its the app that defines the routes). However,
> if you define your urls as arrays, a single change to your routes file
> will work as you would expect if you have 2626 or something
> similar in place.
>
> hth,
>
> AD
> PS it's only behaviors atm that don't work when in a plugin.


--~--~-~--~~~---~--~~
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: Ajax.Updater does not want to update

2007-06-18 Thread Christopher E. Franklin, Sr.

Try using the built in ajax helper.  This is how I did one of my
fields:

echo "Middle Initial: " . $html->input('User/middleinitial',
array (
'size' => 30
))."";

echo $html->tagErrorMsg('User/middleinitial', 'The middle initial
should be one letter and may have a period.');

// HERE HERE HERE
echo $ajax->observeField('UserMiddleinitial', array (
'url' => 'check_registration_form/middleinitial/',
'update' => 'userRegisterMiddleinitial',
'frequency' => 0.001, 
'loading' =>
"document.getElementById('userRegisterMiddleinitial').style.display =
'block'",
'loaded' =>
"document.getElementById('userRegisterMiddleinitial').style.display =
'block'"
));
// END END END
On Jun 18, 2:54 pm, TheTorst <[EMAIL PROTECTED]> wrote:
> Hi, I'm trying to create a form were a select input calls Ajax.Update
> onChange. I'm starting to get frustrated since my ajax function seems
> to be completely dead, nothing happens onChange.
>
> Here are some snippets of my code:
> --index.thtml--
>  echo $form->create('User', array('action' => '/addPurchase'));
> echo $form->input('Purchase/group_id', array('label' => 'Select group:
> ', 'onchange' => "new Ajax.Updater('checkboxes', '/users/
> updatecheckboxes/', {asynchronous:true, evalScripts:true});", 'empty'
> => false));?>
> 
>  foreach ($groupmembers as $member){
> echo $form->input('checkbox'.$member['id'], array(
> 'label' => $member['username'],
> 'type' => 'checkbox',
> 'empty' => false));}?>
>
> 
>  echo $form->Submit('Submit',array('div'=>false,'id'=>"button"));
> echo $form->end(Null);
> --end of index.thtml--
> --users_controller.php--
> ...
> var $helpers = array('Form','Ajax','Javascript','Html');
> ...
> function updatecheckboxes(){
> $myGroup = $this->User->Group->findById('2');
> $this->set('groupmembers', $myGroup['User']);
> $this->render('checkboxes','ajax');
> }
> ...
> --end of users_controller.php--
> --checkboxes.thtml--
>  foreach ($groupmembers as $member){
> echo $form->input('checkbox'.$member['id'], array(
> 'label' => $member['username'].'1',
> 'type' => 'checkbox',
> 'empty' => false));
> echo 'hello';}?>
>
> --end of checkboxes.thtml--
>
> My page head looks like this:
> 
> 

Ajax.Updater does not want to update

2007-06-18 Thread TheTorst

Hi, I'm trying to create a form were a select input calls Ajax.Update
onChange. I'm starting to get frustrated since my ajax function seems
to be completely dead, nothing happens onChange.

Here are some snippets of my code:
--index.thtml--
create('User', array('action' => '/addPurchase'));
echo $form->input('Purchase/group_id', array('label' => 'Select group:
', 'onchange' => "new Ajax.Updater('checkboxes', '/users/
updatecheckboxes/', {asynchronous:true, evalScripts:true});", 'empty'
=> false));?>

input('checkbox'.$member['id'], array(
'label' => $member['username'],
'type' => 'checkbox',
'empty' => false));
}?>

Submit('Submit',array('div'=>false,'id'=>"button"));
echo $form->end(Null);
--end of index.thtml--
--users_controller.php--
...
var $helpers = array('Form','Ajax','Javascript','Html');
...
function updatecheckboxes(){
$myGroup = $this->User->Group->findById('2');
$this->set('groupmembers', $myGroup['User']);
$this->render('checkboxes','ajax');
}
...
--end of users_controller.php--
--checkboxes.thtml--
input('checkbox'.$member['id'], array(
'label' => $member['username'].'1',
'type' => 'checkbox',
'empty' => false));
echo 'hello';
}?>
--end of checkboxes.thtml--

My page head looks like this:



Users




I'm starting to give up, I simply cant see what I'm doing wrong.
Please help.
Thanks
-Dan


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



Re: Autocomplete in 1.2?

2007-06-18 Thread Jonathan Langevin
rtconner, that article is for 1.1, he's asking about 1.2

additionally, the last comment on the page says that it doesn't work
in 1.2(generated code defaults to autocomplete being off)

On 6/18/07, rtconner <[EMAIL PROTECTED]> wrote:
>
>
> http://bakery.cakephp.org/articles/view/autocomplete
>
> On Jun 18, 2:16 pm, Mech7 <[EMAIL PROTECTED]> wrote:
> > Can anybody post a small example how it is suposed to work in 1.2?
> >
> > When i use:
> >
> > Add Post
> > link('Articles', 'index');?>
> > autoComplete('title'); ?>
> > end('Add Article'); ?>
> >
> > In my view, then it does a post with every key i type.. so it saves
> > hundreds of entries :)
>
>
> >
>

--~--~-~--~~~---~--~~
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: Autocomplete in 1.2?

2007-06-18 Thread rtconner

http://bakery.cakephp.org/articles/view/autocomplete

On Jun 18, 2:16 pm, Mech7 <[EMAIL PROTECTED]> wrote:
> Can anybody post a small example how it is suposed to work in 1.2?
>
> When i use:
>
> Add Post
> link('Articles', 'index');?>
> autoComplete('title'); ?>
> end('Add Article'); ?>
>
> In my view, then it does a post with every key i type.. so it saves
> hundreds of entries :)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



protect another app for testing and development

2007-06-18 Thread jyrgen

hi all,

for me it's time to set up a testing or development copy of
my app on the live server.

i found it surprisingly easy to just copy "app" to "alpha"
in the root directory, and fool around with the alpha version.
both apps share the cake core.

now i'm wondering how to hide the "alpha" version from normal
users... Should i employ an auth mechanism or can i utilize .htaccess
files ?

Maybe the subdomain approach is better ? (which is running nicely
in conjunction with my admin pages)

(i have no access to apache conf)

thanks for your help

jyrgen


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Please help with the structure of my code

2007-06-18 Thread dmorris

Hi all.

I am an experienced php developer but a very inexperienced Cake
developer. I have previously written my own MVC code (though i suspect
I blurred the M,V and the C a bit much ;-) )

I am struggling with working out the best way of doing things, and I
can't find any decent structure of code discussions.

Rather than waffling, I'll give a specific example.

I have a Locations model which has an id, and city and a postcode.

I created a locations/find, which was passed the data from a form.

I then started to extend the find function so that it could also take
in data from the url eg /locations/find/leeds

Is this the optimal way of doing it, since my find function now has to
deal with the data in a different way.

The other option would be to create /locations/city/leeds, but I
believe this would require another view, and that seems like
duplication of effort.

If anyone could point me at a worked example with discussion ala the
blog tutorial from the manual, but that goes into *alot* more breadth
- I'm happy reading functions specs, i just wan't to make sure I am
doing things in as close to an optimal way as I can, or else I believe
I will lose the rapid part of the Rapid application development!

Many thanks for your help..

Regards

Duncan


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



Autocomplete in 1.2?

2007-06-18 Thread Mech7

Can anybody post a small example how it is suposed to work in 1.2?

When i use:

Add Post
link('Articles', 'index');?>
autoComplete('title'); ?>
end('Add Article'); ?>

In my view, then it does a post with every key i type.. so it saves
hundreds of entries :)


--~--~-~--~~~---~--~~
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: Problem with saving form data... from tutorial...

2007-06-18 Thread LoinSees

define('DEBUG', 1);

On Jun 18, 5:50 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 6/18/07, LoinSees <[EMAIL PROTECTED]> wrote:
>
>
>
> > :P I have tried that about 1 million times. (about 6 times in reality,
> > but it feels like a million.)
> > This thing is driving me nuts.
>
> What value do you have debug in config/core.php set to?  If it's set
> to 0 you might be seeing cached results.  Just a thought.
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark -http://www.littlehart.net/attheballpark
> @TheKeyboard -http://www.littlehart.net/atthekeyboard


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



Re: cake PHP applications in real-world deployment

2007-06-18 Thread Chris Hartjes

On 6/18/07, Adi Mallikarjuna Reddy V <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> It might be vague to ask this question, but i am curious to here answers for
> this. How far we can rely on cakePHP to implement a real-world application
> that should scale up well?. You are welcome tp give me the applications that
> were developed and are well scalable for huge traffic.

I know that the Firefox Addon's page is used as an example...but what
do you mean when you say "should scale up well"?  That's a very vague
statement.

It's such a meaningless question unless it's put into perspective,
because far more goes into scaling an application than just the code.
Often, the code is the last thing that is causing the problem.

-- 
Chris Hartjes
Senior Developer
Cake Development Corporation

My motto for 2007:  "Just build it, damnit!"

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

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



Re: cake PHP applications in real-world deployment

2007-06-18 Thread Jonathan Langevin
nice, thanks for the links :-)

On 6/18/07, Felix Geisendörfer <[EMAIL PROTECTED]> wrote:
>
>  do you have any sources for that info? just curious, as the addons site
> has been in existence for quite awhile, i'd be surprised (as well as
> impressed) if it were truly based on cake
>
> Well let's see.
>
> The source of the addons site is available here:
> http://svn.mozilla.org/addons/trunk/site/
> And you can read about some of the development details here:
> http://blog.mozilla.com/webdev/
>
> Decide for yourself ; ).
>
> -- Felix
> --
> My latest blog posts:
>
>  [image: ThinkingPHP and 
> beyond]
>
> My Business: http://www.fg-webdesign.de
>
>
> Jonathan Langevin wrote:
>
> do you have any sources for that info? just curious, as the addons site
> has been in existence for quite awhile, i'd be surprised (as well as
> impressed) if it were truly based on cake
>
> On 6/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> > You mean an app like this?
> >
> > https://addons.mozilla.org/en-US/firefox/
> >
> > I'm told that's a CakePHP app :-)
> >
> > On Jun 18, 7:30 pm, "Adi Mallikarjuna Reddy V"
> > <[EMAIL PROTECTED]> wrote:
> > > Dear all,
> > >
> > > It might be vague to ask this question, but i am curious to here
> > answers for
> > > this. How far we can rely on cakePHP to implement a real-world
> > application
> > > that should scale up well?. You are welcome tp give me the
> > applications that
> > > were developed and are well scalable for huge traffic.
> > >
> > > Regards
> > > Adi
> > >
> > > --
> > > --
> > > Adi Mallikarjuna Reddy Vwww.adilive.in
> > > --
> >
> >
> >
>
> >
>

--~--~-~--~~~---~--~~
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: Can't use components relying on startup() in beforeFilter

2007-06-18 Thread nate

This has been fixed in 1.2, so no, you should not need to call it
manually.

On Jun 18, 11:29 am, Falagar <[EMAIL PROTECTED]> wrote:
> Is it save to call the startup method manually?
>
> I had a case where I wanted to use a cookie in beforeFilter and ended
> up calling the startup method for the Cookie component manually and it
> seems to work. Anything that's wrong with that or am I misusing
> something?
>
> On Jun 18, 5:02 am, AD7six <[EMAIL PROTECTED]> wrote:
>
> > On Jun 18, 1:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > In 1.1 and 1.2 Dispatcher::start() first calls beforeFilter() and then
> > > the startup methods of components. This leads to a situation where in
> > > beforeFilter() components are available (constructed) already, but
> > > their startup() method wasn't called yet - although you would expect
> > > that.
>
> > > Is it intentional to call beforeFilter first and initialize the
> > > components after?
>
> > Components can have a initialize method, which is run immediately
> > after they are instanciated, and a startup method which is run after
> > the controller beforeFIlter.
>
> > see the foreach loop in this 
> > methodhttps://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controlle...
>
> > Note that components extend object, that link is to the cake class
> > which handles instanciating components, it isn't the base class for
> > them. The beforeFilter is run sometime after that. (handled in the
> > dispatcher if you are curious)
>
> > hth,
>
> > AD


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



Re: Custom installation location not working quite right ...

2007-06-18 Thread imaginaryboy

Fixed this by adding the following line to the webroot/index.php file:
define('WEBROOT_DIR','userapp');



On Jun 18, 2:28 pm, imaginaryboy <[EMAIL PROTECTED]> wrote:
> Ok so I'm trying to get this going in a custom setup and am so far
> managing to get completely incorrect results because I can't get
> "$this->webroot" in a view to end up with what I need.
>
> The installation setup is like this on an Ubuntu box.
>
> The core cake files are in: /var/www/cake_1.1.15.5144/
> Apache's document root is: /var/www/default_webroot/
> Within /var/www/default_webroot/ there's a symbolic link to a folder
> in a user's home folder like this:
> /var/www/default_webroot/usersapp -> /home/someuser/projects/cakeapp/
> webroot
>
> The whole "app" structure (config, controllers, webroot, etc) is in /
> home/someuser/projects/cakeapp
>
> Browsing tohttp://localhost/userappdoes in fact get me the lovely
> "Cake PHP Rapid Development" default template for a new app, but the
> CSS references all start with "/css" and not "/userapp/css" as I would
> like.
>
> I've tried removing all the various .htaccess files and setting
> BASE_URL in the userapp's core.php to no avail.  That results in the
> CSS references starting with "/userapp/cakeapp/webroot/css" regardless
> of what value I set BASE_URL to ... just value is 100% ignored, I can
> set it to "this-is-some-random-crap" and I'll still end up with the
> aforementioned prefix.
>
> I'm sure there's something ridiculously simple that I'm just not
> figuring out, but it would be pretty useful if I could get this to
> work properly.
>
> 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
-~--~~~~--~~--~--~---



observeField using sql like statement

2007-06-18 Thread [EMAIL PROTECTED]

Hello guys,

I'm using $ajax->observeField in order to retrieve how many
appointments are settled for a certain day, so my controllers action
is:

function byDay ()
{
$this->RequestHandler->setAjax($this);
if(!empty($this->data))
$date = $this->data['Appoinment']['date'];
else
$date = date('Y-m-d');
$this->set('appointments', $this->Appointment->findCount('WHERE
Appointment.date ="' . $date . '"'));
}


$date is passed via the observeField in my view, I get current date by
default:

input('Appoinment/date', array('value' => date('Y-m-
d'))) ?>
observeField('AppointmentDate', array('url'=>'/
appointments/byDay', 'frecuency' => 2, 'update' => 'appointments')) ?>

Here's everything works but the query I'm getting from cake is:

SELECT * FROM Appointments WHERE [Appointment].[date] LIKE
'%2007-06-18%'

And what I really need is a = statament:

SELECT * FROM Appointments WHERE [Appointment].[date] = '2007-06-18'

How can I change this behaviour ?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Custom installation location not working quite right ...

2007-06-18 Thread imaginaryboy

Ok so I'm trying to get this going in a custom setup and am so far
managing to get completely incorrect results because I can't get
"$this->webroot" in a view to end up with what I need.

The installation setup is like this on an Ubuntu box.

The core cake files are in: /var/www/cake_1.1.15.5144/
Apache's document root is: /var/www/default_webroot/
Within /var/www/default_webroot/ there's a symbolic link to a folder
in a user's home folder like this:
/var/www/default_webroot/usersapp -> /home/someuser/projects/cakeapp/
webroot

The whole "app" structure (config, controllers, webroot, etc) is in /
home/someuser/projects/cakeapp

Browsing to http://localhost/userapp does in fact get me the lovely
"Cake PHP Rapid Development" default template for a new app, but the
CSS references all start with "/css" and not "/userapp/css" as I would
like.

I've tried removing all the various .htaccess files and setting
BASE_URL in the userapp's core.php to no avail.  That results in the
CSS references starting with "/userapp/cakeapp/webroot/css" regardless
of what value I set BASE_URL to ... just value is 100% ignored, I can
set it to "this-is-some-random-crap" and I'll still end up with the
aforementioned prefix.

I'm sure there's something ridiculously simple that I'm just not
figuring out, but it would be pretty useful if I could get this to
work properly.

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: populate form contents ajax

2007-06-18 Thread varunkrish

Thanks for the quick reply

I have a text box which contains the post id and a edit form in the
 below

form(array('action'=>$html->url('ajaxedit/')))?>
input('Post/id') ?>
submit('Load Phone', array('url' =>
'ajaxedit/','update'=>'ajaxpost'))?>

input('Post/name', array('size' => '20'))?>


In Controller i Have the ajaxedit method

function ajaxedit($id=null){
if(!empty($this->data)){
$this->Post->id = $id;
$this->data = $this->Post->read();
print_r($Post);
$this->layout = "ajax";
}
}


But i get only the id in the view after ajax update. Name is empty ?
why ?

thanks,

Varun
On Jun 17, 3:39 am, francky06l <[EMAIL PROTECTED]> wrote:
> One more thing, with ajax you very often need to set the parameter
> "update" of link, submit, remote_function etc ... This "update" whould
> match the div you will update into the view. Your "rendering" view
> would be enclosed into $ajax->div('updatedivname') / $ajax-
>
> >divEnd(...)
>
> On Jun 17, 12:35 am, francky06l <[EMAIL PROTECTED]> wrote:
>
> > for the controller aspect it does not change anything posting data
> > using ajax or not. The data posted are accessible in the same way
> > ($this->params['data']['Controller'] .. for example).
> > The same approach for the rendering. Now everything resides into which
> > parts of the view you update with you ajax call (basically doing ajax
> > will not affect your controller code). The difference wiht ajax
> > resides into the view (thtml ot tcp).
>
> > On Jun 16, 8:47 pm, varunkrish <[EMAIL PROTECTED]> wrote:
>
> > > form(array('action'=>$html->url('edit')))?>
>
> > > Loading.. > > $html->image('spinner.gif',array('alt'=>'Saving..','id'=>'editAllimg'))?>
>
> > > 
>
> > > submit('Load Post', array('url' =>
> > > 'editAll/','update'=>'posts','frequency'=>'2','loading'=>"Element.show('editAll');",'loaded'=>"Element.hide('editAll');"));?
>
> > > I have a view for add post , but i have text input for edit post . if
> > > i type a post id in the edit post and give read.. the form contents
> > > should be populated via ajax ?
>
> > > my doubt is i know how to save data (add or edit) via ajax by sending
> > > data to the controller
>
> > > but how to get back data from the controller and populate form
> >  > contents ?


--~--~-~--~~~---~--~~
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: cake PHP applications in real-world deployment

2007-06-18 Thread Felix Geisendörfer




do you have any sources for that info? just
curious, as the addons site
has been in existence for quite awhile, i'd be surprised (as well as
impressed) if it were truly based on cake
Well let's see.

The source of the addons site is available here: http://svn.mozilla.org/addons/trunk/site/
And you can read about some of the development details here: http://blog.mozilla.com/webdev/

Decide for yourself ; ).

-- Felix
--
My latest blog posts:

  
 My Business: http://www.fg-webdesign.de





Jonathan Langevin wrote:
do you have any sources for that info? just curious, as
the addons site has been in existence for quite awhile, i'd be
surprised (as well as impressed) if it were truly based on cake
  
  On 6/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:
  
You mean an app like this?

https://addons.mozilla.org/en-US/firefox/

I'm told that's a CakePHP app :-)

On Jun 18, 7:30 pm, "Adi Mallikarjuna Reddy V"

<[EMAIL PROTECTED]>
wrote:
> Dear all,
>
> It might be vague to ask this question, but i am curious to here
answers for
> this. How far we can rely on cakePHP to implement a real-world
application

> that should scale up well?. You are welcome tp give me the
applications that
> were developed and are well scalable for huge traffic.
>
> Regards
> Adi
>
> --
> --

> Adi Mallikarjuna Reddy Vwww.adilive.in
> --


  
  
  
  
--~--~-~--~~~---~--~~
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: cake PHP applications in real-world deployment

2007-06-18 Thread Larry E. Masters aka PhpNut
On 6/18/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
>
> do you have any sources for that info? just curious, as the addons site
> has been in existence for quite awhile, i'd be surprised (as well as
> impressed) if it were truly based on cake


It is using CakePHP.

http://groups.google.com/group/cake-php/web/cake-apps-sites-in-the-wild

You can find it listed in the link above along with a link to the source
code.

Look for:
Firefox Add-ons: library of add-ons for Firefox. SVN Link here...




-- 
/**
* @author Larry E. Masters
* @var string $userName
* @param string $realName
* @returns string aka PhpNut
* @access  public
*/

--~--~-~--~~~---~--~~
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: cake PHP applications in real-world deployment

2007-06-18 Thread Jonathan Langevin
do you have any sources for that info? just curious, as the addons site has
been in existence for quite awhile, i'd be surprised (as well as impressed)
if it were truly based on cake

On 6/18/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> You mean an app like this?
>
> https://addons.mozilla.org/en-US/firefox/
>
> I'm told that's a CakePHP app :-)
>
> On Jun 18, 7:30 pm, "Adi Mallikarjuna Reddy V"
> <[EMAIL PROTECTED]> wrote:
> > Dear all,
> >
> > It might be vague to ask this question, but i am curious to here answers
> for
> > this. How far we can rely on cakePHP to implement a real-world
> application
> > that should scale up well?. You are welcome tp give me the applications
> that
> > were developed and are well scalable for huge traffic.
> >
> > Regards
> > Adi
> >
> > --
> > --
> > Adi Mallikarjuna Reddy Vwww.adilive.in
> > --
>
>
> >
>

--~--~-~--~~~---~--~~
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: cake PHP applications in real-world deployment

2007-06-18 Thread [EMAIL PROTECTED]

You mean an app like this?

https://addons.mozilla.org/en-US/firefox/

I'm told that's a CakePHP app :-)

On Jun 18, 7:30 pm, "Adi Mallikarjuna Reddy V"
<[EMAIL PROTECTED]> wrote:
> Dear all,
>
> It might be vague to ask this question, but i am curious to here answers for
> this. How far we can rely on cakePHP to implement a real-world application
> that should scale up well?. You are welcome tp give me the applications that
> were developed and are well scalable for huge traffic.
>
> Regards
> Adi
>
> --
> --
> Adi Mallikarjuna Reddy Vwww.adilive.in
> --


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



cake PHP applications in real-world deployment

2007-06-18 Thread Adi Mallikarjuna Reddy V
Dear all,

It might be vague to ask this question, but i am curious to here answers for
this. How far we can rely on cakePHP to implement a real-world application
that should scale up well?. You are welcome tp give me the applications that
were developed and are well scalable for huge traffic.


Regards
Adi

-- 
--
Adi Mallikarjuna Reddy V
www.adilive.in
--

--~--~-~--~~~---~--~~
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: updating records without forms

2007-06-18 Thread Ketan Patel

I think john & i posted almost same time, so duplicate answer :-)
Ketan

On Jun 18, 1:24 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> The following code will do what you want.
>
> $item = $this->Country->findBySlug($slug);
>
> $item['Country']['booleanField'] = ($item['Country']['booleanField']
> == 0)?1:0;
>
> $this->Country->save($item, true, array('booleanField'));
>
> Cheers,
> Ketan :-)
>
> On Jun 18, 1:15 pm, BoSc <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I want to use a update function in my controller that flips a boolean
> > field only.
>
> > I call the page withhttp://website/mode/flip/slug
>
> > When this function is called, it should check whether the database
> > entry for "slug" in "model" contains a 0 or a 1, additionaly it should
> > write the opposite value back. How should I accomplish this?
>
> > i used
>
> > $item = $this->Country->findBySlug($slug);
>
> > to access the data, but this leaves me with an array instead of an
> > object.
>
> > Is there any other way to instantiate a object with a similar function
> > like findbyslug which allows me to make changes in the data 
> > $this->Country->boolean = 0, and then $this->Country->save(), to execute the
>
> > changes?
>
> > thanks
>
> > ps. as you might have noticed I'm pretty new to CakePHP, but I'm
> > trying to make the swicth.


--~--~-~--~~~---~--~~
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: updating records without forms

2007-06-18 Thread Ketan Patel

The following code will do what you want.

$item = $this->Country->findBySlug($slug);

$item['Country']['booleanField'] = ($item['Country']['booleanField']
== 0)?1:0;

$this->Country->save($item, true, array('booleanField'));


Cheers,
Ketan :-)

On Jun 18, 1:15 pm, BoSc <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to use a update function in my controller that flips a boolean
> field only.
>
> I call the page withhttp://website/mode/flip/slug
>
> When this function is called, it should check whether the database
> entry for "slug" in "model" contains a 0 or a 1, additionaly it should
> write the opposite value back. How should I accomplish this?
>
> i used
>
> $item = $this->Country->findBySlug($slug);
>
> to access the data, but this leaves me with an array instead of an
> object.
>
> Is there any other way to instantiate a object with a similar function
> like findbyslug which allows me to make changes in the data 
> $this->Country->boolean = 0, and then $this->Country->save(), to execute the
>
> changes?
>
> thanks
>
> ps. as you might have noticed I'm pretty new to CakePHP, but I'm
> trying to make the swicth.


--~--~-~--~~~---~--~~
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: updating records without forms

2007-06-18 Thread John David Anderson (_psychic_)


On Jun 18, 2007, at 11:15 AM, BoSc wrote:

>
> Hi,
>
> I want to use a update function in my controller that flips a boolean
> field only.
>
> I call the page with http://website/mode/flip/slug
>
> When this function is called, it should check whether the database
> entry for "slug" in "model" contains a 0 or a 1, additionaly it should
> write the opposite value back. How should I accomplish this?
>
> i used
>
> $item = $this->Country->findBySlug($slug);

$this->Country->id = $item['Country']['id'];

if($item['Country']['nameofbooleanfield'])
{
$this->Country->saveField('nameofbooleanfield', 0);
}
else
{
$this->Country->saveField('nameofbooleanfield', 1);
}

You'd want to throw in some error checking (to make sure the Country  
with the slug is found, etc.), but this is one way you could do it.

-- John

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



updating records without forms

2007-06-18 Thread BoSc

Hi,

I want to use a update function in my controller that flips a boolean
field only.

I call the page with http://website/mode/flip/slug

When this function is called, it should check whether the database
entry for "slug" in "model" contains a 0 or a 1, additionaly it should
write the opposite value back. How should I accomplish this?

i used

$item = $this->Country->findBySlug($slug);

to access the data, but this leaves me with an array instead of an
object.

Is there any other way to instantiate a object with a similar function
like findbyslug which allows me to make changes in the data $this-
>Country->boolean = 0, and then $this->Country->save(), to execute the
changes?

thanks

ps. as you might have noticed I'm pretty new to CakePHP, but I'm
trying to make the swicth.


--~--~-~--~~~---~--~~
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: Pagination in 1.2 error :(

2007-06-18 Thread rtconner

lol, the cake way: long questions, short answers

On Jun 18, 11:09 am, Mech7 <[EMAIL PROTECTED]> wrote:
> Ah thanks now it works :D i didn't know the model of the controller
> itself was required also if you add other models :)
>
> On 18 jun, 19:04, rtconner <[EMAIL PROTECTED]> wrote:
>
> > Hi. You forgot your article model.
>
> > var $uses = array('Tag', 'Menu', 'Article');
>
> > On Jun 18, 10:45 am, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > > Yes offcourse here is my controller:
>
> > > articles_controller.php
>
> > >  > > /**
> > >  * Article controller
> > >  * All article logic is used here
> > >  *
> > >  * @author Chris de Kok
> > >  * @version 1.0
> > >  * @package articles
> > >  *
> > >  */
>
> > > class ArticlesController extends AppController
> > > {
> > > // Name
> > > var $name = 'Articles';
>
> > > // Pagination settings
> > > var $paginate = array('limit' => 15, 'page' => 1);
>
> > > // Helpers
> > > var $helpers = array('Html','Form', 'Time');
>
> > > // Load other models
> > > var $uses = array('Tag', 'Menu');
>
> > > /**
> > >  * This function shows a list of all articles
> > >  * it will be called on /article or /article/index
> > >  *
> > >  */
> > > function index()
> > > {
> > > $this->set('articles',  $this->paginate('Article'));
> > > }
>
> > > /**
> > >  * Function to show one article
> > >  * parameter is id of the article
> > >  *
> > >  * @param integer $id
> > >  */
> > > function view($slug = null)
> > > {
> > > $article = $this->Article->findBySlug($slug);
>
> > > $this->set('article', $article);
> > > }
>
> > > /**
> > >  * Function to save an article to the database
> > >  *
> > >  */
> > > function add()
> > > {
> > > if (!empty($this->data)) {
>
> > > // Check if data has been saved
> > > if ($this->Article->save($this->data)) {
> > > $this->Session->setFlash('Your article 
> > > has been saved.');
> > > $this->redirect('index');
> > > }
> > > }
> > > else {
>
> > > // Get all tags
> > > $tags = $this->Tag->findAll();
>
> > > // Make new array with tags
> > > $tagsList = array();
>
> > > // Loop through array
> > > foreach ($tags as $tag)
> > > {
> > > $tagsList[$tag['Tag']['id']] = 
> > > $tag['Tag']['tag'];
> > > }
>
> > > // Array with tags
> > > $this->set('tags', $tagsList );
>
> > > // Get all menu items
> > > $menu_items = $this->Menu->findAll();
>
> > > // Make new array with tags
> > > $menu_list = array();
>
> > > // Loop through array
> > > foreach ($menu_items as $item)
> > > {
> > > $menu_list[$item['Menu']['id']] = 
> > > $item['Menu']['name'];
> > > }
>
> > > // Array with tags
> > > $this->set('menu', $menu_list );
> > > }
> > > }
> > > /**
> > >  * Delete the article with id as parameter
> > >  *
> > >  * @param unknown_type $id
> > >  */
> > > function delete($id)
> > > {
> > > $this->Article->del($id);
> > > $this->Session->setFlash('The article with id: '.$id.' 
> > > has been
> > > deleted.');
> > > $this->redirect('index');
> > > }
> > > /**
> > >  * Edit article with id as parameter
> > >  *
> > >  * @param unknown_type $id
> > >  */
> > > function edit($id = null)
> > > {
>
> > > if (empty($this->data))
> > > {
> > > $this->Article->id = $id;
> > > $this->data = $this->Article->read();
> > > }
> > > else
> > > {
> > > if ($this->Article->save($this->data['Article']))
> > > {
> > > $this->Session->setFlash('Your article 
> > > has been updated.');
> > > $this->redirect('index');
> > > }
> > > }
> > > }
>
> > > }
>
> > > Model
>
> > > Article.php
>
> > >  > > class Article extends AppModel
> > > {
> > > // M

Re: Security Component in 1.2

2007-06-18 Thread nate

On Jun 18, 12:19 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
> I perfectly agree that the Security Component is doing its job and I
> do understand what requirePost and requireAuth purpose is for.

Again, I really don't think you do. : /

> However, in case like users registration page, you would want to have
> requireAuth and requirePost only after the form is submitted not prior
> to form submission. My request for enhancement was from this
> perspective.

Exactly.  In this case you'd only use requireAuth, since the
requireAuth check only happens on POST requests.  Also, in your case,
requirePost is by definition irrelevant, since you allow both GET and
POST requests to the same action.


> On Jun 18, 12:09 am, nate <[EMAIL PROTECTED]> wrote:
>
> > I responded to your ticket:https://trac.cakephp.org/ticket/2783
>
> > On Jun 17, 10:15 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> > > I have made a request for enhancements to Security Component 
> > > athttps://trac.cakephp.org/ticket/2783... The details are below and I
> > > would like some open discussion on this enhancements from bakers.
>
> > > Ticket Details:
>
> > > With security component, if one ever wants to use requirePost and
> > > requireAuth, then its implementation is not quite straight forward and
> > > requires bit of code change to make it work.
>
> > > Say for an action 'register' in controller 'Users', I want to use
> > > requireAuth and requirePost. Based on current implementation, I have
> > > to make a post request to the 'register' action for a user to view
> > > that page. This involves change and is a bit painful to implement. In
> > > reality, one would never want to check whether the request is Post or
> > > Get for initial view. It is only important when the form is submitted
> > > to that action. Same goes with requireAuth.
>
> > > What I would really like to see is that, the initial visit to the
> > > 'register' action should not check for the requirePost or requireAuth
> > > but only check when the form is submitted.
>
> > > I have modified the code so that it checks if there is any
> > > '$controller->data' then the requirePost and requireAuth is checked,
> > > otherwise it is by-passed.


--~--~-~--~~~---~--~~
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: Pagination in 1.2 error :(

2007-06-18 Thread Mech7

Ah thanks now it works :D i didn't know the model of the controller
itself was required also if you add other models :)

On 18 jun, 19:04, rtconner <[EMAIL PROTECTED]> wrote:
> Hi. You forgot your article model.
>
> var $uses = array('Tag', 'Menu', 'Article');
>
> On Jun 18, 10:45 am, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > Yes offcourse here is my controller:
>
> > articles_controller.php
>
> >  > /**
> >  * Article controller
> >  * All article logic is used here
> >  *
> >  * @author Chris de Kok
> >  * @version 1.0
> >  * @package articles
> >  *
> >  */
>
> > class ArticlesController extends AppController
> > {
> > // Name
> > var $name = 'Articles';
>
> > // Pagination settings
> > var $paginate = array('limit' => 15, 'page' => 1);
>
> > // Helpers
> > var $helpers = array('Html','Form', 'Time');
>
> > // Load other models
> > var $uses = array('Tag', 'Menu');
>
> > /**
> >  * This function shows a list of all articles
> >  * it will be called on /article or /article/index
> >  *
> >  */
> > function index()
> > {
> > $this->set('articles',  $this->paginate('Article'));
> > }
>
> > /**
> >  * Function to show one article
> >  * parameter is id of the article
> >  *
> >  * @param integer $id
> >  */
> > function view($slug = null)
> > {
> > $article = $this->Article->findBySlug($slug);
>
> > $this->set('article', $article);
> > }
>
> > /**
> >  * Function to save an article to the database
> >  *
> >  */
> > function add()
> > {
> > if (!empty($this->data)) {
>
> > // Check if data has been saved
> > if ($this->Article->save($this->data)) {
> > $this->Session->setFlash('Your article has 
> > been saved.');
> > $this->redirect('index');
> > }
> > }
> > else {
>
> > // Get all tags
> > $tags = $this->Tag->findAll();
>
> > // Make new array with tags
> > $tagsList = array();
>
> > // Loop through array
> > foreach ($tags as $tag)
> > {
> > $tagsList[$tag['Tag']['id']] = 
> > $tag['Tag']['tag'];
> > }
>
> > // Array with tags
> > $this->set('tags', $tagsList );
>
> > // Get all menu items
> > $menu_items = $this->Menu->findAll();
>
> > // Make new array with tags
> > $menu_list = array();
>
> > // Loop through array
> > foreach ($menu_items as $item)
> > {
> > $menu_list[$item['Menu']['id']] = 
> > $item['Menu']['name'];
> > }
>
> > // Array with tags
> > $this->set('menu', $menu_list );
> > }
> > }
> > /**
> >  * Delete the article with id as parameter
> >  *
> >  * @param unknown_type $id
> >  */
> > function delete($id)
> > {
> > $this->Article->del($id);
> > $this->Session->setFlash('The article with id: '.$id.' has 
> > been
> > deleted.');
> > $this->redirect('index');
> > }
> > /**
> >  * Edit article with id as parameter
> >  *
> >  * @param unknown_type $id
> >  */
> > function edit($id = null)
> > {
>
> > if (empty($this->data))
> > {
> > $this->Article->id = $id;
> > $this->data = $this->Article->read();
> > }
> > else
> > {
> > if ($this->Article->save($this->data['Article']))
> > {
> > $this->Session->setFlash('Your article has 
> > been updated.');
> > $this->redirect('index');
> > }
> > }
> > }
>
> > }
>
> > Model
>
> > Article.php
>
> >  > class Article extends AppModel
> > {
> > // Model name
> > var $name = 'Article';
>
> > // Database table
> > var $useTable = 'articles';
>
> > // Use sef url's
> > var $actsAs = array('Slug');
>
> > // Validator
> > var $validate = array(
> > 'title' => array('rule' => array('between', 3, 255)),
> > 'article' => VALID_NOT_EMPTY
> >

Re: Pagination in 1.2 error :(

2007-06-18 Thread rtconner

Hi. You forgot your article model.

var $uses = array('Tag', 'Menu', 'Article');

On Jun 18, 10:45 am, Mech7 <[EMAIL PROTECTED]> wrote:
> Yes offcourse here is my controller:
>
> articles_controller.php
>
>  /**
>  * Article controller
>  * All article logic is used here
>  *
>  * @author Chris de Kok
>  * @version 1.0
>  * @package articles
>  *
>  */
>
> class ArticlesController extends AppController
> {
> // Name
> var $name = 'Articles';
>
> // Pagination settings
> var $paginate = array('limit' => 15, 'page' => 1);
>
> // Helpers
> var $helpers = array('Html','Form', 'Time');
>
> // Load other models
> var $uses = array('Tag', 'Menu');
>
> /**
>  * This function shows a list of all articles
>  * it will be called on /article or /article/index
>  *
>  */
> function index()
> {
> $this->set('articles',  $this->paginate('Article'));
> }
>
> /**
>  * Function to show one article
>  * parameter is id of the article
>  *
>  * @param integer $id
>  */
> function view($slug = null)
> {
> $article = $this->Article->findBySlug($slug);
>
> $this->set('article', $article);
> }
>
> /**
>  * Function to save an article to the database
>  *
>  */
> function add()
> {
> if (!empty($this->data)) {
>
> // Check if data has been saved
> if ($this->Article->save($this->data)) {
> $this->Session->setFlash('Your article has 
> been saved.');
> $this->redirect('index');
> }
> }
> else {
>
> // Get all tags
> $tags = $this->Tag->findAll();
>
> // Make new array with tags
> $tagsList = array();
>
> // Loop through array
> foreach ($tags as $tag)
> {
> $tagsList[$tag['Tag']['id']] = 
> $tag['Tag']['tag'];
> }
>
> // Array with tags
> $this->set('tags', $tagsList );
>
> // Get all menu items
> $menu_items = $this->Menu->findAll();
>
> // Make new array with tags
> $menu_list = array();
>
> // Loop through array
> foreach ($menu_items as $item)
> {
> $menu_list[$item['Menu']['id']] = 
> $item['Menu']['name'];
> }
>
> // Array with tags
> $this->set('menu', $menu_list );
> }
> }
> /**
>  * Delete the article with id as parameter
>  *
>  * @param unknown_type $id
>  */
> function delete($id)
> {
> $this->Article->del($id);
> $this->Session->setFlash('The article with id: '.$id.' has 
> been
> deleted.');
> $this->redirect('index');
> }
> /**
>  * Edit article with id as parameter
>  *
>  * @param unknown_type $id
>  */
> function edit($id = null)
> {
>
> if (empty($this->data))
> {
> $this->Article->id = $id;
> $this->data = $this->Article->read();
> }
> else
> {
> if ($this->Article->save($this->data['Article']))
> {
> $this->Session->setFlash('Your article has 
> been updated.');
> $this->redirect('index');
> }
> }
> }
>
> }
>
> Model
>
> Article.php
>
>  class Article extends AppModel
> {
> // Model name
> var $name = 'Article';
>
> // Database table
> var $useTable = 'articles';
>
> // Use sef url's
> var $actsAs = array('Slug');
>
> // Validator
> var $validate = array(
> 'title' => array('rule' => array('between', 3, 255)),
> 'article' => VALID_NOT_EMPTY
> );
>
> var $hasAndBelongsToMany = array('Tag' =>
> array('className'=> 'Tag',
> 'joinTable'=> 'articles_tags',
> 'foreignKey'   => 'articles_id',
> 'associationForeignKey'=> 'tag_id',
> 'conditions'   => '',
> 'order'=> '',
> 'limit'=> '',
> 'unique'   => true,
> 'finderQuery'  => '',
> 'deleteQuery'  => '',
> )
> );
>
>

Editing HABTM in 1.2

2007-06-18 Thread Ugo PARSI

Hello,

I had no issues to create HABTM select edit box in the past
I was using something close to this :
http://www.shepherdweb.com/2006/08/21/editing-hasandbelongstomany-habtm-relationships-in-cakephp/
so that saved HABTM relations were selected during the edit action.

I am not able to do the same since the new changes in 1.2 (I'm using
the latest release)

Here's what I'm doing :

$form->input('Country.Country', array('label' =>
__("ADMIN_FORM_COUNTRIES", true), 'type' => 'select', 'multiple' =>
true, 'selected' => $selected_countries, 'options' => $countries));

$countries is filled from a generateList() call
and $selected_countries is using the same technic as the link above
which used to work in the past.

Anything wrong ?

Thanks a lot,

Ugo PARSI


--~--~-~--~~~---~--~~
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: Pagination in 1.2 error :(

2007-06-18 Thread Mech7

Yes offcourse here is my controller:

articles_controller.php

 15, 'page' => 1);

// Helpers
var $helpers = array('Html','Form', 'Time');

// Load other models
var $uses = array('Tag', 'Menu');


/**
 * This function shows a list of all articles
 * it will be called on /article or /article/index
 *
 */
function index()
{
$this->set('articles',  $this->paginate('Article'));
}

/**
 * Function to show one article
 * parameter is id of the article
 *
 * @param integer $id
 */
function view($slug = null)
{
$article = $this->Article->findBySlug($slug);

$this->set('article', $article);
}

/**
 * Function to save an article to the database
 *
 */
function add()
{
if (!empty($this->data)) {

// Check if data has been saved
if ($this->Article->save($this->data)) {
$this->Session->setFlash('Your article has been 
saved.');
$this->redirect('index');
}
}
else {

// Get all tags
$tags = $this->Tag->findAll();

// Make new array with tags
$tagsList = array();

// Loop through array
foreach ($tags as $tag)
{
$tagsList[$tag['Tag']['id']] = 
$tag['Tag']['tag'];
}

// Array with tags
$this->set('tags', $tagsList );

// Get all menu items
$menu_items = $this->Menu->findAll();

// Make new array with tags
$menu_list = array();

// Loop through array
foreach ($menu_items as $item)
{
$menu_list[$item['Menu']['id']] = 
$item['Menu']['name'];
}

// Array with tags
$this->set('menu', $menu_list );
}
}
/**
 * Delete the article with id as parameter
 *
 * @param unknown_type $id
 */
function delete($id)
{
$this->Article->del($id);
$this->Session->setFlash('The article with id: '.$id.' has been
deleted.');
$this->redirect('index');
}
/**
 * Edit article with id as parameter
 *
 * @param unknown_type $id
 */
function edit($id = null)
{

if (empty($this->data))
{
$this->Article->id = $id;
$this->data = $this->Article->read();
}
else
{
if ($this->Article->save($this->data['Article']))
{
$this->Session->setFlash('Your article has been 
updated.');
$this->redirect('index');
}
}
}
}

Model

Article.php

 array('rule' => array('between', 3, 255)),
'article' => VALID_NOT_EMPTY
);

var $hasAndBelongsToMany = array('Tag' =>
array('className'=> 'Tag',
'joinTable'=> 'articles_tags',
'foreignKey'   => 'articles_id',
'associationForeignKey'=> 'tag_id',
'conditions'   => '',
'order'=> '',
'limit'=> '',
'unique'   => true,
'finderQuery'  => '',
'deleteQuery'  => '',
)
);

}

View

index.ctp:

Articles
link('New article', 'add');?>


Id
Title
Edit
Delete
Created
Modified


   




link($article['Article']['title'], "/
articles/view/".$article['Article']['slug']); ?>
link(
'Edit',
"/articles/edit/{$article['Article']['id']}")?>

link(
'Delete',
"/articles/delete/{$article['Article']['id']}",
null,
'Are you sure?'
)?>

timeAgoInWords(strtotime($article['Article']['created'])); ?>
timeAgoInWords(strtotime($article['Article']['modified'])); ?>




prev(); ?>
numbers(); ?>
next(); ?>

And the tables:

CREATE TABLE `cms_articles` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) character set utf8 NOT NULL,
  `slug` varchar(100) character set utf8 NOT NULL,
  `article` text character set utf8 NOT NULL,
  `menu_id` int(11) NOT 

Re: Commented Version of CakePHP Manual

2007-06-18 Thread Dérico Filho

Also... the comment area was too short in the database... Just changed
it to store longer texts.

On 18 jun, 13:07, "Sonic Baker" <[EMAIL PROTECTED]> wrote:
> Out with ya!
>
> Sonic


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread Dérico Filho

BTW, I've posted a Doc Ticket at trac.cakephp offering the system to
cakephp core team.

On 18 jun, 13:07, "Sonic Baker" <[EMAIL PROTECTED]> wrote:
> Out with ya!
>
> Sonic


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread Dérico Filho

Hi Noslow!


I think it's a very good idea to offer the comments as RSS feeds...
I'll be looking forward to make it available.

First I shall implement some sort of challenge system to avoid spams.


Uldérico

On 18 jun, 10:24, NOSLOW <[EMAIL PROTECTED]> wrote:
> I've been usinghttp://docs.cakephp.nu/, but I haven't seen any
> comments yet. The front page there mentions "RSS feeds to all
> discussions", but I couldn't find the feed.
>
> Any chance of adding an RSS feed to user discussions 
> onhttp://www.cirello.org/cakephp-manual/?


--~--~-~--~~~---~--~~
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: Security Component in 1.2

2007-06-18 Thread Ketan Patel

I perfectly agree that the Security Component is doing its job and I
do understand what requirePost and requireAuth purpose is for.

However, in case like users registration page, you would want to have
requireAuth and requirePost only after the form is submitted not prior
to form submission. My request for enhancement was from this
perspective.

On Jun 18, 12:09 am, nate <[EMAIL PROTECTED]> wrote:
> I responded to your ticket:https://trac.cakephp.org/ticket/2783
>
> On Jun 17, 10:15 pm, Ketan Patel <[EMAIL PROTECTED]> wrote:
>
> > I have made a request for enhancements to Security Component 
> > athttps://trac.cakephp.org/ticket/2783... The details are below and I
> > would like some open discussion on this enhancements from bakers.
>
> > Ticket Details:
>
> > With security component, if one ever wants to use requirePost and
> > requireAuth, then its implementation is not quite straight forward and
> > requires bit of code change to make it work.
>
> > Say for an action 'register' in controller 'Users', I want to use
> > requireAuth and requirePost. Based on current implementation, I have
> > to make a post request to the 'register' action for a user to view
> > that page. This involves change and is a bit painful to implement. In
> > reality, one would never want to check whether the request is Post or
> > Get for initial view. It is only important when the form is submitted
> > to that action. Same goes with requireAuth.
>
> > What I would really like to see is that, the initial visit to the
> > 'register' action should not check for the requirePost or requireAuth
> > but only check when the form is submitted.
>
> > I have modified the code so that it checks if there is any
> > '$controller->data' then the requirePost and requireAuth is checked,
> > otherwise it is by-passed.


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread Sonic Baker
Out with ya!

Sonic

--~--~-~--~~~---~--~~
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: Can't use components relying on startup() in beforeFilter

2007-06-18 Thread Falagar

Is it save to call the startup method manually?

I had a case where I wanted to use a cookie in beforeFilter and ended
up calling the startup method for the Cookie component manually and it
seems to work. Anything that's wrong with that or am I misusing
something?

On Jun 18, 5:02 am, AD7six <[EMAIL PROTECTED]> wrote:
> On Jun 18, 1:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > In 1.1 and 1.2 Dispatcher::start() first calls beforeFilter() and then
> > the startup methods of components. This leads to a situation where in
> > beforeFilter() components are available (constructed) already, but
> > their startup() method wasn't called yet - although you would expect
> > that.
>
> > Is it intentional to call beforeFilter first and initialize the
> > components after?
>
> Components can have a initialize method, which is run immediately
> after they are instanciated, and a startup method which is run after
> the controller beforeFIlter.
>
> see the foreach loop in this 
> methodhttps://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controlle...
>
> Note that components extend object, that link is to the cake class
> which handles instanciating components, it isn't the base class for
> them. The beforeFilter is run sometime after that. (handled in the
> dispatcher if you are curious)
>
> hth,
>
> AD


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



hdcalendar

2007-06-18 Thread [EMAIL PROTECTED]

Hi iwould try the plugin hdcalendar
I have copy all the file in the app/plugins directory.
Now if i try the URL "http://localhost/cake/hdcalendar/calendar/index";
but i get an error :"controller HdcalendarController could not be
found"

What do I use like URL to access to the plugin?

Many thanks
Marco


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread [EMAIL PROTECTED]

 > You should be kicked off this group for merely suggesting such a
thing...
I agree. Henceforth all bad ideas shall result in the banning of at
least one person who contributed to said idea. Furthermore, there
shall be no exception for jokes, sarcasm, or grumpiness. Ha!
;-)



On Jun 18, 10:53 am, "Jonathan Langevin" <[EMAIL PROTECTED]> wrote:
> bah humbug, i was joking, although it would be a good idea to have comments
> on the manual moderated by the users (have users respond to whether the
> comment is valid or not)
>
> On 6/18/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On 6/18/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
> > > Or even better, set up each comment to start a thread in the newsgroup
> > :-D
> > > then capture comments on the comment, lol
>
> > You should be kicked off this group for merely suggesting such a thing...
>
> > --
> > Chris Hartjes
>
> > My motto for 2007:  "Just build it, damnit!"
>
> > @TheBallpark -http://www.littlehart.net/attheballpark
> > @TheKeyboard -http://www.littlehart.net/atthekeyboard- 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: checking if a controller exists

2007-06-18 Thread Mariano Iglesias


function reachable($url) {
$params = Router::parse($url);

if (!empty($params['controller'])) {
$ctrlName = Inflector::camelize($params['controller']);

if (!loadController($ctrlName)) {
$pluginName =
Inflector::camelize($params['action']);
if (loadController($ctrlName . '.' . $pluginName)) {
return true;
}
} else {
return true;
}
}

return false;
}

-MI

---

Remember, smart coders answer ten questions for every question they ask. 
So be smart, be cool, and share your knowledge. 

BAKE ON!

blog: http://www.MarianoIglesias.com.ar


-Mensaje original-
De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre
de phpjoy
Enviado el: Lunes, 18 de Junio de 2007 11:06 a.m.
Para: Cake PHP
Asunto: Re: checking if a controller exists

you gave an intresting idea.. maybe i'll simply loadcontroller and
then run the action and then call the view render myself from the
function.


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread Jonathan Langevin
bah humbug, i was joking, although it would be a good idea to have comments
on the manual moderated by the users (have users respond to whether the
comment is valid or not)

On 6/18/07, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
>
> On 6/18/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
> > Or even better, set up each comment to start a thread in the newsgroup
> :-D
> > then capture comments on the comment, lol
> >
>
> You should be kicked off this group for merely suggesting such a thing...
>
> --
> Chris Hartjes
>
> My motto for 2007:  "Just build it, damnit!"
>
> @TheBallpark - http://www.littlehart.net/attheballpark
> @TheKeyboard - http://www.littlehart.net/atthekeyboard
>
> >
>

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



Re: Commented Version of CakePHP Manual

2007-06-18 Thread Chris Hartjes

On 6/18/07, Jonathan Langevin <[EMAIL PROTECTED]> wrote:
> Or even better, set up each comment to start a thread in the newsgroup :-D
> then capture comments on the comment, lol
>

You should be kicked off this group for merely suggesting such a thing...

-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

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

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



Re: Commented Version of CakePHP Manual

2007-06-18 Thread Jonathan Langevin
Or even better, set up each comment to start a thread in the newsgroup :-D
then capture comments on the comment, lol

On 6/18/07, NOSLOW <[EMAIL PROTECTED]> wrote:
>
>
> I've been using http://docs.cakephp.nu/, but I haven't seen any
> comments yet. The front page there mentions "RSS feeds to all
> discussions", but I couldn't find the feed.
>
> Any chance of adding an RSS feed to user discussions on
> http://www.cirello.org/cakephp-manual/?
>
>
> >
>

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



hdcalendar

2007-06-18 Thread [EMAIL PROTECTED]

Hi
I would try thehdcalendar plugin but i don't find a document about his
installation.
Can someone help me to install this?
Many thanks
Marco


--~--~-~--~~~---~--~~
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: checking if a controller exists

2007-06-18 Thread phpjoy

you gave an intresting idea.. maybe i'll simply loadcontroller and
then run the action and then call the view render myself from the
function.

i'll try and report back!
if that doesn't work i'll goto the router itself [something i try
avoid doing].

On Jun 18, 1:51 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> If you know the actual controller name you can use loadController()
> which will return a boolean of whether the controller could be
> loaded.  However, your example above is difficult because a
> requestAction (and normal requests) go through your application routes
> - which could have any kind of mapping from request url to
> controller.  Perhaps you could look into how the Router works, and
> find something that identifies the controller that would be used for a
> particular request url?


--~--~-~--~~~---~--~~
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: Commented Version of CakePHP Manual

2007-06-18 Thread NOSLOW

I've been using http://docs.cakephp.nu/, but I haven't seen any
comments yet. The front page there mentions "RSS feeds to all
discussions", but I couldn't find the feed.

Any chance of adding an RSS feed to user discussions on
http://www.cirello.org/cakephp-manual/?


--~--~-~--~~~---~--~~
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: Recursion for my own custom query?

2007-06-18 Thread Joshua Benner





Looks good. I think I would use Cake's magic before writing my own
function like that, though. However, the function also accomplishes
more than the initial target functionality.

AD7six wrote:

  

On Jun 18, 1:55 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
  
  
Consider using a 'Months' table for which you define a 'Month' model which has associations defined between it and 'Entry'
Then:
$this->Month->findAll(array('monthName'=>'January'))

  
  
Or not :).

http://bin.cakephp.org/saved/20574

hth,

AD




  


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





Re: problem with switching layouts

2007-06-18 Thread Chris Hartjes

On 6/18/07, sushil <[EMAIL PROTECTED]> wrote:
>
> Hi All,
> I have again come across a problem. I have static page (rendered by
> pages controller) - loginbox and I have a layout for it.
>
> While running the application, if a session is set, then the app will
> run else a login box is to be displayed. For the login box, there is
> different layout (loginbox.thtml). The code to change layout is:
> --
>  if($this->name ='Pages')
> {
> if($this->action = 'loginbox')
> {
> $this->layout = 'loginbox';
> }
> }
> else
> $this->layout = 'default';
> -

I'm hoping it's a typo in you code, but shouldn't it say:

if ($this->name == 'Pages')

-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

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

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



problem with switching layouts

2007-06-18 Thread sushil

Hi All,
I have again come across a problem. I have static page (rendered by
pages controller) - loginbox and I have a layout for it.

While running the application, if a session is set, then the app will
run else a login box is to be displayed. For the login box, there is
different layout (loginbox.thtml). The code to change layout is:
--
 if($this->name ='Pages')
{
if($this->action = 'loginbox')
{
$this->layout = 'loginbox';
}
}
else
$this->layout = 'default';
-

This works fine. The problem is, the layout doesn't change back to the
default layout if there is an active session.

Can you guys help me on this?


Regards,
Sushil


--~--~-~--~~~---~--~~
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: html->submit() does not exists?

2007-06-18 Thread Chris Hartjes

On 6/16/07, Mech7 <[EMAIL PROTECTED]> wrote:
>
> Ah thanks that works.. but then why can you decide the location for
> textareae error messages but not for input boxes? And also why does it
> genereate extra html instead of only the message? Would it not be more
> customizable if you can write your own html in the view?

Of course it would be, but what's the cost in terms of code to make
that happen?  I agree that consistency should be the goal, so how do
you make that happen?  I know people don't like to hear this, but this
*is* an open source project and people should not be shy about
contributing patches or enhancement suggestions.

http://trac.cakephp.org

-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

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

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



Re: Problem with saving form data... from tutorial...

2007-06-18 Thread Chris Hartjes

On 6/18/07, LoinSees <[EMAIL PROTECTED]> wrote:
>
> :P I have tried that about 1 million times. (about 6 times in reality,
> but it feels like a million.)
> This thing is driving me nuts.
>

What value do you have debug in config/core.php set to?  If it's set
to 0 you might be seeing cached results.  Just a thought.


-- 
Chris Hartjes

My motto for 2007:  "Just build it, damnit!"

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

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



Re: Recursion for my own custom query?

2007-06-18 Thread AD7six



On Jun 18, 1:55 pm, Joshua Benner <[EMAIL PROTECTED]> wrote:
> Consider using a 'Months' table for which you define a 'Month' model which 
> has associations defined between it and 'Entry'
> Then:
> $this->Month->findAll(array('monthName'=>'January'))

Or not :).

http://bin.cakephp.org/saved/20574

hth,

AD



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



Re: Session expire after browser window close

2007-06-18 Thread Grant Cox

> How to make session expire after browser close? It's a default PHP
> session behaviour,

Really?  In my experience closing the browser causes the browser to
forget your session cookie (as that's what it is meant to do), but the
server is not informed of this and keeps the session active for the
normal amount of time.  I have not seen any change in this behaviour
with CakePHP.

How are you finding that Cake is not expiring the session, where a
"normal" PHP script does?  Are you looking at the server side session
files?  Can you post a sample PHP script that automatically destroys
this session with just a browser close?


--~--~-~--~~~---~--~~
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: Can't use components relying on startup() in beforeFilter

2007-06-18 Thread AD7six



On Jun 18, 1:18 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> In 1.1 and 1.2 Dispatcher::start() first calls beforeFilter() and then
> the startup methods of components. This leads to a situation where in
> beforeFilter() components are available (constructed) already, but
> their startup() method wasn't called yet - although you would expect
> that.
>
> Is it intentional to call beforeFilter first and initialize the
> components after?

Components can have a initialize method, which is run immediately
after they are instanciated, and a startup method which is run after
the controller beforeFIlter.

see the foreach loop in this method
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controller/component.php#L60

Note that components extend object, that link is to the cake class
which handles instanciating components, it isn't the base class for
them. The beforeFilter is run sometime after that. (handled in the
dispatcher if you are curious)

hth,

AD


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



Re: Recursion for my own custom query?

2007-06-18 Thread Joshua Benner





Consider using a 'Months' table for which you define a 'Month' model
which has associations defined between it and 'Entry'

Then:
$this->Month->findAll(array('monthName'=>'January'))

Pete wrote:

  I have a function in my model, to get a list of the months that I have
blog entries in:

function getMonths($limit = null)
{

$sql = "SELECT DISTINCT month(Entry.date) number,
monthname(Entry.date) title, year(Entry.date) year FROM entries as
Entry ORDER BY date DESC";
if ($limit): $sql .= " LIMIT " . $limit; endif;

$result = $this->query($sql);
return $result;

}

What would be the best way to then get the Entries that are in those
months. Could I attach the Entries to those month results?

Basically, I'm trying a pretty typical "archive by month", and I'm
trying to get an array like:

[0] => Array
(
[Month] => Array
(
[number] => 5
[title] => May
[year] => 2007
)
[Entry] => Array
(
[0] => Array
(
[title] => Blog Post
[date] => May 06, 2007
)
[1] => Array
(
[title] => Blog Post
[date] => May 06, 2007
)
)
)

Any ideas?



  


--~--~-~--~~~---~--~~
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: Regarding Installation and Viewing Application

2007-06-18 Thread Joshua Benner





Cake URLs map to controller actions. So if you have a model 'User', you
will likely have a controller 'UsersController', which will likely have
action methods along the lines of 'add', 'view', 'edit', and 'delete'.

The URLs would then be:

/users/add
/users/view
/users/edit
/users/delete

Be sure to read the manual and
follow the blog tutorial. Pretty much what you need to know is laid out
in there even if it doesn't seem so at first.

Tutla wrote:

  I am very much newer in respect to cakePHP. I install it in my local
maching using apache sever and also configure the database. the home
page of cake it showing ok that database connetion is okey. but after
creating an application supose users registration i donot get any view
in the browser when give the specified url as says in the manal like
http://localhost/users/ somthing like this.
So any can help me on this matter. what is actual procedure to create
the application and viewing it in browse.

thanks
Somenath



  


--~--~-~--~~~---~--~~
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: checking if a controller exists

2007-06-18 Thread Grant Cox

If you know the actual controller name you can use loadController()
which will return a boolean of whether the controller could be
loaded.  However, your example above is difficult because a
requestAction (and normal requests) go through your application routes
- which could have any kind of mapping from request url to
controller.  Perhaps you could look into how the Router works, and
find something that identifies the controller that would be used for a
particular request url?


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Can't use components relying on startup() in beforeFilter

2007-06-18 Thread [EMAIL PROTECTED]

Hi,

In 1.1 and 1.2 Dispatcher::start() first calls beforeFilter() and then
the startup methods of components. This leads to a situation where in
beforeFilter() components are available (constructed) already, but
their startup() method wasn't called yet - although you would expect
that.

Is it intentional to call beforeFilter first and initialize the
components after?

Thanks

Markus Bertheau


--~--~-~--~~~---~--~~
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: html->submit() does not exists?

2007-06-18 Thread Robert K S

New Cake user here... just to be clear, what should be modified in the
CakePHP blod tutorial to get it working with the 1.2 branch?
Thanks...

All the best,
Robert K S

On Jun 14, 5:52 pm, francky06l <[EMAIL PROTECTED]> wrote:
> Most of the html helper function concerning form have been moved to
> the form helpers. Check the form.php into the cake core files (ie :
> $form->submit)
>
> On Jun 14, 5:34 pm, Mech7 <[EMAIL PROTECTED]> wrote:
>
>
>
> > I get this error in 1.2 when i try the blog tut..
>
> > Warning (512): MethodHtmlHelper::submitdoesnotexist[CORE\cake\libs
> > \view\helper.php, line 148]
>
> > With code
>
> > submit('Save') ?>
>
> > It still is in the var of html.php though?
>
> > 'submit' => '',
>
> > only no function anymore ?- 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: ordering items

2007-06-18 Thread pluriels

hi everyone,

Thanks a lot dan for this example.
Maybe you should place this in the bakery.

I think CakePHP isn't tasty enough in comparison with symfony.
Symfony is more complex, but the demos and screencasts are more
convincing.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



checking if a controller exists

2007-06-18 Thread phpjoy

what's the cakephp way to check whether a controller exists or not?


$this->set('product', $this->requestAction('/admin/product/',
array('return')));
if the controller isn't there, it shows an error message.
i haven't tried taking it to debug 0, i thought of using a function to
check.

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: Where to define & place new validator regex for models?

2007-06-18 Thread AD7six



On Jun 18, 11:16 am, "Howard Glynn" <[EMAIL PROTECTED]> wrote:
> Is there a recommended place to put additional common validators (regex's)
> to use across several of my models?
>
> i.e. I don't want to put in /libs/validators.php as this breaks my
> cake upgrade path

Stick them in your bootstrap

hth,

AD
PS. This was raised pre-bootstrap but I would suggest the basic
reasoning is still the same: https://trac.cakephp.org/ticket/56


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Where to define & place new validator regex for models?

2007-06-18 Thread Howard Glynn

Is there a recommended place to put additional common validators (regex's)
to use across several of my models?

i.e. I don't want to put in /libs/validators.php as this breaks my
cake upgrade path

The Data Validation chapter doesn't seem to describe this unfortunately.

TIA, Howard

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



Re: how to cache all the view in call ?

2007-06-18 Thread wluigi

no one know how to handle this ?

On 15 juin, 14:31, wluigi <[EMAIL PROTECTED]> wrote:
> I want to do this in only 1 call
>
> On 15 juin, 14:27, wluigi <[EMAIL PROTECTED]> wrote:
>
> > I try differents ways but no one is perfect.
>
> > I just want every morning to call a controller action or a batch that
> > write the cached file for all my couple od /controller/action/param1/
> > param2/...


--~--~-~--~~~---~--~~
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: Pagination in 1.2 error :(

2007-06-18 Thread Titang

Very strange, I used var $uses with many models and the paginator
works very well. I dont think it is the reason of the error. Can you
send your code?

Titang


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



Re: setting ACL dynamically for user 1.2

2007-06-18 Thread danfreak

Cheers Billy!

I already did that but I was trying to understand better whether it is
was possible/more convenient to achieve this result via ACL.

Do you think that the allow method of the Auth library is more
convenient/performant using conditional statements in the controller/
app_controller than using ACL?

Dan

On 18 Giu, 00:54, Divagater <[EMAIL PROTECTED]> wrote:
> If you use the Auth component the default is to deny all actions. You
> can allow access to actions on the fly with $this->Auth-
>
> >allow('someAction') in a beforeFilter.
>
> So, maybe wrapping the allow method in your own conditional to test
> for group membership or ownership etc. is what you are looking for. I
> do this in some cases.
>
> ~Billy


--~--~-~--~~~---~--~~
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: ordering items

2007-06-18 Thread danfreak

If you simply need to update the position of the items in a list using
ajax and dragging/dropping them this is a solution
(based on this thread
http://groups.google.com/group/cake-php/browse_thread/thread/e921d173b7c41519/becb28c858e4d683?lnk=gst&q=sortable&rnum=1#becb28c858e4d683)
--
Controller:
--
params['pass']);
}

function sort()
{
$options = $this->Test->findAll(null, null, 'position ASC');
$this->set('options', $options);
}

function order()
{
  $ids= $this->params['form']['sort'];
  $i = 1;
  foreach($ids as $id){
  $this->Test->id = $id;
  $this->Test->saveField('position', $i++);
  }
 $this->autoRender = false;
 //$this->layout = 'ajax';
}
}

--
MODEL
--

--
VIEW: sort.ctp
--


 - position: 

sortable('sort', array('onUpdate' => "
function(t){new
Ajax.Request( 'order', {method:'post',
postBody:Sortable.serialize('sort'), asynchronous:true})}"))?>
--

I then have an empty view for order.ctp
--
My DB table looks as follows:
--
-- Table structure for table `tests`
--

CREATE TABLE `tests` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(50) NOT NULL,
  `position` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;
--

In the HEADER of your layout remember to include

link('prototype')?>
link('scriptaculous')?>
link('zebra_tables')?>
link('effects')?>
--

Hope this helps!

Dan


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