Dynamic redirecting ... stumped!

2010-01-27 Thread John R
(This is more of an overall programming / PHP question than Cake .. but it will ultimately be built in Cake, and this community kicks ass so I figured I would throw it out there) Hello everyone. Here is the challenge I am working on: I want to build a system that would allow you to control the re

Re: Using usort in Cake

2009-08-10 Thread John R
Perfect, thank you. On Aug 10, 9:32 am, brian wrote: > Try the Set > class.http://book.cakephp.org/view/640/Sethttp://blogs.bigfish.tv/adam/2008/03/24/sorting-with-setsort-in-cakep... > > > > On Mon, Aug 10, 2009 at 9:46 AM, John R wrote: > > > I have an arra

Using usort in Cake

2009-08-10 Thread John R
I have an array that I need to sort by an associative key. PHP's usort () function is what I need, however it won't work inside a controller. Example: function cmp($a, $b) { return strcmp($a["fruit"], $b["fruit"]); } $fruits[0]["fruit"] = "lemons"; $fruits[1]["fruit"] = "apples"; $fruits[2]

Find Count inside a model relationship

2009-08-07 Thread John R
I think there is a way to do this, but it is escaping me .. I have two tables: entries and votes Users vote on entry, which are stored inside table "votes" like: id entry_idip 1 2 129.192.12.4 2 1 129.192.12.4 3 2

Re: How can related records be removed when master is deleted?

2009-05-21 Thread John R
Isn't this what deleteAll() is for? --~--~-~--~~~---~--~~ 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-p

Re: Maintain subdomain in login redirect

2008-05-28 Thread John R
Hey folks .. OP here .. Curious if anyone has any insight on this problem that is still plaguing my app! Any assistance would be MUCH appreciated. John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group

Re: 500 Error

2008-05-12 Thread John R
by a > link, check the link) and Apache is try to find a default page for > error 500. > Does this happen only for 1 controller or you have other controllers > correctly working ? > > On May 12, 7:12 pm, "Jonathan Snook" <[EMAIL PROTECTED]> wrote: > > > On

500 Error

2008-05-12 Thread John R
My app is throwing up a server 500 error and I can't figure out why/ where. The page isn't helpful either, only showing this: Missing Method in ContestsController Error: The action 500.shtml is not defined in controller ContestsController Error: Create ContestsController::500.shtml() in file:

Re: More of an SQL question ... having a hard time with this statement

2008-04-21 Thread John R
t; 'TABLE_ALIAS.modified DESC', > 'limit' => 15 > > If you can get past the 500 errors, post the SQL that Cake is creating. > > On Sun, Apr 20, 2008 at 10:55 AM, b logica <[EMAIL PROTECTED]> wrote: > > What does the server

Re: More of an SQL question ... having a hard time with this statement

2008-04-21 Thread John R
k. > I think you need to back up a few steps. > > On Mon, Apr 21, 2008 at 10:19 AM, John R <[EMAIL PROTECTED]> wrote: > > > Here is the query: > > > SELECT *, MAX(`Photo`.`revision_id`) as revision_id FROM `photos` AS > > `Photo` LEFT JOIN `users` AS `User` ON

Re: More of an SQL question ... having a hard time with this statement

2008-04-21 Thread John R
Here is the query: SELECT *, MAX(`Photo`.`revision_id`) as revision_id FROM `photos` AS `Photo` LEFT JOIN `users` AS `User` ON (`Photo`.`user_id` = `User`.`id`) WHERE `Photo`.`contest_id` = 1 AND 1=1 GROUP BY `Photo`.`user_id` LIMIT 12 Basically, it is grabbing all records like it is supposed to

Re: More of an SQL question ... having a hard time with this statement

2008-04-20 Thread John R
Ha ... I lied :) I thought it was working perfectly, and it's very close, but here is what is happening: Here is the statement: http://bin.cakephp.org/view/251108990 What it does is successfully returns the proper amount of images. However, it screws up the grouping. Here is a sample output:

Re: More of an SQL question ... having a hard time with this statement

2008-04-20 Thread John R
Haha .. tried something I thought had no chance of working, and of course it works perfectly: 'fields' => array( '*', 'MAX(Photo.revision_id) as revision_id') Hope it helps your struggle too! Thanks for your help! --~--~-~--~~~---~--~~ You received this message be

Re: More of an SQL question ... having a hard time with this statement

2008-04-20 Thread John R
' => 'TABLE_ALIAS.modified DESC', > 'limit' => 15 > > If you can get past the 500 errors, post the SQL that Cake is creating. > > On Sun, Apr 20, 2008 at 10:55 AM, b logica <[EMAIL PROTECTED]> wrote: > > What does the server log say

Function in view ....

2008-04-20 Thread John R
I have an "activity list" and am saving the creation datetime in the database. In my view, I want to be able to say "5 minutes ago", "2 hours ago" for the time submitted instead of the complete datetime. I wrote the function that takes the datetime, converts it to a timestamp and then performs th

Re: $data always empty - Please HELP!

2008-04-19 Thread John R
a) You're doing $this->data , right? b) Is the form action going to the right place? On Apr 19, 7:31 pm, Matias Veleda <[EMAIL PROTECTED]> wrote: > Hey guys, > > I'm new to CakePHP. I followed the instructions in the manual, the > example case and everytime I want to update my databaser from a

Re: More of an SQL question ... having a hard time with this statement

2008-04-19 Thread John R
t;[EMAIL PROTECTED]> wrote: > Try something like this: > > $criteria = array( > 'fields' => array( > 'TABLE_ALIAS.user_id', 'MAX(TABLE_ALIAS.revision_id)' > ), > 'conditions' => array( >

Re: More of an SQL question ... having a hard time with this statement

2008-04-19 Thread John R
you have many users > > you could easily have more than 15 records where the greatest > > revision_id's are equal, and they won't be useful for showing only the > > most recent revisions.) > > > On Apr 18, 4:10 pm, John R <[EMAIL PROTECTED]> wrote: >

Best practice for setting current user variable?

2008-04-18 Thread John R
How do you all set the current user per controller? --~--~-~--~~~---~--~~ 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

More of an SQL question ... having a hard time with this statement

2008-04-18 Thread John R
In this app, users can upload photos, and then revise them. The app stores a log of all revisions so they can easily go back to them. The database has: user_id and revision_id I am trying to write a statement that grabs only the 15 latest (highest #) revisions for all users. So .. if the table

Maintain subdomain in login redirect

2008-04-18 Thread John R
When a user is at http://roar.domain.com and clicks on say, upload photo (that requires login) http://roar.domain.com/upload, it takes them to http://www.domain.com, just like a good little app. However, after a successful login, it takes them to http://www.domain.com/upload Any idea how I can t

Re: HABTM returning single result?

2008-04-14 Thread John R
You win! --~--~-~--~~~---~--~~ 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 option

Re: HABTM returning single result?

2008-04-14 Thread John R
PS: Anyone else think Google should have a better way to paste code? Here is the external paste so you can actually read the model: http://bin.cakephp.org/view/2092329615 On Apr 14, 9:58 am, John R <[EMAIL PROTECTED]> wrote: > I have a HABTM relationship that is working, excep

HABTM returning single result?

2008-04-14 Thread John R
I have a HABTM relationship that is working, except it only returns the first result. Here is the entry in my User model: var $hasAndBelongsToMany = array( 'Contests' => array('className' => 'Contest', 'joinTable'

Default this->data controller?

2008-04-13 Thread John R
I have a pretty basic form that looks like this: create(); ?> checkbox('contest.agree'); ?> I have read & agreed to the contest rules end('Join This Contest!'); ?> This is in the 'contests' controller. When the form is submitted however, I get this: Array ( [Users] => Array (

Re: Quick Auth component issue

2008-04-09 Thread John R
Hint: input('password'); ?> On Apr 9, 2:16 pm, Baz <[EMAIL PROTECTED]> wrote: > Because there are so many bits and pieces associated with Auth, it's hard to > diagnose your problem without ALL your code. However, let's try the reverse. > Look at these: > > http://book.cakephp.org/view/172/authent

OT: What code editors do you all use?

2008-04-08 Thread John R
Just curious .. The only features I really use in an editor are code highlighting and FTP ... all of the crazy PHP IDEs are incredibly bloated for me. What do you all use? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

Page specific javascript

2008-04-07 Thread John R
Is there an easy way with Cake to get /js/register.js to be automatically included in register.ctp? (And conversely not included if it doesn't exist?) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group.

Amazon s3 + CakePHP

2008-04-04 Thread John R
The next step of my uber fun app is getting Amazon s3 to play nice with CakePHP. Sure, I can add the class to Vendors and do everything manually - but what is the cooler way? Are there any components/ helpers built to orchestrate this? --~--~-~--~~~---~--~~ You rece

Re: How to manage different site instances...

2008-04-03 Thread John R
rentStage(); > if ($this->action != $currentStage){ > $this->setAction($currentStage); > } > > } > > function submit() { > > } > > function vote() { > > } > > Hope that helps. > > Cheers, > Adam > > On Apr 4, 5:15

Re: Found a sweet routing work around! I'm so close!

2008-04-03 Thread John R
That was it! The 'else' worked like a charm. 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, sen

Re: Found a sweet routing work around! I'm so close!

2008-04-03 Thread John R
Nope.. --~--~-~--~~~---~--~~ 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,

Found a sweet routing work around! I'm so close!

2008-04-03 Thread John R
I've been desperately trying to figure out a good method to use dynamic subdomains and I am so close! Here is what I have going on: 1) My app_controller checks the subdomain against the database and makes sure it's valid. If not, it redirect - works great! 2) I put the following hack inside rou

Re: How to manage different site instances...

2008-04-03 Thread John R
Careful to not be too specific :) I don't see how a model behavior would help me here ... --~--~-~--~~~---~--~~ 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.c

Re: How to manage different site instances...

2008-04-03 Thread John R
Note: The ugly/obvious way to do this would be to put a switch inside every function in contests_controller that checks the stage and then either redirects if it's not that stage or w/e. I am hoping for a more glamorous option! :) On Apr 3, 2:15 pm, John R <[EMAIL PROTECTED]>

How to manage different site instances...

2008-04-03 Thread John R
My application is a series of "contests" with different stages (submission, voting, awards, etc.) For each stage, the site is going to function completely differently. During Stage 1 (submission) for instance, you will be able to upload, critique, etc. The front page will be a huge list of all su

Re: Login redirect issue ...

2008-04-02 Thread John R
So strange .. when I hit login FROM the subdomain, this is my $_SESSION: Array ( [Config] => Array ( [userAgent] => XXX [time] => 1207229748 [rand] => X [timeout] => 10 ) [Auth] => Array ( [redirect] => http://sample.domain.com/contest ) ) The [redirect] is fine .. When I do a successfu

Re: Login redirect issue ...

2008-04-01 Thread John R
Nope ... I am using routing and baseURL is commented out. Any other ideas here? --~--~-~--~~~---~--~~ 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 unsu

Login redirect issue ...

2008-03-30 Thread John R
I have an application that uses virtual subdomains to point to a controller. If you are in http://sample.domain.com and click Login, it takes you to http://www.domain.com/login like it is supposed to. However, when you login, it redirects to: http://www.domain.com/http:/sample.domain.com/ Isn't

Re: Question about model relational mapping

2008-03-29 Thread John R
Adding on to that ... Say you have a user hasMany comments setup. There are parameters for order, limit, etc. Say you want the latest 5 comments on one page, but you want 100 on the next page. If you only have one hasMany, how do you do this? Me thinks I'm missing something here --~--~

Question about model relational mapping

2008-03-29 Thread John R
Say you set a User model up via hasMany to photos, comments, threads, etc. Does this mean every single time you do a User->read or find that it is going to potentially return thousands and thousands of results? Is there a way to only return the comments on say pages you want comments?? --~--~

Re: $_FILES + cake 1.2 question

2008-03-29 Thread John R
pr = print_r (a PHP function) Putin your view to see what the array looks like --~--~-~--~~~---~--~~ 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 u

Routing / logic / subdomain questions .. helps!

2008-03-29 Thread John R
I have an application that features a number of "contests". The root of the site houses all of the core site functionality (domain.com/ login, domain.com/register). Originally, I wanted to use dynamic subdomains to handle the contests .. so http://contestname.domain.com would open that contests

Reset Password Tutorial (if anyone needs it!)

2008-03-27 Thread John R
Along with the disclaimer that this might not be a GREAT way to do this method, I present my first CakePHP tutorial: Reset Password http://www.johnroa.net/2008/03/27/cakephp-tutorial-reset-password-cake-12xxx/ Enjoy! --~--~-~--~~~---~--~~ You received this message

AJAX logic question

2008-03-26 Thread John R
I am trying to setup something similar (but not identical) to Digg Spy (http://www.digg.com/spy). Basically, I want a "latest activity" on my front page, and then call some sort of function to load new events in real time from various controllers to this div. From the Spy tutorials I have seen, t

Customize setFlash() ?

2008-03-26 Thread John R
So .. according to the API, you can send params with setFlash() to be used in the view. That is fine and dandy .. however, is it possible to use those params to set the class of the div? The only parameter flash() allows is the key. What I am trying to do is pass a parameter called "class" so I c

Re: An Extremely Basic Route

2008-03-25 Thread John R
Maybe I am crazy, but I use a totally different kind of routing. In your case: Router::connect('/*', array('controller' => 'pages', 'action' => 'showLog')); and then set the variable in the function: function showLog($id) { //do something with $id } Obviously this works better when

Re: Modal / Lightbox?

2008-03-24 Thread John R
Yeah, I realized I was thinking about this illogically and can't do what I was thinking. Thanks anywho! :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-ph

Re: Modal / Lightbox?

2008-03-24 Thread John R
I couldn't be more confused by the last two posts ... =[ jonknee: That seems like an option to re-create flash(). So you would set a variable, the page reloads, and it shows the message. What I am trying to do is trigger a popup window without the page reloading. Siegfried: With your script,

Re: Modal / Lightbox?

2008-03-24 Thread John R
Ok .. I understand you can call it from the view .. but if you look 4 posts above, my goal is to call it inside a controller, like you would a flash(): function checkValid($whatever) { if (validation logic) $this->modal('Success!', 'This is valid!', '/valid'); else

Re: Modal / Lightbox?

2008-03-24 Thread John R
Excuse me if this is a simple question .. but assuming that is a Javascript function .. how would I call it from the Controller? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group,

Re: Different flash layout for public and admin ?

2008-03-23 Thread John R
You can also easily modify the flash() function and add an additional parameter for which layout to render. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-p

Re: Modal / Lightbox?

2008-03-23 Thread John R
I am gathering I might need some sort of Ajax listener loaded on each page and activate it via the Controller? Help! =[ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send ema

Who uses CakePHP?

2008-03-07 Thread John R
(Sorry if my other post shows up too) What major Web 2.0 sites use 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 unsubsc

What major sites use Cake?

2008-03-07 Thread John R
Are there any major Web 2.0 sites using Cake? It seems to me most use proprietary or something like Smarty+. Some insight would be very helpful! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To p