Re: ACL bug when Auth::authorize = 'actions'? 1.2.4.8284

2009-09-04 Thread housebolt

Well I figured it out, it definitely was me.

Apparently you can't just set a root ACO and let that be, you do
actually have to create all of the ACO's INCLUDING their children. For
some reason from the tutorial I was under the impression that this
wasn't needed, that you could just set a root ACO 'controllers' and
then assign a group to it and it would work.

Anyways, I used the tool they provide to automatically create the
Aco's based on controller actions and everything worked fine.

Garret

On Aug 26, 3:43 pm, delocalizer  wrote:
> Hi hb,
> I don't know if this will reassure you or frustrate you - but it's not
> a bug in db_acl.Aclwith Auth->authorize = 'actions' works nicely for
> me for a long time, including in 1.2.4.8284. May I ask, in your
> AppController::beforeFilter, to what you have set the Auth-
>
> >actionPath?
>
> regards,
> C.
>
> On Aug 26, 8:03 pm, housebolt  wrote:
>
> > Hi All,
>
> > Currently using version 1.2.4.8284
>
> > I spent a good half-day trying to get the Auth andAclcomponents to
> > play nicely with the Auth::authorize var equal to 'actions' and a
> > single root ACO node of 'controllers', accessible by the ARO that is
> > connected to a Group model, which has many users (see theACLtutorial
> > in the cakephp cookbook).
>
> > I checked and quadruple checked my aros/acos/aros_acos tables to make
> > sure everything was properly connected with a very basic setup, but I
> > was still get an error saying theACLnode could not be found, so I
> > set about 20 break points and systematically narrowed it down to a
> > section in the AclNode class.
>
> > I think I've narrowed it down to a problem with the way the
> > AclNode::node() method handles the controller action info that is
> > passed to it from the Auth component. There's a section in /cake/libs/
> > model/db_acl.php lines 127-133
>
> > // $result is the ACO that the AclNode has attempted to find, it
> > returns an array with all of the current ACO row
> > // info
>
> > if (!isset($result[0][$type]) ||
> >     // Here is where the problem is, the $path is an array of the
> > current controller and action
> >     // This next line tries to compare the ACO 'alias' field to the
> > current controller action in $path, but if the
> >     // ACO is at root, like 'controllers' in the cookbook tutorial,
> > the ACO alias is equal to 'controllers', and not a
> >     // controller action, say, 'index'. However the following line is
> > looking for a controller action and fails the node
> >     // check
> >     (!empty($path) && $result[0][$type]['alias'] != $path[count($path)
> > - 1]) ||
> >     (empty($path) && $result[0][$type]['alias'] != $start)
> > ) {
> >   return false;
>
> > }
>
> > I'd be interested to see if anyone else has run into this problem. I
> > basically commented out the bad line (line 129) and then it worked.
>
> > Yes, I'm being lazy right now because I got a little frustrated trying
> > to figure thing out and now I want to sleep, the real fix will come
> > once I get some rest. I just wanted to make sure I'm not crazy, if
> > anyone else wants to verify it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Automatically rendering element using RequestHandler - possible?

2009-09-04 Thread housebolt

One way to do it is in your AppController::beforeFilter() set a view
var like $this->set('isAjax', $this->RequestHandler->isAjax()); Then
in your layout file (or view file) add if(!$isAjax) { echo  }

GB

On Sep 4, 4:48 am, eagerterrier  wrote:
> Hi
>
> I have a problem that I just can't get my head around, and wonder if
> anyone can help.
>
> In my app, I have a series of normal pages that have google analytics
> in footer. I then have hundreds of ajax calls that are either rendered
> views, or simply echoed PHP statements in controllers.
>
> What I want is an easy (lazy?) way of adding google analytics to all
> of these myriad scripts in one go.
>
> I thought putting something in the app_controller like this would
> work,
>
> [code]
> if($this->layout=='ajax'||$this->RequestHandler->isAjax()){
>   Configure::write('debug',0);
>   $this->render('/elements/google_analytics');}
>
> [/code]
>
> However, this is obviously bad and doesn't work.
>
> I could just either echo the include file path contents using regular
> PHP, but it doesn't feel very Cakey.
>
> Is there an elegant way to do this?
>
> Many thanks
>
> TC
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



ACL bug when Auth::authorize = 'actions'? 1.2.4.8284

2009-08-26 Thread housebolt

Hi All,

Currently using version 1.2.4.8284

I spent a good half-day trying to get the Auth and Acl components to
play nicely with the Auth::authorize var equal to 'actions' and a
single root ACO node of 'controllers', accessible by the ARO that is
connected to a Group model, which has many users (see the ACL tutorial
in the cakephp cookbook).

I checked and quadruple checked my aros/acos/aros_acos tables to make
sure everything was properly connected with a very basic setup, but I
was still get an error saying the ACL node could not be found, so I
set about 20 break points and systematically narrowed it down to a
section in the AclNode class.

I think I've narrowed it down to a problem with the way the
AclNode::node() method handles the controller action info that is
passed to it from the Auth component. There's a section in /cake/libs/
model/db_acl.php lines 127-133

// $result is the ACO that the AclNode has attempted to find, it
returns an array with all of the current ACO row
// info

if (!isset($result[0][$type]) ||
// Here is where the problem is, the $path is an array of the
current controller and action
// This next line tries to compare the ACO 'alias' field to the
current controller action in $path, but if the
// ACO is at root, like 'controllers' in the cookbook tutorial,
the ACO alias is equal to 'controllers', and not a
// controller action, say, 'index'. However the following line is
looking for a controller action and fails the node
// check
(!empty($path) && $result[0][$type]['alias'] != $path[count($path)
- 1]) ||
(empty($path) && $result[0][$type]['alias'] != $start)
) {
  return false;
}

I'd be interested to see if anyone else has run into this problem. I
basically commented out the bad line (line 129) and then it worked.

Yes, I'm being lazy right now because I got a little frustrated trying
to figure thing out and now I want to sleep, the real fix will come
once I get some rest. I just wanted to make sure I'm not crazy, if
anyone else wants to verify it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: how to view the image on page from database

2009-02-04 Thread housebolt

echo $html->image($this->data['Model']['image_url'], array
('alt'=>'description'));

Make sure you have pulled the image url into a view var first (like
$this->data or by using $this->set() in your controller), and also
make sure the htmlhelper is activated in your controller under the
$helpers array.

On Feb 4, 7:49 am, Maulik  wrote:
> hello guys !!
> i have a problem for viewing the image from the url link saved in
> database ? how to do that ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Select MAX(date)

2009-02-03 Thread housebolt

Methinks you're thinking a little too hard on this one. I'm pretty
sure you don't even need to use MAX().

$this->Model->find('first', array('order'=>'Model.date DESC'));

Try that, I think that's what you're looking for. If not explain a bit
more and I'll see if I can help.


On Feb 3, 3:53 pm, gkc  wrote:
> How would I structure a query to return the newest entry based on a
> date?
>
> If I was writing out the query I would just use MAX(date) but Im not
> sure how would format the $this->Model->find().
>
> Any help would be greatly appreciated.
>
> gkc
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: book on cake?

2007-11-03 Thread housebolt

There isn't one that I'm aware of. There was one in the process of
being published but it fell apart at the last minute.

Most people have trouble initially getting the hang of MVC. You really
need to focus on the MVC structure. Read over the "Basic Concepts"
section of the manual very carefully. Once you grasp the MVC structure
everything will fall into place. Your life will make sense again.

Controller -> Back end, where you do all of the grunge work.
Model -> Sends data from your database to your controller.
View - Where the HTML goes.

Also, once you've grasped the concept, watch the video tutorial and
follow along with it to a T. It doesn't necessarily have to make
sense. 95% of learning comes from participation.

On Nov 3, 11:16 am, Daniel <[EMAIL PROTECTED]> wrote:
> I am new to cake and I find the tutorials somewhat confusing, is there
> a book I can get to better understand cake ?


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



Re: Rails Envy

2007-08-26 Thread housebolt

LOL

On Aug 25, 8:45 am, RichardAtHome <[EMAIL PROTECTED]> wrote:
> http://www.youtube.com/watch?v=GQXqWkWqnSw
>
> I lol'ed :-D


--~--~-~--~~~---~--~~
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 some help in understanding error messages

2007-08-23 Thread housebolt

The easiest way to do this is by using $this->Session-
>setFlash('Username already exists'); in your controller. The error
message will show up at the top of the page or wherever you put "if
($session->check('Message.flash')) $session->flash();" in your layout.

On Aug 23, 7:33 am, rtanz <[EMAIL PROTECTED]> wrote:
> hi right now i have baked a model with an add and edit view as
> automatically generated by cake. So now if I make any errors when
> saving (as determined by the $validate conditions below) I will get
> the values of the tagErrorMsg as set in the view. Now I also made a
> beforeSave function that checks whether a user with that username
> exists already, and in that case I would like to output a different
> message saying that 'Username already exists' instead of 'Please enter
> the Username'. How can i do this? thanks
>
> class User extends AppModel
> {
> var $name = 'User';
> var $hasMany = array('Membership'=>array('dependent'=>true));
>
> var $validate = array(
>   'username' => '/[a-z0-9\_\-]{3,}$/i',
>   'password' => VALID_NOT_EMPTY,
>   'email' => VALID_EMAIL,
>);
>
> function beforeSave() {
> $user = $this->data['User']['username'];
> $conditions = array("User.username"=>"$user");
> if ($this->find($conditions)) {
> return false;
> }
> else return true;
> }
>
> }
>
> tagErrorMsg('User/username', 'Please enter the
> Username.');?>


--~--~-~--~~~---~--~~
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 doesn't die ... it just freezes!!

2007-08-23 Thread housebolt

Can you post your controller method and view to see what we've got
here? This is very intriguing to me.

On Aug 23, 10:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Thanks for you answer!!
>
> I've already set "Content-Disposition: attachment; filename=\"$filename
> \"", and also an option for the IE problem with multiple dots.
>
> My first cake so at this stage I'm not using the Security component.
> CAKE_SECURITY set to 'high', also tested with 'medium' without
> success. I'm not sure of fully understanding your suggestion about
> Security and Session handling.
>
> The session don't die as long as the download time is smaller than the
> session lifetime  it simply freezes. After the download starts the
> user can request anything he wants. But the browser will not receive
> any data until the donwload is finished. Click for download, download
> starts, click on _put_any_number_here_ links from the page and finally
> when download finishes the last action requested is processed.
>
> If you are downloading small files or working from intranet the user
> perhaps doesn't notice the behaviour, but downloading a 50MB file from
> the internet at 15KB/s you can imagine the result. For testing I
> download smaller than 1MB files at 10KB/s so the file size is not
> causing the problem.
>
> Only the current session gets frozen. I've run tests with 3 or more
> concurrent sessions (downloading diferent files with diferent file
> sizes as 700kb or 170MB) and all of them freeze when the download
> starts and get back to life when it finishes.
>
> I assume that when my controller action calls the model download
> method it doesn't give up until the method "return's". And the method
> does not "return" until the chunked "fread" ends due to "feof"
> condition. So what I need is something like "fire and forget" the
> method from the action, so the user can go on with other actions.
>
> Thanks again,
> Juan
>
> On 23 ago, 17:23, nate <[EMAIL PROTECTED]> wrote:
>
> > Set the content-disposition header so the download gets forked out to
> > a separate request, and use Ajax on the main application page to keep
> > the session alive.  Are you using the Security component?  What are
> > your session security settings?
>
> > On Aug 23, 10:36 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > In my project the users will usually download files with sizes up to
> > > 150MB at limited speeds depending on the remote location (intranet/
> > > internet), so the download process can take hours. I've created a
> > > download function in a model which is requested by a function in a
> > > controller.
>
> > > The problem is that once the download begins, the application gets
> > > frozen and the user can't do any other action within this session
> > > until the download is finished. The desired behaviour would be that,
> > > while enough bandwith is available, the user can download several
> > > files simultaneously.
>
> > > I've searched the group and done some google work without success.
> > > Perhaps the solution is not so complicated but I don't know how to fix
> > > this behaviour.
>
> > > Any idea on how to solve this problem? Can you point me to a resource
> > > related to this issue?
>
> > > Thanks,
> > > Juan
>
> > > CakePHP/1.1.16 on Apache/2.0.52


--~--~-~--~~~---~--~~
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: HtmlHelper and html entities

2007-08-19 Thread housebolt



All fixed! : )

On Aug 19, 4:02 am, nitifixis <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm using the htmlhelper in my cake 1.1 app and I'm having problems
> with strings with html entities. Example:
>
> $html->submit('télécharger');
>
> cake is replacing all & symbols with & entities. How am I supposed
> to write a string with foreign characters? Any ideas?
>
> Thanks in advance


--~--~-~--~~~---~--~~
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: Model not found?

2007-08-19 Thread housebolt

The name of your model doesn't correspond with your controller.

Your controller name should be talent_detail_controller if you want to
keep it that way, but I'm guessing you want it to show up in your
browser as /talent/.

So, in order to fix this you'll want to add $uses =
array('TalentDetail'); to the top of your controller.

Your controller would look like this:



$uses will then load talentdetail as a variable you can use in your
controller.

Hope this helps :)
housebolt

On Aug 19, 2:22 pm, peterhf <[EMAIL PROTECTED]> wrote:
> A table in the db: talent_details
>
> The model:
>
> class TalentDetail extends AppModel
> {
>   var $name = 'TalentDetail';
>   var $primaryKey = 'recordID';
>
> }
>
> In the controller talent_controller:
>
> $this->TalentDetail->id = 10;
> $result = $this->TalentDetail->exits();
>
> Result:
>
> Fatal error: Call to undefined function: exists() in /home/myact1/
> public_html/cake/app/controllers/talent_controller.php on line 260
>
> I had previously tried:
>
> $conditions = array('userID' => 10);
> $result = $this->TalentDetail->find($conditions, 'recordID', null,
> null);
>
> Result:
>
> Fatal error: Call to undefined function in /home/myact1/public_html/
> cake/app/controllers/talent_controller.php on line 258
>
> It would appear that my model is not being recognized.
>
> Thoughts?
>
> Peter -


--~--~-~--~~~---~--~~
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 $ajax->link. Can I Slide instead of Hide?

2007-08-08 Thread housebolt

link('Ajax', '/contact/',
array('update'=>'changediv', 'indicator'=>'loaddiv',
'loading'=>"showById('loading'); hideById('changediv');",
'complete'=>"slidedown

I believe that's how you do it. I can't remember if you need to add
the "function() { " to it, but I don't have enough time to test it
out. Go take a look at the ajax helper in the manual, especially at
the $options keys section.

http://manual.cakephp.org/chapter/helpers


On Aug 8, 6:47 pm, Baz <[EMAIL PROTECTED]> wrote:
> I have a few questions involving ajax.
>
> This is what I have so far:
> link('Ajax', '/contact/', array('update' => 'changediv',
> 'indicator' => 'loaddiv')); ?>
>
> My problem is that it uses Element.show. I've seen a slide used on a CakePHP
> site before. The output was something like this:
>
> new Ajax.Updater('changediv','/contact/', {asynchronous:true,
> evalScripts:true, onLoading:function(request) { showById('loading');
> hideById('changediv');}, onComplete:function(request)
> {slideDown('changediv'); hideById('loading');}, requestHeaders:['X-Update',
> 'changediv']}) }, false);
>
> So my question is. How did they implement the "slideDown/showById, hideById,
> etc.? At first I thought maybe it was done manually, but after closer
> scrutiny I realized it was Cake.
>
> Any ideas?
> ThanX in advance.
> --
> Baz L
> Day In The Life of Bazhttp://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: CakePhp development usability

2007-08-07 Thread housebolt

Langdon's right. Bake.php is the end all be all of cake model/view/
controller generation.

Also, take a look at this article:
http://www.littlehart.net/atthekeyboard/2007/07/11/why-code-generation-just-works-damnit/

On Aug 7, 12:21 am, modfather <[EMAIL PROTECTED]> wrote:
> Hello ladies and gents,
> I'll start of by admitting this might not be specifically a "cake"
> question but it does pose some questions about the usability of cake
> (from my perspective).
>
> I am in the process of updating/re-designing a site. One part of this
> site contains what is called "msds" sheets. The site includes
> approximately 50 of these sheets.An example of this sheet is 
> athttp://apexlabs.com.au/veterinary/MSDS/18/Apex+Carprofen+Tablets
>
> The data contained in the msds sheets is from a mysql database. These
> MSDS includes data from over 60 tables.
>
> As far as i can tell i will have to produce at least 60 model pages
> ( to correspond with associated models) and my msds model will contain
> an array  will contain a massive "$belongsTo" array - which will also
> be affected by mysql 4.1 join limitations, lack of views etc.
>
> class Msds extends AppModel {
>
> var $name = 'Msds';
> var $useTable = 'Msds';
> var $belongsTo = array(
> 'Category' =>array(
> 'className' => 'Category'
>  ),
> 'RecommendedUse' => array(
> 'className' => 'RecommendedUse',
> 'foreignKey' => 'recommended_use_id'  
> ),
> 'Classification' =>array(
> 'className' => 'Classification',
> 'foreignKey' => 'classification_id'
>  )
>
> I feel this is a fairly  tedious process , so the question is - is
> there another way to build this or am i being lazy?


--~--~-~--~~~---~--~~
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: Model->find with large datasets

2007-08-07 Thread housebolt

I'd be interested to see the difference in performance between cake's
find() and a straight up php mysql call.

I personally don't think cake will have much of a problem handling
this. I would try both and see how long it takes to execute (and the
memory usage) for a simple SELECT statement. You can use mysql_query
in your controller. Just make sure your model's $recursive is set to
-1 if you have any other associations when you call find(). Heck, I
might do the same thing just to test it.

On Aug 6, 10:16 pm, jheathco <[EMAIL PROTECTED]> wrote:
> The problem is I need to retrieve them all at once because I'm
> processing the returned rows in a cronjob.  The pagination would be of
> no use for this feature.  Should I just run a manual query instead of
> using the models in this case?
>
> On Aug 6, 9:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > set the limit in the $model->find(); to an acceptable performance
> > level - you can set this dynamically - or look into the pagination
> > component
>
> > On Aug 6, 6:41 pm, jheathco <[EMAIL PROTECTED]> wrote:
>
> > > In PHP, typically prior to cake I had done
>
> > > $res = mysql_query();
> > > while($row = mysql_fetch_array($res))
> > > {
> > > 
>
> > > }
>
> > > And now in cake, $results = Model->find([query here]) and then loop
> > > thru the results.
>
> > > I am wondering about the limitations if, for instance, a few thousand
> > > rows are returned.  In PHP, it seems looping thru each, one at a time,
> > > by calling mysql_fetch_array() was very efficient.  However, it seems
> > > like cake may have large performance (and memory) issues by trying to
> > > dump all results into an array before looping thru.
>
> > > Am I correct in this thinking?  Is there a way to have cake only
> > > return the results one at a time, rather than buffering them all into
> > > a large array?


--~--~-~--~~~---~--~~
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 implementing user - session login system

2007-08-05 Thread housebolt

type  in your view and look for something called
Config.rand. This sets a unique random identifier in the form of a
number, which you can use as a reference in your database. You can
access it by typing Session->read('Config.rand'); ?
> in your controller.

On Aug 5, 5:19 pm, phpcurious <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am also planning to enable HTTPS in the login form in the future...
> just for security sake... but, making the user session login system
> must work for now...
> thanks all for the advice, guyz!
>
> On Aug 6, 1:07 am, Vaz <[EMAIL PROTECTED]> wrote:
>
> > The way I did it was to save an indicator in the (web tier) Session
> > object. Most common I have seen is to save the id for that user. Aka:
> > if successful login
> >$this->Session->write('uid', $userid)
> > where userid is the id for the user.
>
> > The controller should be designed such that if there is a valid
> > Session object [$this->Session->valid() ] but there is no uid in the
> > Session object, then user is not logged in and forward the user to the
> > login function.
>
> > On logout, make sure to destroy session [ $this->Session->destroy() ]
> > or remove the uid if the user is still allowed to access other areas
> > of the site without being authenticated.
>
> > The parameters that defines how long a session is considered to be
> > active is different to the CAKE_SESSION_SAVE.
>
> > On Aug 5, 4:40 am, phpcurious <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > I am getting frustrated with the session component in cakephp
> > > 1.1.xxx .
> > > I already configured core.php to define('CAKE_SESSION_SAVE',
> > > 'database');
>
> > > but how do i retrieve current session to check if current session is
> > > still active ?
> > > by using $this->cake_session->findAll($id) ? how do i get the $id?
>
> > > if you have alternatives that you can tell me, I would be very glad to
> > > know.
> > > please help...
>
> > > thanks in advance!
> > > ;p


--~--~-~--~~~---~--~~
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 it reasonably easy to do this sort of inline editing with CakePHP

2007-08-05 Thread housebolt

Check out this tutorial:

http://cakephp.org/screencasts/view/3

On Aug 5, 3:52 pm, walterbyrd <[EMAIL PROTECTED]> wrote:
> I'm still framework shopping. One thing I like about Qcodo is this
> inline editing feature:
>
> http://examples.qcodo.com/examples/dynamic/inline_editing.php
>
> Is that sort of thing easy to do with CakePHP?


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

2007-08-05 Thread housebolt

I'm with kabturek on this one. I'd stick with the initial download
setup until you learn the ins and outs of cake and its structure. It's
simple, just drop the whole download into a folder accessible by your
browser, make sure mod_rewrite is on, set up your database.php file
in /app/config/ and you're ready to go!

If you don't have a development server on your computer a great one
with EASY setup set up is xampp. Xampp and xampp lite have everything
you need to get started with cake. http://www.apachefriends.org/en/xampp.html

On Aug 4, 1:24 am, kabturek <[EMAIL PROTECTED]> wrote:
> >From what you've written you seem to want to develop an app - woudn't
>
> it be wiser to use the *developement* setup ? ;) probably on your home
> machine ? You want a production setup for dev ...  imo you should
> stick with the basic setup for now - and when you actually learn cake
> - there is no problem in putting everything in its place.
>
> greets,
>
> On Aug 3, 10:14 pm, takabanana <[EMAIL PROTECTED]> wrote:
>
> > I'm new to CakePHP - ready to learn it - so I'm trying to set it up on
> > a shared hosting account.
>
> > currently, when I log into my account via FTP, i get into one level
> > above the public_html (webroot).
>
> > I'd like to put the CakePHP libraries/framework there... and all of
> > the site's stuff (i.e. "apps/views") be within public_html, which is
> > one level below where I want the CakePHP's core/libraries.
>
> > so how do I set up index.php?
>
> > Thanks for any help.


--~--~-~--~~~---~--~~
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: Levelling Order

2007-08-05 Thread housebolt

I believe you can do it this way:

for level 1:
$this->Category->findAllByParentId(0, null, 'Category.id ASC');  //
Third argument for findallby

in your model, in the 'Childnode' array, add 'order'=>'Childnode.name
ASC' (or DESC depending on what you want) to the array.

var $hasMany = array(
'Childnode' =>
array(
'className' => 'Category',
'foreignKey' => 'parentid',
'order' => 'Childnode.name ASC'
),

I recommend the CakePHP cheat sheet from the CakePHP front page.


On Aug 4, 7:18 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a cake model which has a self join as follows..
>
> ==
> class Category extends AppModel {
> var $name = 'Category';
>
> var $hasMany = array(
> 'Childnode' =>
> array(
> 'className' => 'Category',
> 'foreignKey' => 'parentid'
> ),
> );
> ==
>
> Then I query the model which return parent-child data using code below
> ==
> $this->Category->recursive = 1;
> $category_data = $this->Category->findAllByParentid('0');
> ==
>
> My question is, how can I set different order for every level, i.e.
> `id` order for level 1 and `name` for level 1 (joined data) ?
>
> Thanks !
>
> Feris


--~--~-~--~~~---~--~~
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: find empty text field & addslashes

2007-08-05 Thread housebolt

You probably have magic_quotes and magic_quotes_gpc set to "ON" in
your PHP.ini file.

Google "magic_quotes" and "magic_quotes_gpc".

On Aug 5, 2:56 am, jyrgen <[EMAIL PROTECTED]> wrote:
> hello,
>
> i'm having problem with slashes being added by cake when
> trying to find empty text columns in the DB
>
> this works fine: (in phpmyadmin)
>
> select * from articles where remark != ''
>
> it give all articles with "remark" not empty.
>
> but this
>
> $conditions['Article']['Article.remark'] = "!=''";
>
> is converted into
>
> select * from articles where fotohinweis != '\"\"'
>
> which gives *all* articles, because it searches for \"\"
>
> any ideas ?
>
> thanks, 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
-~--~~~~--~~--~--~---



Re: setting pear for cakephp

2007-08-03 Thread housebolt

Download PEAR.php from the pear site and put it in your vendors
folder. That should do the trick.

On Aug 2, 9:24 am, rtanz <[EMAIL PROTECTED]> wrote:
> im trying to use pear with cakephp, i installed it using the uniserver
> installer so now pear is located at W:\home\admin\www\plugins\pear/
> PEAR. my cakephp code on the other hand is failing to find it, so how
> can i set cake to included that pear file? thanks
>
> Warning: require_once(PEAR.php) [function.require-once]: failed to
> open stream: No such file or directory in W:\www\cake\app\vendors
> \Upload.php on line 42
>
> Fatal error: require_once() [function.require]: Failed opening
> required 'PEAR.php' (include_path='W:\www\cake;W:\www\cake\app\;.;/
> usr/
> local/PHP/includes;/usr/local/PHP/pear') in W:\www\cake\app\vendors
> \Upload.php on line 42


--~--~-~--~~~---~--~~
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: progress report matrix

2007-08-02 Thread housebolt

That's way too much to try to explain in a google group post. If you
don't know how to implement this you probably need to do some reading.

http://safari.oreilly.com/browse?category=itbooks.prog.php
http://www.w3schools.com/
http://manual.cakephp.org


On Aug 1, 4:26 pm, rtanz <[EMAIL PROTECTED]> wrote:
> hi i would like to have a report page that shows which tasks have been
> completed or not. in my system the aim is to fill in reviews so i
> would like to read each record in the reviews table and build a sort
> of matrix to show if each field of the record has been filled in or
> not:
>
>  Task 1Task 2Task 3
> Review 1Done  Pending  Done
> Review 2Pending  Pending  Pending
>
> how should i go about doing 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: About Associations : example

2007-08-02 Thread housebolt

http://manual.cakephp.org/chapter/models

On Aug 1, 4:40 am, Ghanshyam Rathod <[EMAIL PROTECTED]> wrote:
> Hello friends,
>
>  I am newbie to the cakePHP frameworks and want to learn association
> in good way.
> kindly send me SQL script with  model, controller and view code.
>
> i mean running example.
>
> 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: uploading files

2007-08-02 Thread housebolt

PEAR has one of the easiest uploaders to use:

http://pear.php.net/package/HTTP_Upload

drop the file into your vendors folder, and then follow this:

In your view:
-
form('/wherever/', 'POST',
array('enctype'=>'multipart/form-data')); ?>



In your controller:
-
vendors('HTTP_Upload');

$upload = new HTTP_Upload("en");
$file = $upload->getFiles("userfile");

if ($file->isValid()) {
$moved = $file->moveTo("uploads/");
if (!PEAR::isError($moved)) {
$this->flash("File was moved to uploads/", '/wherever/');
exit;
}
}

also google "Pear HTTP_Upload" for a bunch of different tutorials.

rtanz wrote:
> hi i need a simple file upload function, basically the users would be
> filling in a form and have to upload two files in the form. I dont
> need anything fancy just the facility to specify the location of the
> file and then the files get uploaded on submitting the form. When they
> view the form they should see a link to the uploaded file.
>
> is there some built in cake facility to do this or should i be looking
> at other solutions? 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: A quick note about BakeSale

2007-08-01 Thread housebolt

> I've committed code to bakesale and use it myself

Glad to hear from you. I'll post some of the stuff over at BakeSaleHq
as soon as I get some time this week. It's a great platform, and I
think it could go further than osCommerce (and be 10 times more easy
to use and customize). I personally think all shopping carts should
use some sort of framework, and BakeSale is the first of its kind for
Cake.

On Aug 1, 1:25 am, drayen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've committed code to bakesale and use it myself, i would be
> interested to hear what you've found. I can also confirm you never
> contacted the bakesale team. Onto your image :
>
> The system doesn't look like its released any useful data?
>
> The output your showing is on the demo site, which is deliberately
> unsecured to allow people to test the admin interface. Were you able
> to re-create your results on your own server?
>
> If you want to help, by all means apply to be a part of the bakesale
> cakeforge group and commit updated and more secure code, i am sure we
> would welcome the help. We are soon going to move to 1.2 and will be
> using the security class you talked about in a post you made 34 hours
> ago, which should close a few holes.
>
> Or if not how about submit the holes you've found, ideally with
> solution code via our bug tracker on google code 
> :http://code.google.com/p/bakesale/issues/list
>
> 
>
> > I'm not trying to make trouble here
>
> Your also not being constructive, don't just troll without even
> talking to the people who can change things for the better, or fully
> understanding what your criticizing.
>
> > So, if you're
> > thinking about using BakeSale, make sure that you take a good look at
> > the code before you use it, especially if you're going to be saving
> > credit card numbers in your database.
>
> Bakesale does NOT store CC information, it uses external payment
> gateways e.g. paypal.
> 
>
> Drayen.
>
> On Aug 1, 3:38 am, housebolt <[EMAIL PROTECTED]> wrote:
>
> > There's nothing to disclose. I haven't given out anything, and it's
> > blatantly apparent. There is not one single security measure in place
> > within the code, so I would have to disclose the entire code base.
>
> > I'm not trying to make trouble here, I'm just warning people about the
> > danger of using BakeSale "straight out of the box".
>
> > I would be fine if they were marketing it as a basic starting point
> > for building a shopping cart, but they're making it out to be a
> > complete product.
>
> > On Jul 31, 7:30 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
>
> > > On 8/1/07, housebolt <[EMAIL PROTECTED]> wrote:
>
> > > > I was just taking a look at bakesale for some ideas on building my own
> > > > shopping cart.
>
> > > > Please don't use bakesale in its current form without looking into its
> > > > security issues.
>
> > > Did you contact the deveopers of Bakesale about this before disclosing 
> > > here?
>
> > > If yes what was the response?
>
> > > 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: A quick note about BakeSale

2007-07-31 Thread housebolt

There's nothing to disclose. I haven't given out anything, and it's
blatantly apparent. There is not one single security measure in place
within the code, so I would have to disclose the entire code base.

I'm not trying to make trouble here, I'm just warning people about the
danger of using BakeSale "straight out of the box".

I would be fine if they were marketing it as a basic starting point
for building a shopping cart, but they're making it out to be a
complete product.


On Jul 31, 7:30 pm, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 8/1/07, housebolt <[EMAIL PROTECTED]> wrote:
>
>
>
> > I was just taking a look at bakesale for some ideas on building my own
> > shopping cart.
>
> > Please don't use bakesale in its current form without looking into its
> > security issues.
>
> Did you contact the deveopers of Bakesale about this before disclosing here?
>
> If yes what was the response?
>
> 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: your own class files location?

2007-07-31 Thread housebolt

Usually yes, although if you want to use third party classes you can
put them into the vendors folder. You'll have to change a few things
in your code in order to use your library or class as a component, but
in most cases it's not much of a change.


On Jul 31, 6:25 pm, Aaron Thies <[EMAIL PROTECTED]> wrote:
> Where should your own class files reside in cake?  Is this what
> components are for?
>
> Aaron Thies
> Funky Dope aPhone


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



A quick note about BakeSale

2007-07-31 Thread housebolt

I was just taking a look at bakesale for some ideas on building my own
shopping cart.

Please don't use bakesale in its current form without looking into its
security issues. This has nothing to do with Cake, and everything to
do with the fact that BakeSale currently has NO security measures
whatsoever. I know it's not version 1.0 yet, but I was easily able to
add my own vars into the demo online, and if I wanted to I could
probably hack it in no time (and I'm not even a hacker). So, if you're
thinking about using BakeSale, make sure that you take a good look at
the code before you use it, especially if you're going to be saving
credit card numbers in your database.

I was able to get this out of it at bakesalehq.com with my first try:
http://www.housebolt.com/bakesale-insecure.gif

Again, this has nothing to do with Cake security, because Cake is
probably the most secure framework for PHP there is. It really is a
matter of how well you're protecting your code. Remember, filter
input, escape output!


--~--~-~--~~~---~--~~
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-31 Thread housebolt

Are you guys caching anything. That will do tons for you. Also, I'd
look into using InnoDB for your database if you're using MySQL. If I'm
getting what you're telling me right, it looks like there are some
configurations you need to tweak in your server config. If MySQL is
what's crashing your server, I wouldn't worry too much about the PHP
code, and look more into which queries are taking the longest.

Take a look at your slow query log, and turn it on if it's not already
on:
http://www.databasejournal.com/features/mysql/article.php/2013631

This is a great article on optimizing php:
http://phplens.com/lens/php-book/optimizing-debugging-php.php

There's something called 'Apache Bench', which I've actually never
used, but the guy who wrote the article above did. Maybe that can help
you test your server.

Nice site by the way ; )

On Jul 31, 10:55 am, PiLLo <[EMAIL PROTECTED]> wrote:
> Hi housebolt, I would like to know a tool capable of simulate a heavy
> load on the server in order to identify which part of the code is
> producing a bottle neck.
>
> On development environment everything seems ok,  but on production
> environment I set 0 the debugger flag , but I am missing something
> because on a demand of 600 concurrent users, MySQL puts the processor
> at the top and it all falls down.
>
> So the team decides to comment some queries in order to reduce the
> load, the hardware arquitecture is formed by:
> - one server on the front
> - a second server to attendant the database
>
> There isn't a loadbalancer and the site is here:http://www.hola-tu.com
>
> On Jul 30, 5:09 pm, gwoo <[EMAIL PROTECTED]> wrote:
>
> > There are two reasons to avoid $uses and loadModel in your code.
>
> > 1. performance:
> > Extra memory will be consummed if you have var $uses and the
> > association in your model.
> > loadModel simply checks if the class exists and includes it if it does
> > not, so the overhead here is minimal. But then you need to create the
> > instance so memory is increased. If you go this route, use the
> > ClassRegistry. By using the registry when you need to gain access to
> > an object you can be assured that you are not adding any extra
> > overhead.
>
> > 2. maintainability
> > everyone knows we are concerned with maintainable code. We provide var
> > $uses for the exceptions to the rule (ie: contact form, search, etc)
> > These are cases where there is generally no model for that controller
> > and so there is a need to override the default behavior. On the other
> > hand, loadModel can create spaghetti plain and simple. Using loadModel
> > can be likened to using sql in your templates, albeit a little more
> > elegantly.
>
> > But this is really off topic, because I doubt the site is running slow
> > because of the model loading. It is most likely an issue with server
> > load and/or max clients on apache.


--~--~-~--~~~---~--~~
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: Number displayed under flash messages

2007-07-31 Thread housebolt

Hmm, could you post some of the source code of the flash message that
gets rendered on your page in html?

I went back to look at this and I don't see it. It's probably a css
thing. That 1 may be a 1 pixel X 1 pixel line that's supposed to be a
css underline. Try getting rid of or changing #flashMessage in your
CSS and that should do the trick.

On Jul 31, 12:24 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> First, I apologize if this has been addressed many times before. My
> problem is quite simple. Whenever I use $this->Session->setFlash('Message') 
> to display a message, there is always a small
>
> number '1' underneath the flash message. Further, I've seen this
> displayed in other Cake apps, including Bakesale. Can anyone tell me
> why this happens, and how I can get rid of it? 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 project design

2007-07-31 Thread housebolt

I can't get too specific since I don't know all of the details
involved, but here's what I do know,

You'll want to create models for ALL of your tables. The reason behind
this is the nature of ActiveRecord, which is the main structure for
data abstraction in Cake. You use activerecord in cake to make your
table elements into PHP objects that you can easily manipulate. That's
part of what makes cake is so great (and why Ruby on Rails became so
popular).

However, I know that you're probably dealing with a lot of data,
seeing as your dealing with scientific species data. This is where
you're getting more into database design and less CakePHP. I
personally think it would be easier for you to make a table with all
of the kingdoms and then recursively link all of the data by $hasMany
and $belongsTo in each model you create (e.g. order.php, genus.php).

I also know that you don't have to create controllers for everything.
Use of $this->render(), $this->renderElement(), and $this-
>requestAction() can do a ton to make your code reusable.

I know I'm probably not much help, but I believe Cake can get the job
done for you and come out with flying colors.

On Jul 30, 10:30 am, nagarjuna <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am designing a database to hold scientific observations of animals
> in the field. The database will be used for several different
> projects.  The basic unit for all projects is the observation, and
> observations across projects will store the same basic information
> (and use the same logic), but projects may also need to store some
> additional information.  My plan is to have one main observations
> table/model/controller, and then additional project specific tables.
> Each project then hasMany observations and each observation belongsTo
> one project, and in the observation view I will then find the
> appropriate project specific table and adjust my forms/displays
> appropriately.
>
> Any thoughts or critiques of this approach?
>
> Secondly, I need to store a hierarchical species taxonomy (kingdom,
> order, genus, etc) in the database and allow users to update it
> (species classifications are changed frequently).  The logic and view
> for each level is nearly identical, and I would like to avoid creating
> separate models and controllers for each. The best approach for me
> would be to dynamically change the table used by a model.  My search
> suggests that this is not possible, but does anyone know for sure?  I
> could also create a new class and inherit from it, but this would
> still involve creating a separate model and controller file for each
> level, which is less than ideal.  Any suggestions?
>
> 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: Home Page?

2007-07-30 Thread housebolt

http://manual.cakephp.org/chapter/configuration - See section 3
"Routes Configuration"

Also checkout the "pages" folder in /app/views/pages/. Anything you
put in there can be accessed from the browser at

/pages/your_page/ (which is equal to /app/views/pages/your_page.thtml
[or .ctp])

and anything you create there can be routed in your routes.php file
(in app/config/routes.php)


On Jul 30, 3:13 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Quick question that I can't seem to find an answer for.  The home page
> of my site needs to have a lot of dynamic content generated on it.  Is
> there a way to generate this content in some kind of controller?  Or
> is there a way to redirect users to the index of another controller/
> view from the home page?
>
> 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: Reducing prototype?

2007-07-30 Thread housebolt

I'd also recommend taking a look at the jQuery library.

http://jquery.com

You can't use Cake's helpers, but the ajax is basically all the same.
I haven't used jquery yet, but I've looked at the documentation and
it's very impressive, and it's just as easy to use as scriptaculous
(maybe even easier). I'm hoping the Cake core group will build a
secondary jquery ajax helper someday.

On Jul 30, 3:13 pm, "Howard Glynn" <[EMAIL PROTECTED]> wrote:
> Brad's recent post (http://tinyurl.com/3bxj9s) on asset packager has
> helped
> a lot, but I'm still struggling with response time on a large intranet app.
> Before
> I get jumped on, even though my database relationships are fairly complex, I
> don't believe the (cake)php page is the problem. Crude measurement with
> firebug shows the 72k of prototype sticking out like a sore thumb. It
> represents
> a large chunk of overall time before the browser request cycle finishes.
>
> Essentially, I only need to use ajax helper+prototype for stuff like div
> remote
> loads, links and form submissions (which is probably quite a lot now I think
> about it)
>
> This rather dated blog posting (http://tinyurl.com/yyw5kd) describes a
> method by
> which to vastly reduce the size. i dropped the download into my app but
> things
> stopped. I followed the method suggested to roll my own but it didn't work
> (probably
> incompatible versions) and I've run out of time tonight to pursue further.
>
> Before I go diving into the prototype src components tomorrow, has anyone
> got any
> advice / experience / downloads on thinning out a recent up to date
> prototype for
> use with cake [1.2] and ajaxhelper??
>
> --
> Howard Glynn  -  Edinburgh, UK
> [EMAIL PROTECTED]   -  email, google talk, facebook


--~--~-~--~~~---~--~~
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 this not a security issue?

2007-07-30 Thread housebolt

Oh, hehe I get it now.

Sorry, I was assuming you were trying to add a value that you actually
did want to add/change in your database.

Larry's right (as usual), you can limit the fields can get changed by
the third param in $this->Model->save().

On Jul 30, 3:24 pm, morecakepls <[EMAIL PROTECTED]> wrote:
> Thanks, that answered my question! Perfect
>
> On Jul 30, 10:48 pm, "Larry E. Masters aka PhpNut" <[EMAIL PROTECTED]>
> wrote:
>
> > No it is not...
>
> >http://api.cakephp.org/class_model.html#ebe42ae387be89985b5a35dd428f5c81
>
> > The third param in the save method is what you are looking for in 1.1 same
> > goes for 1.2 but version 1.2 also has the security class that does a little
> > more magic.
>
> > --
> > /**
> > * @author Larry E. Masters
> > * @var string $userName
> > * @param string $realName
> > * @returns string aka PhpNut
> > * @access  public
> > */
>
> > On 7/30/07, morecakepls <[EMAIL PROTECTED]> wrote:
>
> > > Hi
>
> > > What if my table is named User and there are three fields called
> > > Username, Password, Secretvalue. I present the user a form to change
> > > the username and password and use the $this->User->save($this->data)
> > > function in the controller to save the form data to the database.
>
> > > I managed to use firefox to create another input element for the
> > > Secretvalue and changed the Secretvalue in the User table. Is this not
> > > a serious security issue? How can I avoid this? Should I validate
> > > before saving data to the database?
>
> > > Thanks
> > > morecakepls


--~--~-~--~~~---~--~~
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 this not a security issue?

2007-07-30 Thread housebolt

Hmm... well usually what you'd want to do is put the secret value into
a session variable,

$this->Session->write('secretvalue', 'whateverthesecretvalueis');

Once the person has posted the value from the hidden input tag, you
can then check it against the secret value to make sure that they're
the same.

if($this->Session->check('secretvalue') {
if ($this->Session->read('secretvalue') == $this->data['Model']
['secretvalue']) {
// everything's a ok
}else{
// bad hacker... bad!
}
}else{
   // session value not set, do a redirect
}

You can also look at the Security component in the CakePHP manual for
more security helpers, like requirePost to require a POST rather than
a GET request.
I also recommend that you buy 'Esential PHP Security' by Chris
Shiflett, http://www.oreilly.com/catalog/phpsec/.

Hope this helps : ).

On Jul 30, 2:42 pm, morecakepls <[EMAIL PROTECTED]> wrote:
> Hi
>
> What if my table is named User and there are three fields called
> Username, Password, Secretvalue. I present the user a form to change
> the username and password and use the $this->User->save($this->data)
> function in the controller to save the form data to the database.
>
> I managed to use firefox to create another input element for the
> Secretvalue and changed the Secretvalue in the User table. Is this not
> a serious security issue? How can I avoid this? Should I validate
> before saving data to the database?
>
> Thanks
> morecakepls


--~--~-~--~~~---~--~~
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-30 Thread housebolt

I've read discussions from people in the cake core group to this
affect, and I've seen it in my own work as well, especially with many
large models, which is usually the case for me since I try to keep my
controllers as lite as possible. It may not be as large an issue since
1.11 (i think that's when they introduced lazy loading?), but it still
does affect load times on shared servers, especially overloaded shared
servers.

On Jul 29, 4:30 pm, Grant Cox <[EMAIL PROTECTED]> wrote:
> On Jul 29, 4:45 pm, housebolt <[EMAIL PROTECTED]> wrote:
>
> > $usesiseviland 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 $useswhere
> 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: Cake PHP running dead slow

2007-07-30 Thread housebolt

Well, sort of, if your model is set up like this:



You should be able to use the model "Profile" in your controller like
this:

if($this->User->save($this->data['User'])) {
  $this->User->Profile->save($this->data['Profile']);
}

But you can use bindModel for this as well. Same concept, just a
different way of doing it.

I haven't seen any benchmarks on this subject. I just know that it
works. I wish I had time to do it because a ton people would be
interested in the subject (and thus I'd get a ton of traffic to my
website). Anyone out there want to take this on? I'll have time to do
it in about 2 months : ).




On Jul 30, 3:20 am, phpjoy <[EMAIL PROTECTED]> wrote:
> i think that he ment to use the bindmodel() instead of loading a new
> model..
>
> user->profile->func();
> instead of
> loadModel('user');
> loadModel('profile');
>
> i wondered what's the performance difference.
>
> On Jul 30, 1:30 am, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> > On Jul 29, 4:45 pm, housebolt <[EMAIL PROTECTED]> wrote:
>
> > > $usesiseviland 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 $useswhere
> > 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: 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: symfony

2007-07-16 Thread housebolt

Look at it this way,

Cake keeps its structure simple and completely php-based so you don't
have to use the command line if you don't want to, which symfony has
you doing all of the time. The only time I use the command line is at
the beginning of a project, and that's using the bake.php script. But
the cool thing is I don't HAVE to use bake.php. Also, who wants to use
yaml in their php applications?? No one would use them in a normal php
application (unless you're crazy), so why use it now? With cake you're
up and running in about a half hour. I tried getting symfony up and
running and after 4 hours I gave up.

The other reason is speed. While codeigniter is faster than cake (not
by much), it's not as mature or as cool to use, and symfony's so
complicated that it's about 5-10 times slower than cake.

So there's my two bits. I tried symfony awhile back in my pre-
framework days and I almost lost my head trying to wrap it around
symfony. Go with cake, it's your best choice.



On Jul 16, 4:19 am, Thierry <[EMAIL PROTECTED]> wrote:
> to all php fans
> maybe an evil word over here,
> why aren't you using symfony
>
> (i am and im hoping im not making the wrong choice, given that you
> have 6 times as many people which have joined this group...)


--~--~-~--~~~---~--~~
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: Validate $html->radio how to ?

2007-07-15 Thread housebolt

Oops, typo, it's

if(!isset($this->data['Bloodbank']['gender'])) { ...

Sorry ; )

On Jul 14, 6:10 pm, housebolt <[EMAIL PROTECTED]> wrote:
> You'll want to put this tag before your $html->radio tag:
>
> hidden('Bloodbank/gender', array('value'=>'')); ?>
>
> Gender:
> radio('Bloodbank/gender',array('Male','Female')) ?>
> tagErrorMsg('Bloodbank/gender', 'gender is
> required') ?>
>
> The reason for this is that if a radio button is not selected, the
> value not posted, so you need to have a hidden input with an empty
> value in your view so that it will get posted. When the user selects
> the radio button, the radio button will override the hidden value. You
> can use VALID_NOT_EMPTY in your model's validate var, but also make
> sure in your controller that the value is set so that hacker's can't
> just delete the hidden input tag.
>
> if(isset($this->data['Bloodbank']['gender'])) {
>   $this->invalidate('Bloodbank/gender');
>   $this->render();
>   exit;
>
> }
>
> // continue onward
>
> Hope this helps. PHP and forms, especially in regard to checkboxes and
> radio buttons, can be very frustrating sometimes.
>
> On Jul 13, 10:26 pm, "salahuddin pasha (salahuddin66)"
>
> <[EMAIL PROTECTED]> wrote:
> > hello there,
>
> > I am trying to validate radio (where I did not set any default value)
>
> > Gender:
> > radio('Bloodbank/gender',array('Male','Female')) ?>
> > tagErrorMsg('Bloodbank/gender', 'gender is
> > required') ?>
>
> > in model
> > 
> > var $validate = array(
> > 'gender' => VALID_NUMBER,
> > .
> > )
>
> > i also tried with VALID_NOT_EMPTY
>
> > But is seems that I dont get tagErrorMsg, when none is selected.
>
> > --
> > --salahuddin66
>
> > salahuddin66.blogspot.com
> > salahuddin66.deviantart.com
>
> >  signature.asc
> > 1KDownload


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

2007-07-15 Thread housebolt

I highly recommend "Essential PHP Security" by Chris Shiflet,
published by O'reilly. He talks alot about "filter input/escape
output" and gives some good examples.

You can read it at http://www.oreilly.com if you get a safari account
(in my opinion something essential to all php programmers).





On Jul 15, 6:05 am, "Feris Thia" <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> Any article recommendation that refer to php/cakephp security best practice ?
>
> Regards,
>
> Feris


--~--~-~--~~~---~--~~
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: Get the Session Id being generated

2007-07-15 Thread housebolt

I believe you can just use the php function session_id()

http://www.php.net/session_id

I haven't tested it in cake-created sessions mode, but I believe this
will work with that as well.

On Jul 14, 8:31 pm, r557 <[EMAIL PROTECTED]> wrote:
> after debugging the session object, it outputted the following array:
>
> SessionComponent Object
> (
> [__active] => 1
> [valid] => 1
> [error] =>
> [_userAgent] => 15988584ca32783087cd2ffdbb6ba45b
> [path] => /som/
> [lastError] =>
> [security] => high
> [time] => 1184469726
> [sessionTime] => 1184470926
> [watchKeys] => Array
> (
> )
>
> [_log] =>
> [host] => *
> [cookieLifeTime] => 0
> [base] => /som
> [webroot] => /som/
> [here] => /som/shopping_carts/show/
> [params] => Array
> (
> [pass] => Array
> (
> )
>
> [controller] => shopping_carts
> [action] => show
> [url] => Array
> (
> [url] => shopping_carts/show/
> )
>
> [bare] => 0
> [webservices] =>
> [plugin] =>
> )
>
> [action] => show
> [data] =>
> [plugin] =>
> )
>
> so my question now is though, how do i get [_userAgent] =>
> 15988584ca32783087cd2ffdbb6ba45b to a variable from this?
>
> On Jul 14, 11:55 pm, r557 <[EMAIL PROTECTED]> wrote:
>
> > I'm looking for how to get the session id being generated by CakePHP.
> > i have my session working fine, but would like to know how to find out
> > what the session id is so i can store it in a db table.
>
> > how do i do this?


--~--~-~--~~~---~--~~
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: Validate $html->radio how to ?

2007-07-15 Thread housebolt

You'll want to put this tag before your $html->radio tag:

hidden('Bloodbank/gender', array('value'=>'')); ?>

Gender:
radio('Bloodbank/gender',array('Male','Female')) ?>
tagErrorMsg('Bloodbank/gender', 'gender is
required') ?>

The reason for this is that if a radio button is not selected, the
value not posted, so you need to have a hidden input with an empty
value in your view so that it will get posted. When the user selects
the radio button, the radio button will override the hidden value. You
can use VALID_NOT_EMPTY in your model's validate var, but also make
sure in your controller that the value is set so that hacker's can't
just delete the hidden input tag.

if(isset($this->data['Bloodbank']['gender'])) {
  $this->invalidate('Bloodbank/gender');
  $this->render();
  exit;
}

// continue onward

Hope this helps. PHP and forms, especially in regard to checkboxes and
radio buttons, can be very frustrating sometimes.

On Jul 13, 10:26 pm, "salahuddin pasha (salahuddin66)"
<[EMAIL PROTECTED]> wrote:
> hello there,
>
> I am trying to validate radio (where I did not set any default value)
>
> Gender:
> radio('Bloodbank/gender',array('Male','Female')) ?>
> tagErrorMsg('Bloodbank/gender', 'gender is
> required') ?>
>
> in model
> 
> var $validate = array(
> 'gender' => VALID_NUMBER,
> .
> )
>
> i also tried with VALID_NOT_EMPTY
>
> But is seems that I dont get tagErrorMsg, when none is selected.
>
> --
> --salahuddin66
>
> salahuddin66.blogspot.com
> salahuddin66.deviantart.com
>
>  signature.asc
> 1KDownload


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