Re: AssetPackager for CakePHP

2007-07-29 Thread Brad Daily


On Jul 30, 12:53 am, Grant Cox <[EMAIL PROTECTED]> wrote:
> Indeed.  I've put some comments on your blog, but perhaps you should
> consider a Bakery article for this?

Grant - Already done, just waiting approval from the head chefs :)
Also, I responded to your comment on my blog...

Brad

---

Brad Daily
Developer, SlideShowPro Director
[EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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: AssetPackager for CakePHP

2007-07-29 Thread Grant Cox

Indeed.  I've put some comments on your blog, but perhaps you should
consider a Bakery article for this?

On Jul 29, 4:29 am, Walker Hamilton <[EMAIL PROTECTED]> wrote:
> Awesome. Simply awesome.
>
> 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: Software design question regarding the classic "login page" ...

2007-07-29 Thread Dr. Tarique Sani
On 7/30/07, Geoff Ford <[EMAIL PROTECTED]> wrote:
>
>
> As long as the login page redirects back to the requested url after
> successful login in I don't see the difference, and it is probably
> easier and cleaner in my opinion to redirect.


Well rendering a view instead of redirecting is just as simple - one line
each :)

Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Re: need possible solution to remove VALUES being quoted

2007-07-29 Thread Grant Cox

Try putting -! in front of the command, eg
$data = array( 'data' => '-!AES_ENCRYPT(value,key)' );

More detail on Daniel's blog (
http://cakebaker.42dh.com/2007/05/22/how-to-use-sql-functions-in-conditions-part-ii/
)

On Jul 28, 11:56 pm, rpeterson <[EMAIL PROTECTED]> wrote:
> Also, I am using Cake 1.2 latest, and here is the behavior for
> reference,http://bin.cakephp.org/view/166336900


--~--~-~--~~~---~--~~
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: One Association causing a problem !!!

2007-07-29 Thread Grant Cox

Are you using scaffolding in your controller?

The issue sounds like you may have a model classname that is
conflicting with something inbuilt - for example if you try to make a
model called File, or Folder.  However, the three you have listed
(Membership, Coder and Editor) shouldn't have any problem, afaik.

Turn scaffolding on (makes it very quick to test changes), and try
each association separately to see if you can narrow it down.


--~--~-~--~~~---~--~~
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 query function and associated views

2007-07-29 Thread Grant Cox

You have to make it yourself.


On Jul 29, 9:22 pm, rtanz <[EMAIL PROTECTED]> wrote:
> hi if i make a custom sql query in my model and create a function that
> calls it from a models controller then bake my view will it create a
> view for this function or do i have to create any views that are not
> automatically generated by scaffolding myself? 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: inserting controller view into another view

2007-07-29 Thread Grant Cox

Using AJAX, quite easily - just populate an area of your page with the
remote index action.  If you can't use AJAX, not so easily (but more
efficiently).  You will need to retrieve the appropriate data for the
foreign model in the main index action, and display it appropriately.
To get pagination / searching / sorting on both index lists you will
need to have some funky named url parameters (to keep the two lists
separate).


On Jul 30, 8:29 am, rtanz <[EMAIL PROTECTED]> wrote:
> hi i have a view pertaining to a particular model and associations. in
> the index page of this model i would also like to display the index
> view of another model. can i do this? thanks


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



Re: security

2007-07-29 Thread Grant Cox

This really just comes down to authentication, just based on IP
address rather than username / password.  I would recommend you put
some code in your app/app_controller.php beforeFilter(), which checks
what the requested controller/action is, and what the user's IP
address is.  You can get this IP address easily with the
RequestHandler component, using getClientIP().

If the request is from an "external" user, and the requested action
does not allow this, then just redirect / 404 them.


--~--~-~--~~~---~--~~
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: $this->action = images ??

2007-07-29 Thread Grant Cox

Or, are you referring to any images in your view that have a relative
path (and you aren't using the HTML helper image() function)?

If you view localhost/users/index, and there is a relative image
"images/yourimage.jpg", then your browser will actually request
localhost/users/images/yourimage.jpg.  This is why you should always
use a full path, or preferably use the HTML helper image() function,
which does this for 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: $this->action = images ??

2007-07-29 Thread Geoff Ford

Do you have any images with a url of 'controllerName/images/
imageName.png'?


Geoff
--
http://lemoncake.wordpress.com

On Jul 30, 1:04 pm, starkey <[EMAIL PROTECTED]> wrote:
> Sorry, I'm such a noob and I'm swimming through batter.
>
> I'm getting a weird action... After my expected action runs, I get a
> second action of 'images' for some weird reason (I have no idea).  My
> process is really simple (no components, vendors, elements, etc).
>
> Basically, I have this in a controller:
>
> function beforeFilter()
> {
>$actionCheck;
>
>if (!$this->Session->check('Username'))
>{
>   $this->Session->write('Username', 'Anon');
>}
>
>switch($this->action)
>{
>   case 'view':
>   case 'vote':
> $actionCheck= null;
> break;
>   default:
> $actionCheck= 'update';
> break;
>}
>
>if (!empty($action))
>{
>   $this->access = 
> @$this->Acl->check($this->Session->read('Username'), $this->name, 
> $actionCheck);
>
>}
>else
>{
>   $this->access = true;
>}
>
>if (!$this->access)
>{
>   if ('Anon' != $this->Session->read('Username'))
>   {
>  $this->redirect('/login/denied');
>   }
>   else {
>  $this->Session->write('next_page','/'.$this->name.'/'.
> $this->action);
>  $this->redirect('/login');
>   }
>   die();
>}
>
> }
>
> The first time through $this->action is 'view' or some other expected
> action.  Then (after my action completes) it will run again with the
> action of 'images'.  In other words, if I set a breakpoint on the
> switch in this controller it will hit that breakpoint twice, the first
> with the expected action and the second with action set to 'images.'
>
> Any ideas?  Is this the expected operation of Cake?
>
> Thanks,
> Shawn


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



Re: Newbie Introduction Book ... reviews anyone?

2007-07-29 Thread Wimg

i am working with cakephp and want to take a look at ur book .


On Jul 30, 9:10 am, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 7/30/07, Dave <[EMAIL PROTECTED]> wrote:
>
>
>
> >  so I'm not worried about making anyone mad over there.
> > Everything is proceeding carefully and with open channels of
> > communication.
>
> WTG! and good show all around.
>
> Looking forward to seeing your book completed
>
> Tarique
>
> --
> =
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =


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



Re: One Association causing a problem !!!

2007-07-29 Thread uae2k

Any Help here please !


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



$this->action = images ??

2007-07-29 Thread starkey

Sorry, I'm such a noob and I'm swimming through batter.

I'm getting a weird action... After my expected action runs, I get a
second action of 'images' for some weird reason (I have no idea).  My
process is really simple (no components, vendors, elements, etc).

Basically, I have this in a controller:

function beforeFilter()
{
   $actionCheck;

   if (!$this->Session->check('Username'))
   {
  $this->Session->write('Username', 'Anon');
   }

   switch($this->action)
   {
  case 'view':
  case 'vote':
$actionCheck= null;
break;
  default:
$actionCheck= 'update';
break;
   }

   if (!empty($action))
   {
  $this->access = @$this->Acl->check($this->Session-
>read('Username'), $this->name, $actionCheck);
   }
   else
   {
  $this->access = true;
   }

   if (!$this->access)
   {
  if ('Anon' != $this->Session->read('Username'))
  {
 $this->redirect('/login/denied');
  }
  else {
 $this->Session->write('next_page','/'.$this->name.'/'.
$this->action);
 $this->redirect('/login');
  }
  die();
   }

}

The first time through $this->action is 'view' or some other expected
action.  Then (after my action completes) it will run again with the
action of 'images'.  In other words, if I set a breakpoint on the
switch in this controller it will hit that breakpoint twice, the first
with the expected action and the second with action set to 'images.'

Any ideas?  Is this the expected operation of Cake?

Thanks,
Shawn


--~--~-~--~~~---~--~~
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: Need: CakePHP Contact Form Need Please

2007-07-29 Thread Baz
Got everything working now. ThanX for the help.

I guess I just couldn't get it working with PhpMailer and Cake 1.1.

Upgraded to 1.2 and used the included email component and I'm good.

ThanX again.

--
Baz L
Day In The Life of Baz
http://www.LifeOfBaz.com

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



Re: Using models in app controller for default.thtml ???

2007-07-29 Thread Tulio Faria

Or you can try create a component, and load it with loadComponent or
anything else. I think it's better...

On 29 jul, 21:54, Geoff Ford <[EMAIL PROTECTED]> wrote:
> I believe $uses is overwritten by the actual controller that is
> invoked.  I suggest you use loadModel() and creat your own instances
> of the models you need.
>
> Geoff
> --http://lemoncake.wordpress.com
>
> On Jul 29, 8:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hello Friends,
>
> > I am new to Cakephp. I am having an problem in it. The scenario is :-
>
> > i have categories and subcategories. i want to show them as menus so i
> > put them in the default.thtml file. To extract them from  the database
> > i have used  var $uses =array('Category',Subcategory) in
> > app_controller.php in app directory.
>
> > and uses this coding :-
>
> > function beforeFilter()
> >  {
> >  $maincatmenu=$this->Category->findAll();
> >   //rest of the coding
> > On the basis of $maincatmenu i am extracting categories from the
> > subcategories etc.
> >  }
>
> > It is working fine and menus are showing. But somehow when i try to
> > access some other controllers as categories views etc
>
> > It is showing the ERROR such as
>
> > Notice: Undefined property: AppController::$Category in mypath\app
> > \app_controller.php on line 52
>
> > Fatal error: Call to a member function findAll() on a non-object in
> > mypath\app\app_controller.php on line 52
>
> > and for subcategory as well.
>
> > I have tried to use var $uses in other controllers such as articles
> > (as i am storing articles on the basis of categories and
> > subcategories) as var $uses=array('Category','Subcategory');
>
> > But still when i access the articles action such as mypath/articles/
> > view/2 etc.
>
> > it is showing the same Error mentioned above.
>
> > Pls help.
>
> > Thanks


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



Re: Newbie Introduction Book ... reviews anyone?

2007-07-29 Thread Dr. Tarique Sani
On 7/30/07, Dave <[EMAIL PROTECTED]> wrote:
>
>  so I'm not worried about making anyone mad over there.
> Everything is proceeding carefully and with open channels of
> communication.


WTG! and good show all around.

Looking forward to seeing your book completed

Tarique


-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.com
=

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



Re: Newbie Introduction Book ... reviews anyone?

2007-07-29 Thread Dave

Everyone should know that the Cake Software Foundation has already
been open and helpful in providing opportunities for better
documentation, so I'm not worried about making anyone mad over there.
Everything is proceeding carefully and with open channels of
communication.

On Jul 29, 11:58 am, "Chris Hartjes" <[EMAIL PROTECTED]> wrote:
> On 7/28/07, Dave <[EMAIL PROTECTED]> wrote:
>
>
>
> > Ah, well, there is a little more involved when it comes to trademark
> > and patent law. But yes, the logo is definitely owned and must be
> > "blessed." However, in a past project I worked on, Hasbro games tried
> > to convince my publisher that they couldn't use the word "Monopoly" in
> > the title of a book and lost the case flat out. So it is a little less
> > cut-and-dry legally when referring to something rather than taking the
> > logo, etc.
>
> The use of the name "CakePHP" is trademarked and copyrighted.  I have
> seen the documents myself online.  Anyway, my point is this:  do you
> really want to make the driving force behind CakePHP (that would be
> PhpNut) mad at you?  I'm sure all it will take is a few emails between
> the two of you to get everything all smoothed out.
>
> --
> 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: Best practice - multipage Form

2007-07-29 Thread Hans

okay quite new to Cakephp so forgive if i make any obvious mistakes,
but i can't seem to get FormWizard work for me...

I'm trying to make a simple test form with 3 different input screen,
just to grasp the idea of the FormWizard. In every output I print the
$this->data array to see what data is saved in the Session. Is this
right?
Anyway I have the following code:

[b]Polls Controller:[/b]
class PollsController extends AppController {

var $name = 'Polls';
var $helpers = array('Html', 'Form' );
var $components = array('FormWizard');

function start() {
$ways=array("way1" => array("scrn1","scrn2","scrn3"),
"way2" => array("scrn3","scrn2","scrn1"));
$this->FormWizard->initWizard($ways);
$this->FormWizard->changeWay('way1');
}

function scrn1() {
$this->set('polltxt', 'screen1');
}

function scrn1Validate() {
$this->set('polltxt' , 'screen1validate');
return true;
}

function scrn2() {
$this->set('polltxt', 'screen2');
}

function scrn2Validate() {
$this->set('polltxt' , 'screen2validate');
return true;
}

function scrn3() {
$this->set('polltxt', 'screen3');
}

function scrn3Validate() {
$this->set('polltxt' , 'screen3validate');
return true;
}


}

[b]scrn1.ctp[/b]


data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.title');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 


[b]scrn2.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.type');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

[b]scrn3.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.introtext');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

Also accompanying database tables and models have been created.

But when i move around the screens using the Next and Previous
buttons, i get problem similar as descibed in this post:
http://moeffju.net/blog/2007/07/26/about-cake-cakebakers-please-read/
: $this->data is emptied seemingly randomly, data doesn't get Saved in
the Sessions...?.

My question:

1) Can anyone direct my to a good working example on how Formwizard
can be used, kinda of a FormWizard Tutorial for simple people like me
2) If not, what am i doing wrong here ?

thank you for your attention,

Hans


--~--~-~--~~~---~--~~
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: Best practice - multipage Form

2007-07-29 Thread Hans

okay quite new to Cakephp so forgive if i make any obvious mistakes,
but i can't seem to get FormWizard work for me...

I'm trying to make a simple test form with 3 different input screen,
just to grasp the idea of the FormWizard. In every output I print the
$this->data array to see what data is saved in the Session. Is this
right?
Anyway I have the following code:

[b]Polls Controller:[/b]
class PollsController extends AppController {

var $name = 'Polls';
var $helpers = array('Html', 'Form' );
var $components = array('FormWizard');

function start() {
$ways=array("way1" => array("scrn1","scrn2","scrn3"),
"way2" => array("scrn3","scrn2","scrn1"));
$this->FormWizard->initWizard($ways);
$this->FormWizard->changeWay('way1');
}

function scrn1() {
$this->set('polltxt', 'screen1');
}

function scrn1Validate() {
$this->set('polltxt' , 'screen1validate');
return true;
}

function scrn2() {
$this->set('polltxt', 'screen2');
}

function scrn2Validate() {
$this->set('polltxt' , 'screen2validate');
return true;
}

function scrn3() {
$this->set('polltxt', 'screen3');
}

function scrn3Validate() {
$this->set('polltxt' , 'screen3validate');
return true;
}


}

[b]scrn1.ctp[/b]


data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.title');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 


[b]scrn2.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.type');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

[b]scrn3.ctp[/b]

data);
   echo $form->create('Poll', array('action'=>'/polls/start',
'url'=>'/polls/start'));
   echo $form->input('Poll.introtext');
   echo $form->submit('Previous Step',array('name'=>'previous'));
   echo $form->submit('Next Step',array('name'=>'next'));
?>
 

Also accompanying database tables and models have been created.

But when i move around the screens using the Next and Previous
buttons, i get problem similar as descibed in this post:
http://moeffju.net/blog/2007/07/26/about-cake-cakebakers-please-read/
: $this->data is emptied seemingly randomly, data doesn't get Saved in
the Sessions...?.

My question:

1) Can anyone direct my to a good working example on how Formwizard
can be used, kinda of a FormWizard Tutorial for simple people like me
2) If not, what am i doing wrong here ?

thank you for your attention,

Hans


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



Re: Using models in app controller for default.thtml ???

2007-07-29 Thread Geoff Ford

I believe $uses is overwritten by the actual controller that is
invoked.  I suggest you use loadModel() and creat your own instances
of the models you need.

Geoff
--
http://lemoncake.wordpress.com

On Jul 29, 8:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hello Friends,
>
> I am new to Cakephp. I am having an problem in it. The scenario is :-
>
> i have categories and subcategories. i want to show them as menus so i
> put them in the default.thtml file. To extract them from  the database
> i have used  var $uses =array('Category',Subcategory) in
> app_controller.php in app directory.
>
> and uses this coding :-
>
> function beforeFilter()
>  {
>  $maincatmenu=$this->Category->findAll();
>   //rest of the coding
> On the basis of $maincatmenu i am extracting categories from the
> subcategories etc.
>  }
>
> It is working fine and menus are showing. But somehow when i try to
> access some other controllers as categories views etc
>
> It is showing the ERROR such as
>
> Notice: Undefined property: AppController::$Category in mypath\app
> \app_controller.php on line 52
>
> Fatal error: Call to a member function findAll() on a non-object in
> mypath\app\app_controller.php on line 52
>
> and for subcategory as well.
>
> I have tried to use var $uses in other controllers such as articles
> (as i am storing articles on the basis of categories and
> subcategories) as var $uses=array('Category','Subcategory');
>
> But still when i access the articles action such as mypath/articles/
> view/2 etc.
>
> it is showing the same Error mentioned above.
>
> Pls help.
>
> 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: help with form input with multiple objects of same name/class/model

2007-07-29 Thread Geoff Ford

Using Housebolts method the action would look like:

for ($i=0; $i<5; $i++){
  $this->User->create();
  // assign all the fields with correct names
  $user['email'] = $this->data['User']['email' + $i];

  $this->User->set($user);
  if (!$this->User->validates()) {
// You will need to do the following for every field
if (isset($this->User->invalidFields['User']['email']) {
  $this->User->invalidFields['User']['email' + $i] = $this->User-
>invalidFields['User']['email'];
  unset($this->User->invalidFields['User']['email']);
}
  } else {
$this->User->save();
  }
}

Geoff
--
http://lemoncake.wordpress.com

On Jul 30, 4:20 am, gavincomputer <[EMAIL PROTECTED]> wrote:
> Hi Housebolt and others,
>
> First, thank Housebolt.
>
> If I do like Housuebolt suggests, I can't say:
>
> this->User->save($this->data['User']);
>
> Since email1, email2, firstname1 or firstname2 are not fields exist in
> users table. I can
> extract value out and reassign them like $this->data['User']['email']
> = $this->data['User']['email1'],
> and then I can try to save. but when data validation finds errors, it
> does not set error message on the
> field we want, it will say User/email is wrong, but it won't say User/
> email1 is wrong, so it won't trigger
> the right error message to be displayed, if I try to do data
> validation myself, then why we are using cake?
> There should be an easy way to do this, I hope.
>
> On Jul 29, 12:05 am, housebolt <[EMAIL PROTECTED]> wrote:
>
> > The easiest way to do this is identifying the email/lastname/firstname
> > by a number, rather than trying to create a new array within the
> > array.
>
> > i.e.
> > 
> > tagErrorMsg('User/firstname1', 'First name is
> > required'); ?>
>
> > in other words:
>
> >  > for($i=0; $i<5; $i++) {
> >  echo $html->input('User/lastname'.$i),"\n";
> >  echo $html->tagErrorMsg(User/lastname'.$i, 'Last name is
> > required')."\n";}
>
> > ?>
>
> > This should output
>
> > $this->data['User'] =
> > array('firstname1' => 'george',
> > 'lastname1=> 'john',
> > 'email1' => '[EMAIL PROTECTED]',
> > 'firstname2 => 'bob',  etc. etc. etc.
>
> > You'll be able to manipulate this data to your liking in your
> > controller once it's been submitted.
>
> > Hope this helps : ).
>
> > On Jul 28, 10:35 pm, gavincomputer <[EMAIL PROTECTED]> wrote:
>
> > > Could not find the post I just posted, so I post it again here, sorry,
> > > if duplicate.
>
> > > I am creating this code to manage people for a birthday party, in my
> > > party manage page, I need to add a couple of persons using a form, in
> > > the form, every users' email, firstname, lastname would be inputed,
> > > then my controller would save these people's info into a database.
>
> > > I have a couple of problems:
>
> > > !),  first, if I use the code below for people to input emails, I
> > > believe the second person's email address will overwrite the first
> > > person's email, since they are of same name. What would be a good
> > > solution to this problem:
>
> > > Recipient email:
> > > input('User/email', array('size' => '40'))?>
> > > tagErrorMsg('User/email', 'A valid email
> > > address is required.') ?>
>
> > > 2) in order to avoid the problem above, I did sth like below:
>
> > > 
> > > Recipient  email:
> > >  > > size="40">
> > > tagErrorMsg('User/email', 'A 
> > > valid email address
> > > is
> > >   required.') ?>
> > > Recipient  name:
> > >  > > value="">
> > > tagErrorMsg('User/firstname', 
> > > 'First name is
> > > required.') ?>
> > >  > > value="">
> > > tagErrorMsg('User/lastname', 
> > > 'Last name is
> > > required.') ?>
> > > 
>
> > > now, I have different input names, but in controller, when you try to
> > > save user info into database like following,
>
> > >  if ($this->User->validates($this->data['User'][$i])){
> > > if ($this->User->save($this->data['User'][$i])){
> > > }
> > >  } else {
> > > $this->User->invalidate($this->data['User'][$i]
> > > ['email']);
> > > $this->render();
> > >  }
>
> > > The data validation part would not work when user input an invalid
> > > email or empty firstname, the error message will appear for all
> > > inputed person even if only one person's email address is wrong.
>
> > > if I change error message part like following:
> > >   tagErrorMsg('User/emial][', 'A valid email
> > > is required.') ?>
> > > or
> > >   tagErrorMsg('User][/email', 'A valid email
> > > is required.') ?>
>
> > > then the error message will not show up.
>
> > > Does any body have any idea how to do cakephp's 

Re: Software design question regarding the classic "login page" ...

2007-07-29 Thread Geoff Ford

As long as the login page redirects back to the requested url after
successful login in I don't see the difference, and it is probably
easier and cleaner in my opinion to redirect.

Geoff
--
http://lemoncake.wordpress.com

On Jul 30, 5:30 am, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
> On 7/29/07, chess64 <[EMAIL PROTECTED]> wrote:
>
>
>
> > >From a search-engine optimization standpoint, the first option is
> > better, otherwise when the search engine tries to access any of the
> > private pages, it will get the login form, which is probably not what
> > you want. By using the first option, the search engine will simply not
> > index the private page.
>
> True, someone brought this up in #cakephp, however, since this is a private
> site and the search engine is one that doesn't just recursively get all the
> pages, it's probably not an issue.
>
> - Gonzalo


--~--~-~--~~~---~--~~
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: Form checkbox?

2007-07-29 Thread Geoff Ford

I think in 1.2 all input fields are to go through $form->input() so a
check box would be $form->input(array('type' => 'checkbox'));

Geoff
--
http://lemoncake.wordpress.com

On Jul 30, 9:27 am, citrus <[EMAIL PROTECTED]> wrote:
> Have you enabled the Form Helper?
>
> $helpers = array('Html', 'Form', 'Session');
>
> On Jul 30, 4:49 am, Mech7 <[EMAIL PROTECTED]> wrote:
>
> > I this allready in 1.2 i see in the 
> > API..http://api.cakephp.org/1.2/class_form_helper.html#b8d997c3ed8911e37bf...
>
> > But when i use it like:
>
> > checkbox('Article.frontpage'); ?>
>
> > I get this error:
>
> > Warning (512): Method FormHelper::checkbox does not exist [CORE\cake
> > \libs\view\helper.php, line 148]


--~--~-~--~~~---~--~~
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 running dead slow

2007-07-29 Thread Grant Cox

On Jul 29, 4:45 pm, housebolt <[EMAIL PROTECTED]> wrote:
> $uses is evil and should be sparsely used.

Do you have any benchmarks to back this up, or any comments from the
core Cake developers (ie PHPNut or Nate) to this effect?  I have not
heard this before, and it sounds like FUD.  I use loadModel heavily in
my code and do not notice any particular performance hit (and afaik
loadModel is basically the same as $uses).  Cake model instances are
cached in the ClassRegistry, and I was under the impression these
existing instances were used for associations and $uses where
possible.

Certainly there is some performance hit to loading in Model classes
(and it shouldn't be done unnecessarily), but unless you have some
further proof I don't believe this is any worse whether they are
loaded through associations, through $uses, or through loadModel.


--~--~-~--~~~---~--~~
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: Form checkbox?

2007-07-29 Thread citrus

Have you enabled the Form Helper?

$helpers = array('Html', 'Form', 'Session');

On Jul 30, 4:49 am, Mech7 <[EMAIL PROTECTED]> wrote:
> I this allready in 1.2 i see in the 
> API..http://api.cakephp.org/1.2/class_form_helper.html#b8d997c3ed8911e37bf...
>
> But when i use it like:
>
> checkbox('Article.frontpage'); ?>
>
> I get this error:
>
> Warning (512): Method FormHelper::checkbox does not exist [CORE\cake
> \libs\view\helper.php, line 148]


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



security

2007-07-29 Thread monty

Hi there,
I have an web application I have built for a company in Cake where I
want internal users
to access certain controllers 192.168.1.173/cake/internal say.
External users should only
be able to access mydomain.com/cake/external/ from the same
application.

What would be the best way to set this up? through .htaccess or
firewall (I am not a sys admin but it looks like I can only limit
settings to the port level on the firewall).

PLease help,
Simon.


--~--~-~--~~~---~--~~
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: view error when performing sql query

2007-07-29 Thread Pablo Viojo
You're using findByName in your controller, which returns a single element
(a car not a cars array). Try findAllByName if you want to get more than
one, or change your view code, removing the foreach loop

Pablo



On 7/29/07, rtanz <[EMAIL PROTECTED]> wrote:
>
>
> sorry here it is:
>
> 
> List Mazda Cars
>
> 
> 
> Id
> Name
> Model
> Actions
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
>
>
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

--~--~-~--~~~---~--~~
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: view error when performing sql query

2007-07-29 Thread rtanz

sorry here it is:


List Mazda Cars



Id
Name
Model
Actions














--~--~-~--~~~---~--~~
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 do you usually create admin area on site with CakePHP?

2007-07-29 Thread cakeFreak

Check out this thread:

 admin backend best practice

http://groups.google.com/group/cake-php/browse_frm/thread/7e14ca05b59e27f/d8e76d231cc58d15?lnk=gst&q=admin+best+practice&rnum=3#d8e76d231cc58d15


--~--~-~--~~~---~--~~
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: view error when performing sql query

2007-07-29 Thread Gonzalo Servat
On 7/29/07, rtanz <[EMAIL PROTECTED]> wrote:
>
>
> Id
>  
> Name
>  
> Model
>  


You might want to provide the other relevant parts of your view code.. like,
the foreach loop surrounding the text above.

- Gonzalo

--~--~-~--~~~---~--~~
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: view error when performing sql query

2007-07-29 Thread rtanz

Id
 
Name
 
Model
 

On Jul 29, 11:51 pm, "Pablo Viojo" <[EMAIL PROTECTED]> wrote:
> And your view code?
>
> On 7/29/07, rtanz <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > hi i am trying to perform some sql querying in a controller but keep
> > getting this error
>
> > Notice: Undefined index: Car in W:\www\cake\app\views\cars\index.thtml
> > on line 13
>
> > My controller code is:
>
> > function index() {
> > $this->Car->recursive = 0;
> > $this->set('cars', $this->Car->findByName('Mazda'));
> > }
>
> > what is the problem? thanks
>
> --
> Pablo Viojo
> [EMAIL PROTECTED]://pviojo.net


--~--~-~--~~~---~--~~
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: view error when performing sql query

2007-07-29 Thread Pablo Viojo
And your view code?

On 7/29/07, rtanz <[EMAIL PROTECTED]> wrote:
>
>
> hi i am trying to perform some sql querying in a controller but keep
> getting this error
>
> Notice: Undefined index: Car in W:\www\cake\app\views\cars\index.thtml
> on line 13
>
> My controller code is:
>
> function index() {
> $this->Car->recursive = 0;
> $this->set('cars', $this->Car->findByName('Mazda'));
> }
>
> what is the problem? thanks
>
>
> >
>


-- 
Pablo Viojo
[EMAIL PROTECTED]
http://pviojo.net

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



inserting controller view into another view

2007-07-29 Thread rtanz

hi i have a view pertaining to a particular model and associations. in
the index page of this model i would also like to display the index
view of another model. can i do this? thanks


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



view error when performing sql query

2007-07-29 Thread rtanz

hi i am trying to perform some sql querying in a controller but keep
getting this error

Notice: Undefined index: Car in W:\www\cake\app\views\cars\index.thtml
on line 13

My controller code is:

function index() {
$this->Car->recursive = 0;
$this->set('cars', $this->Car->findByName('Mazda'));
}

what is the problem? thanks


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



Form checkbox?

2007-07-29 Thread Mech7

I this allready in 1.2 i see in the API..
http://api.cakephp.org/1.2/class_form_helper.html#b8d997c3ed8911e37bf69b1a4112e3b3

But when i use it like:

checkbox('Article.frontpage'); ?>

I get this error:

Warning (512): Method FormHelper::checkbox does not exist [CORE\cake
\libs\view\helper.php, line 148]


--~--~-~--~~~---~--~~
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: Software design question regarding the classic "login page" ...

2007-07-29 Thread Gonzalo Servat
On 7/29/07, chess64 <[EMAIL PROTECTED]> wrote:
>
>
> >From a search-engine optimization standpoint, the first option is
> better, otherwise when the search engine tries to access any of the
> private pages, it will get the login form, which is probably not what
> you want. By using the first option, the search engine will simply not
> index the private page.


True, someone brought this up in #cakephp, however, since this is a private
site and the search engine is one that doesn't just recursively get all the
pages, it's probably not an issue.

- Gonzalo

--~--~-~--~~~---~--~~
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: Software design question regarding the classic "login page" ...

2007-07-29 Thread chess64

>From a search-engine optimization standpoint, the first option is
better, otherwise when the search engine tries to access any of the
private pages, it will get the login form, which is probably not what
you want. By using the first option, the search engine will simply not
index the private page.

-Adeel

On Jul 29, 2:22 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I'm working on a private site (ie. all pages are only accessible to logged
> in users) and I'm trying to figure out if it's best to redirect the user to
> a login URL or keep the URL as is and display the login form. Here are the 2
> scenarios:
>
> 1) User requests /resources/list (since it is in the user's history.. maybe
> bookmarked?). app_controller.php checks that the session variable
> User.iddoesn't exist so Cake redirects the user to /users/login (ie.
> URL in the
> Address/Location bar has now changed to /users/login). This would mean that
> I'd store all the user validation code inside the users_controller and the
> User model and I'd have to keep track of what URL was originally requested.
>
> OR
>
> 2) User requests /resources/list. URL stays as is, but app_controller.php
> dispatches /users/login and the form action tag points to /resources/list.
> User enters their login/pass, clicks submit (which points to /resources/list
> .. as per the form tag) so app_controller.php sees that the user is not
> logged in but $this->data has a username/password set so app_controller does
> the validating and sets the right Session variables. The user gets to see
> the /resources/list page. Also, if the user was entering some data on a page
> and their session times out, I thought that maybe I could also keep
> $this->data in memory when the user clicks submit, and set it back to
> $this->data when they've logged in successfully.
>
> I personally like 2) best since I don't have to worry about which page the
> user requested (as the URL doesn't change), but before I change my code
> (currently using option 1), I'd like to hear other's opinions on this.
>
> Thanks in advance!
>
> - Gonzalo


--~--~-~--~~~---~--~~
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: help with form input with multiple objects of same name/class/model

2007-07-29 Thread gavincomputer

Hi Housebolt and others,

First, thank Housebolt.

If I do like Housuebolt suggests, I can't say:

this->User->save($this->data['User']);

Since email1, email2, firstname1 or firstname2 are not fields exist in
users table. I can
extract value out and reassign them like $this->data['User']['email']
= $this->data['User']['email1'],
and then I can try to save. but when data validation finds errors, it
does not set error message on the
field we want, it will say User/email is wrong, but it won't say User/
email1 is wrong, so it won't trigger
the right error message to be displayed, if I try to do data
validation myself, then why we are using cake?
There should be an easy way to do this, I hope.

On Jul 29, 12:05 am, housebolt <[EMAIL PROTECTED]> wrote:
> The easiest way to do this is identifying the email/lastname/firstname
> by a number, rather than trying to create a new array within the
> array.
>
> i.e.
> 
> tagErrorMsg('User/firstname1', 'First name is
> required'); ?>
>
> in other words:
>
>  for($i=0; $i<5; $i++) {
>  echo $html->input('User/lastname'.$i),"\n";
>  echo $html->tagErrorMsg(User/lastname'.$i, 'Last name is
> required')."\n";}
>
> ?>
>
> This should output
>
> $this->data['User'] =
> array('firstname1' => 'george',
> 'lastname1=> 'john',
> 'email1' => '[EMAIL PROTECTED]',
> 'firstname2 => 'bob',  etc. etc. etc.
>
> You'll be able to manipulate this data to your liking in your
> controller once it's been submitted.
>
> Hope this helps : ).
>
> On Jul 28, 10:35 pm, gavincomputer <[EMAIL PROTECTED]> wrote:
>
> > Could not find the post I just posted, so I post it again here, sorry,
> > if duplicate.
>
> > I am creating this code to manage people for a birthday party, in my
> > party manage page, I need to add a couple of persons using a form, in
> > the form, every users' email, firstname, lastname would be inputed,
> > then my controller would save these people's info into a database.
>
> > I have a couple of problems:
>
> > !),  first, if I use the code below for people to input emails, I
> > believe the second person's email address will overwrite the first
> > person's email, since they are of same name. What would be a good
> > solution to this problem:
>
> > Recipient email:
> > input('User/email', array('size' => '40'))?>
> > tagErrorMsg('User/email', 'A valid email
> > address is required.') ?>
>
> > 2) in order to avoid the problem above, I did sth like below:
>
> > 
> > Recipient  email:
> >  > size="40">
> > tagErrorMsg('User/email', 'A 
> > valid email address
> > is
> >   required.') ?>
> > Recipient  name:
> >  > value="">
> > tagErrorMsg('User/firstname', 
> > 'First name is
> > required.') ?>
> >  > value="">
> > tagErrorMsg('User/lastname', 
> > 'Last name is
> > required.') ?>
> > 
>
> > now, I have different input names, but in controller, when you try to
> > save user info into database like following,
>
> >  if ($this->User->validates($this->data['User'][$i])){
> > if ($this->User->save($this->data['User'][$i])){
> > }
> >  } else {
> > $this->User->invalidate($this->data['User'][$i]
> > ['email']);
> > $this->render();
> >  }
>
> > The data validation part would not work when user input an invalid
> > email or empty firstname, the error message will appear for all
> > inputed person even if only one person's email address is wrong.
>
> > if I change error message part like following:
> >   tagErrorMsg('User/emial][', 'A valid email
> > is required.') ?>
> > or
> >   tagErrorMsg('User][/email', 'A valid email
> > is required.') ?>
>
> > then the error message will not show up.
>
> > Does any body have any idea how to do cakephp's way of automatic
> > database save and data validation with several objects of same type/
> > model (User) in a single form?
>
> > Thanks!
>
> > Gavin


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



Software design question regarding the classic "login page" ...

2007-07-29 Thread Gonzalo Servat
Hi All,

I'm working on a private site (ie. all pages are only accessible to logged
in users) and I'm trying to figure out if it's best to redirect the user to
a login URL or keep the URL as is and display the login form. Here are the 2
scenarios:

1) User requests /resources/list (since it is in the user's history.. maybe
bookmarked?). app_controller.php checks that the session variable
User.iddoesn't exist so Cake redirects the user to /users/login (ie.
URL in the
Address/Location bar has now changed to /users/login). This would mean that
I'd store all the user validation code inside the users_controller and the
User model and I'd have to keep track of what URL was originally requested.

OR

2) User requests /resources/list. URL stays as is, but app_controller.php
dispatches /users/login and the form action tag points to /resources/list.
User enters their login/pass, clicks submit (which points to /resources/list
.. as per the form tag) so app_controller.php sees that the user is not
logged in but $this->data has a username/password set so app_controller does
the validating and sets the right Session variables. The user gets to see
the /resources/list page. Also, if the user was entering some data on a page
and their session times out, I thought that maybe I could also keep
$this->data in memory when the user clicks submit, and set it back to
$this->data when they've logged in successfully.

I personally like 2) best since I don't have to worry about which page the
user requested (as the URL doesn't change), but before I change my code
(currently using option 1), I'd like to hear other's opinions on this.

Thanks in advance!

- Gonzalo

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



Re: Newbie Introduction Book ... reviews anyone?

2007-07-29 Thread Chris Hartjes

On 7/28/07, Dave <[EMAIL PROTECTED]> wrote:
>
> Ah, well, there is a little more involved when it comes to trademark
> and patent law. But yes, the logo is definitely owned and must be
> "blessed." However, in a past project I worked on, Hasbro games tried
> to convince my publisher that they couldn't use the word "Monopoly" in
> the title of a book and lost the case flat out. So it is a little less
> cut-and-dry legally when referring to something rather than taking the
> logo, etc.
>

The use of the name "CakePHP" is trademarked and copyrighted.  I have
seen the documents myself online.  Anyway, my point is this:  do you
really want to make the driving force behind CakePHP (that would be
PhpNut) mad at you?  I'm sure all it will take is a few emails between
the two of you to get everything all smoothed out.

-- 
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: Easy problem, not all that easy to figure out (set function)

2007-07-29 Thread Gorka

If I understood you right, you are overwritting the value of 'gallery'
with the second call to $this->set(), when you wanted to merge both
values. Try preparing your data first, then setting 'gallery' for the
view.

$galery = $this->Gallery->findAll();
$gallery['numRows'] = $this->Gallery->getNumRows();
$this->set('gallery', $gallery);

On 29 jul, 17:30, DrLaban <[EMAIL PROTECTED]> wrote:
> Hey all!
>
> Short and simple;
> I'm trying to add more data to a Controller object with the help of
> set().
>
> So what I'm doing in practice:
> $this->set('gallery', $this->Gallery->findAll());
>
> Everything works out fine here. I get access to all the info I need in
> the view I'm working with.
> Now, I'd like to add something simple like "numRows" to the gallery
> variable.
>
> What I've tried is:
> $this->set('gallery', array('numRows' => $this->Gallery-
>
> >getNumRows());
>
> But, as it would seem, the gallery object now only contains the last
> set function call's info. How do I add info to the gallery object
> without losing info from the first set call? I'd just like to add a
> field called "numRows" that contains the int value of rows returned,
> into the gallery object.
>
> Thanks in advance!
>
> Regards
>  DrLaban


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



Easy problem, not all that easy to figure out (set function)

2007-07-29 Thread DrLaban

Hey all!

Short and simple;
I'm trying to add more data to a Controller object with the help of
set().

So what I'm doing in practice:
$this->set('gallery', $this->Gallery->findAll());

Everything works out fine here. I get access to all the info I need in
the view I'm working with.
Now, I'd like to add something simple like "numRows" to the gallery
variable.

What I've tried is:
$this->set('gallery', array('numRows' => $this->Gallery-
>getNumRows());

But, as it would seem, the gallery object now only contains the last
set function call's info. How do I add info to the gallery object
without losing info from the first set call? I'd just like to add a
field called "numRows" that contains the int value of rows returned,
into the gallery object.

Thanks in advance!

Regards
 DrLaban


--~--~-~--~~~---~--~~
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 use the 'finderQuery' attribute of your model definitions.

2007-07-29 Thread dakomoon

Sorry Stefano I don't know where to send you.  All I can tell you is
that it's a variable that Cake automatically populates when it
generates the query and it will be populated with the id of the model
that the finder query is being defined on.  In this case since I'm
trying to find out airport information for a particular book I define
the query as part of the relationship between the be books and
airports and cake will automatcially populate the {$__cakeID__$} with
the id of the book.


--~--~-~--~~~---~--~~
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 running dead slow

2007-07-29 Thread phpjoy

housebolt, how slow is $uses?

i should treat 'loadModel()' with the same care ['stay away as much as
you can']?
how slow does it make the production software?

On Jul 29, 8:45 am, housebolt <[EMAIL PROTECTED]> wrote:
> It probably is your server. I ran a couple of apps on a godaddy shared
> server (with CGI) and the load on the server was already so high that
> adding a large app load on top of all of it made the thing slow, but
> not nearly as slow as what you've got going. I used to have an app
> with about 30 tables running clean and smooth on a shared server, it's
> just a matter of how efficient your code is and how fast your mysql
> server is responding to requests.
>
> Also, you'll want to check that you're not using var $uses heavily in
> your controllers. For example you'll want to use 
> $this->Users->Profile->read() instead of using var $uses = array('Users', 
> 'Profile'); (and
>
> $this->Profile->read()). $uses is evil and should be sparsely used.
>
> Last but not least, try setting debug to '0' in /app/config/core.php.
> Cake will do some automagical caching to speed things up a bit.
>
> But all in all, I'd recommend getting a new server. I run pretty much
> everything these days on mediatemple (mediatemple.com). Check them
> out, they've got a great setup.
>
> On Jul 28, 7:47 pm, "AzGhanv/." <[EMAIL PROTECTED]> wrote:
>
> > Just need to confirm... is there some known issue of cake with
> > Apache1.3/CGI .
> > i have also asked server hosting company to check load.
> > sometimes it takes 2-3s and sometimes 20-60s for php exec.
>
> > plz reply if someone have any idea ...
>
> > On Jul 28, 11:44 pm, "AzGhanv/." <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Cake PHP is running dead slow on production server, plz check it
> > > yourself ...http://www.voiceofkhanqah.com, On load, at bottom of page it 
> > > shows ...
> > > 
>
> > > For phpinfo() ...http://www.voiceofkhanqah.com/afnan.php
>
> > > For debug level 3 logs of main page ...
> > > -
> > > 3 queries took 57 ms
> > > Nr Query Error Affected Num. rows Took (ms)
> > > 1 DESCRIBE `majalis`  6 6 18
> > > 2 DESCRIBE `users`  5 5 29
> > > 3 SELECT `Majlis`.`id`, `Majlis`.`title`, `Majlis`.`start_time`,
> > > `Majlis`.`end_time`, `Majlis`.`status`, `Majlis`.`weekdays` FROM
> > > `majalis` AS `Majlis` WHERE status=1   5 5 10
>
> > > other static content (htm) on same server runs comparatively faster 
> > > ..http://www.voiceofkhanqah.com/old/
>
> > > please reply what i m missing, thanks in advance.
>
> > > Afnan.


--~--~-~--~~~---~--~~
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 query function and associated views

2007-07-29 Thread rtanz

hi if i make a custom sql query in my model and create a function that
calls it from a models controller then bake my view will it create a
view for this function or do i have to create any views that are not
automatically generated by scaffolding myself? 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
-~--~~~~--~~--~--~---



Using models in app controller for default.thtml ???

2007-07-29 Thread [EMAIL PROTECTED]

Hello Friends,

I am new to Cakephp. I am having an problem in it. The scenario is :-

i have categories and subcategories. i want to show them as menus so i
put them in the default.thtml file. To extract them from  the database
i have used  var $uses =array('Category',Subcategory) in
app_controller.php in app directory.

and uses this coding :-

function beforeFilter()
 {
 $maincatmenu=$this->Category->findAll();
  //rest of the coding
On the basis of $maincatmenu i am extracting categories from the
subcategories etc.
 }

It is working fine and menus are showing. But somehow when i try to
access some other controllers as categories views etc

It is showing the ERROR such as

Notice: Undefined property: AppController::$Category in mypath\app
\app_controller.php on line 52

Fatal error: Call to a member function findAll() on a non-object in
mypath\app\app_controller.php on line 52

and for subcategory as well.

I have tried to use var $uses in other controllers such as articles
(as i am storing articles on the basis of categories and
subcategories) as var $uses=array('Category','Subcategory');

But still when i access the articles action such as mypath/articles/
view/2 etc.

it is showing the same Error mentioned above.

Pls help.

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: how can i use 10n in cake 1.2

2007-07-29 Thread Gorka

Please see the frequent dicussion page
http://groups.google.co.uk/group/cake-php/web/frequent-discussions and
search the group before making a question, you will get your answers
faster and will not create duplicated threads.

On 29 jul, 11:04, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> So I foundhttp://api.cakephp.org/1.2/l10n_8php-source.htmlis it
> completed class ? which function i must use in view and how look file
> witch translation.


--~--~-~--~~~---~--~~
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: Random Image Helper

2007-07-29 Thread Grzegorz Pawlik

post it on bakery :)

On Jul 28, 7:14 pm, Mike <[EMAIL PROTECTED]> wrote:
> Hi everyone, I made a helper for random images
>
> It's at  http://mikeski.net/new/snippets/view/24
>
> Enjoy!


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



how can i use 10n in cake 1.2

2007-07-29 Thread [EMAIL PROTECTED]

So I found http://api.cakephp.org/1.2/l10n_8php-source.html is it
completed class ? which function i must use in view and how look file
witch translation.


--~--~-~--~~~---~--~~
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 do you usually create admin area on site with CakePHP?

2007-07-29 Thread housebolt

Well, that's a matter of opinion, but the other way you can do this is
by putting your cake core into a root folder, and then referencing
your cake app folder config files to that cake core location, so you
can have a separation of production and admin interfaces. You'd just
have to make sure your models are the same in each. Cake doesn't
automatically build admin interfaces for you, so you have to build it
yourself. I don't know that there's a framework out there that does
that (and no, symfony doesn't count, since it only does the basics,
much like cake's scaffolding and bake.php). However, you should take a
look at scaffolding (and bake.php) in the cake manual. Scaffolding
does your basics, but again to get anything useful you'll have to
build it yourself.

On Jul 28, 9:24 pm, Pento <[EMAIL PROTECTED]> wrote:
> Thanks, but I think that it's very poor  admin interface and all my
> contollers will be mixed with checks of privileges.
> And in point of fact Admin Interface is simply different application
> but with same models
>
> On 23 июл, 18:27, cauld <[EMAIL PROTECTED]> wrote:
>
> > Have a look at the advanced routing configuration in section 4 in the
> > manual (http://manual.cakephp.org/chapter/configuration).  This should
> > give you what you need.
>
> > On Jul 22, 10:49 pm, Pento <[EMAIL PROTECTED]> wrote:
>
> > > So, there are usual site andadminarea for add some news, materials
> > > and so on.
> > > It's good idea to make thisadminarea on subdomain (for example,
> > >admin.somesite.org)?
> > > As I think it's only one way for it.


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



Re: Cake PHP running dead slow

2007-07-29 Thread housebolt

It probably is your server. I ran a couple of apps on a godaddy shared
server (with CGI) and the load on the server was already so high that
adding a large app load on top of all of it made the thing slow, but
not nearly as slow as what you've got going. I used to have an app
with about 30 tables running clean and smooth on a shared server, it's
just a matter of how efficient your code is and how fast your mysql
server is responding to requests.

Also, you'll want to check that you're not using var $uses heavily in
your controllers. For example you'll want to use $this->Users->Profile-
>read() instead of using var $uses = array('Users', 'Profile'); (and
$this->Profile->read()). $uses is evil and should be sparsely used.

Last but not least, try setting debug to '0' in /app/config/core.php.
Cake will do some automagical caching to speed things up a bit.

But all in all, I'd recommend getting a new server. I run pretty much
everything these days on mediatemple (mediatemple.com). Check them
out, they've got a great setup.


On Jul 28, 7:47 pm, "AzGhanv/." <[EMAIL PROTECTED]> wrote:
> Just need to confirm... is there some known issue of cake with
> Apache1.3/CGI .
> i have also asked server hosting company to check load.
> sometimes it takes 2-3s and sometimes 20-60s for php exec.
>
> plz reply if someone have any idea ...
>
> On Jul 28, 11:44 pm, "AzGhanv/." <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Cake PHP is running dead slow on production server, plz check it
> > yourself ...http://www.voiceofkhanqah.com, On load, at bottom of page it 
> > shows ...
> > 
>
> > For phpinfo() ...http://www.voiceofkhanqah.com/afnan.php
>
> > For debug level 3 logs of main page ...
> > -
> > 3 queries took 57 ms
> > Nr Query Error Affected Num. rows Took (ms)
> > 1 DESCRIBE `majalis`  6 6 18
> > 2 DESCRIBE `users`  5 5 29
> > 3 SELECT `Majlis`.`id`, `Majlis`.`title`, `Majlis`.`start_time`,
> > `Majlis`.`end_time`, `Majlis`.`status`, `Majlis`.`weekdays` FROM
> > `majalis` AS `Majlis` WHERE status=1   5 5 10
>
> > other static content (htm) on same server runs comparatively faster 
> > ..http://www.voiceofkhanqah.com/old/
>
> > please reply what i m missing, thanks in advance.
>
> > Afnan.


--~--~-~--~~~---~--~~
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: help with form input with multiple objects of same name/class/model

2007-07-29 Thread housebolt

The easiest way to do this is identifying the email/lastname/firstname
by a number, rather than trying to create a new array within the
array.

i.e.

tagErrorMsg('User/firstname1', 'First name is
required'); ?>

in other words:

input('User/lastname'.$i),"\n";
 echo $html->tagErrorMsg(User/lastname'.$i, 'Last name is
required')."\n";
}
?>

This should output

$this->data['User'] =
array('firstname1' => 'george',
'lastname1=> 'john',
'email1' => '[EMAIL PROTECTED]',
'firstname2 => 'bob',  etc. etc. etc.

You'll be able to manipulate this data to your liking in your
controller once it's been submitted.

Hope this helps : ).



On Jul 28, 10:35 pm, gavincomputer <[EMAIL PROTECTED]> wrote:
> Could not find the post I just posted, so I post it again here, sorry,
> if duplicate.
>
> I am creating this code to manage people for a birthday party, in my
> party manage page, I need to add a couple of persons using a form, in
> the form, every users' email, firstname, lastname would be inputed,
> then my controller would save these people's info into a database.
>
> I have a couple of problems:
>
> !),  first, if I use the code below for people to input emails, I
> believe the second person's email address will overwrite the first
> person's email, since they are of same name. What would be a good
> solution to this problem:
>
> Recipient email:
> input('User/email', array('size' => '40'))?>
> tagErrorMsg('User/email', 'A valid email
> address is required.') ?>
>
> 2) in order to avoid the problem above, I did sth like below:
>
> 
> Recipient  email:
>  size="40">
> tagErrorMsg('User/email', 'A valid 
> email address
> is
>   required.') ?>
> Recipient  name:
>  value="">
> tagErrorMsg('User/firstname', 
> 'First name is
> required.') ?>
>  value="">
> tagErrorMsg('User/lastname', 'Last 
> name is
> required.') ?>
> 
>
> now, I have different input names, but in controller, when you try to
> save user info into database like following,
>
>  if ($this->User->validates($this->data['User'][$i])){
> if ($this->User->save($this->data['User'][$i])){
> }
>  } else {
> $this->User->invalidate($this->data['User'][$i]
> ['email']);
> $this->render();
>  }
>
> The data validation part would not work when user input an invalid
> email or empty firstname, the error message will appear for all
> inputed person even if only one person's email address is wrong.
>
> if I change error message part like following:
>   tagErrorMsg('User/emial][', 'A valid email
> is required.') ?>
> or
>   tagErrorMsg('User][/email', 'A valid email
> is required.') ?>
>
> then the error message will not show up.
>
> Does any body have any idea how to do cakephp's way of automatic
> database save and data validation with several objects of same type/
> model (User) in a single form?
>
> Thanks!
>
> Gavin


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



Re: Newbie Introduction Book ... reviews anyone?

2007-07-29 Thread madmike210

I would live to take a look at your book, send to
[EMAIL PROTECTED]

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: How do you usually create admin area on site with CakePHP?

2007-07-29 Thread keymaster

Suggestion - for a simple approach, you might try the following: use
admin routing, and in your appController check for "admin_" prefix in
the action part of the url. If it is there, do the auth checks.

Your controllers don't need to be involved in auth checking for admin
if you follow this approach.

If you want more complex authorization you might need something more
involved. But for most simple admin sections, this is pretty
functional.

On Jul 29, 6:24 am, Pento <[EMAIL PROTECTED]> wrote:
> Thanks, but I think that it's very poor  admin interface and all my
> contollers will be mixed with checks of privileges.
> And in point of fact Admin Interface is simply different application
> but with same models
>
> On 23 июл, 18:27, cauld <[EMAIL PROTECTED]> wrote:
>
> > Have a look at the advanced routing configuration in section 4 in the
> > manual (http://manual.cakephp.org/chapter/configuration).  This should
> > give you what you need.
>
> > On Jul 22, 10:49 pm, Pento <[EMAIL PROTECTED]> wrote:
>
> > > So, there are usual site andadminarea for add some news, materials
> > > and so on.
> > > It's good idea to make thisadminarea on subdomain (for example,
> > >admin.somesite.org)?
> > > As I think it's only one way for it.


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