Redirect to 404 error page

2008-07-01 Thread theandystratton

Hey guys,

I'm using my own version of a pages controller with routes to the
display() method, that's basically handling the layout/view rendering
via switch statement:

?php
//
//Rroutes are similar to: /terms = /pages/display/terms
//
switch ( func_get_arg(0) ) {
case 'terms':
$this-layout = 'terms';
$this-pageTitle = 'Terms and Conditions';
break;

default:
//
// HELP!
//
break;
}
?

In the commented section is where I'd like to be able to redirect/
throw a 404 error. I have no clue how to do this with Cake, could
someone please point my in the right direction?

thx,

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



Re: Best Upgrade Path

2008-06-19 Thread theandystratton

@leo and @Chris thanks a lot for the input/suggestions. Good call on
the diff on files in app/config/ !


On Jun 18, 10:05 am, leo [EMAIL PROTECTED] wrote:
 Maybe it's naïve of me, but I just copy the new cake directory over
 the old cake directory (well actually everything but app). I would
 expect the app directory to be fairly inviolable by CakePHP. Sure,
 there will be times when certain things change like the extension for
 template (view) files, but there should be a clear separation between
 core and application.

 On 18 Juny, 15:15, theandystratton [EMAIL PROTECTED] wrote:

  Thanks guys, these are both great and give me some good insight. @Sam
  I really like the linking idea, thanks again.

  One other question then, does the app directory never need to be
  touched? The only thing that confused me was if the configuration
  objects/methods have changed, you could be breaking something by
  updating your cake directory.

  Maybe I'm over-thinking? I think it just makes me nervous introducing
  this into a larger environment than shared/virtual hosting for our
  apps.

  Any thoughts you guys or anyone else on the group can share would be
  great!

  Thanks,

  -Andy

  On Jun 6, 1:58 pm, Samuel DeVore [EMAIL PROTECTED] wrote:

   Generally what I do for production is have all my cake core files out
   of my web root path, with each version of cake that I have used in
   it's own subfolder then link to a cake_current folder to my production
   release dependancy then in index.php in app/webroot/  I have the
   following

   if (!defined('CAKE_CORE_INCLUDE_PATH')) {
           // you can add a switch for your dev environment here as well
           define ('CAKE_CORE_INCLUDE_PATH', /full/path/to/cake_current');

   }

   this way I can quickly upgrade the production site to a new release
   and roll back from it and each cake version folder is a svn export of
   a specific place in time.  I can also tag my source code to tie to a
   particular release of cake  so my directories might look like

   cake_1.2.x_r6336/
       cake
   cake_1.2.x+r6456/
       cake
   cake_current  - symlink to cake_1.2.x_r6456

   webroot/
     app_1
     app_2
     app_3

   then each app can link to the cake version it needs or to to the common 
   _current

   Sam D

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

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

  http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-m...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Best Upgrade Path

2008-06-06 Thread theandystratton

Hey all,

I'm new to Cake, and have been playing with it the past few weeks.
I've been using a beta copy of 1.2 and want to upgrade to the release
that just posted.

Is there an Upgrade/Update tutorial or best practice out there anyone
can recommend? I haven't found anything with my initial searches and
wanted to ping the group while I continue to look.

I have an existing app I am developing and don't want to lose any work
by overwriting/deleting.

We're also thinking about standardizing this for all of our sites
eventually, and will definitely want to create a safe, clean, upgrade
process as Cake's development continues.

Thanks,

-Andy

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



Auth login redirect pointing to image?

2008-05-23 Thread theandystratton

For some reason, my Auth component is redirecting to an image... and
I'm not sure where to debug.

I'm assuming this is stored in the session, and while I play with
dumping some session stats, I'd figure I'd see if anyone else has the
issue.

The weirder issue is, I'm using the thickbox.js library (built on
jQuery) on the pages of the site, and the random redirect is to the
thickbox.js loading GIF.

I'm not sure why this is happening or how it's passing this image name
any where. Anyone experience anything similar?

Gracias,

-Andy

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



Re: $this-Auth-user() cached? - Cake 1.2

2008-05-22 Thread theandystratton

 I don't understand what you're trying to do here. Are you trying to
 refresh the $user variable or the data in the session?

I'm trying to find an easy way to refresh the data held in $this-Auth-
user() -- is that just pointing to the User value in the session?
I'm not sure how the Auth object maps to the values in the Session.

-Andy

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



$this-Auth-user() cached? - Cake 1.2

2008-05-21 Thread theandystratton

Just wondering if the array of data return from $this-Auth-user() is
cached (either on disk or session) by default?

When creating an admin screen to update some fields the user model
returned from $this-Auth-user() was not updated.

If so, is there a quick way to refresh? My current fix:

$user = $this-User-findByUserId( $this-Auth-user('user_id') );

But that seems a bit clunky... ?

-Andy

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



Building an API to plug into Cake AppControllers.

2008-05-19 Thread theandystratton

Hey all:

We're in the process of re-developing an existing app using Cake and
are interesting in building API's.  Our goal is to not duplicate code,
so we'd like the API's living at api.myapplication.com to be able to
call/use the logic built into our controllers.

Any one done this before or have insights? We'd like to avoid
duplicating areas where the application logic lives, but both the API
and the application can live on the same box, or at least have file
access as if they were.

Thanks,

-Andy

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



Trying to update record, not insert!

2008-05-13 Thread theandystratton

To preface, I've seen this a few places before but the solutions given
aren't getting me anywhere.

I've got a basic User model extending AppModel, I'm finding a record
based on the matching the data in 2 fields, changing 1 field in the
returned array and trying to save (update) that record by sending the
array back to the save method...

// start code:

$data = $this-User-find( array('User.username' = $username,
'User.email' = $email) );

$data['User']['passwd'] = $this-Auth-password('test');

//
// problem occurs with or without following line:
// $this-User-user_id = $data['User']['user_id'];
//

$this-User-save( $data );

// end of code.

This results in an attempt to insert a new record with the user_id in
$data.

Any help is appreciated, I've migrated into Cake this week and am
trying to convert an existing procedural app to it.

-andy

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



Re: Trying to update record, not insert!

2008-05-13 Thread theandystratton

Ok, so in classic n00b goodness I found my simple mistake.

I think the convention is to have your primary key of a table be
labeled `id` and I decided to go for broke naming it `user_id`

To correct my problem I needed to tell the User model I'm using the
`user_id` field as the primary key:

?php

class User extends AppModel {
var $name = 'User';
var $primaryKey = 'user_id';
}

?


Viola, problem solved. Thanks for the quick response!

-Andy

On May 13, 1:05 pm, Aaron  Shafovaloff [EMAIL PROTECTED] wrote:
 Shouldn't it be...

 $this-User-id = $data['User']['id'];

 ?

 On May 13, 10:27 am, theandystratton [EMAIL PROTECTED]
 wrote:

  To preface, I've seen this a few places before but the solutions given
  aren't getting me anywhere.

  I've got a basic User model extending AppModel, I'm finding a record
  based on the matching the data in 2 fields, changing 1 field in the
  returned array and trying to save (update) that record by sending the
  array back to the save method...

  // start code:

  $data = $this-User-find( array('User.username' = $username,
  'User.email' = $email) );

  $data['User']['passwd'] = $this-Auth-password('test');

  //
  // problem occurs with or without following line:
  // $this-User-user_id = $data['User']['user_id'];
  //

  $this-User-save( $data );

  // end of code.

  This results in an attempt to insert a new record with the user_id in
  $data.

  Any help is appreciated, I've migrated into Cake this week and am
  trying to convert an existing procedural app to it.

  -andy

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