BelongsTo Conventions and Outside Databases
I have an outside database of users that instead of having an 'id' column has a 'customers_id' field. How do I manipulate my associations to accommodate this? I keep getting stuck with: Unknown Column ModelName.id --~--~-~--~~~---~--~~ 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: Routing and Pagination Issue
Made the following changes to the paginator.php: instead of: return $this-link($title, $url, array_merge($options, array('escape' = $escape))); I wrote: $outurl = ''; foreach($url as $key = $val) { $outurl .= $key.':'.$val; } return 'a href=/'.$this-params['slug'].'/'.$this-params ['controller'].'/'.$this-params['action'].'/'.$outurl.''.$title.'/ a'; Not sure if this will extend well but seems to work for everything I need so far... On Dec 18, 5:54 pm, mwcbrent midwestco...@gmail.com wrote: So the best idea would be to alter the Paginator class to suit my needs? Any ideas on which vars to alter? On Dec 17, 1:35 pm,mwcbrentmidwestco...@gmail.com wrote: Sorry! The actual route code is: Router::connect('/:slug/pages/*',array ('controller'='pages','action'='index')); On Dec 17, 1:30 pm,mwcbrentmidwestco...@gmail.com wrote: I've found a handful of posts about this but no solutions that fit my problem. In my routes.php I have: Router::connect('/:slug/pages/index', array('controller' = 'pages', 'action' = 'index')); But when I use the Paginator it only gives me: /pages/index:page2 I'd like to get: /myslug/index:page2 How do I do this without modifying the paginator.php code directly? --~--~-~--~~~---~--~~ 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: Routing and Pagination Issue
So the best idea would be to alter the Paginator class to suit my needs? Any ideas on which vars to alter? On Dec 17, 1:35 pm, mwcbrent midwestco...@gmail.com wrote: Sorry! The actual route code is: Router::connect('/:slug/pages/*',array ('controller'='pages','action'='index')); On Dec 17, 1:30 pm, mwcbrent midwestco...@gmail.com wrote: I've found a handful of posts about this but no solutions that fit my problem. In my routes.php I have: Router::connect('/:slug/pages/index', array('controller' = 'pages', 'action' = 'index')); But when I use the Paginator it only gives me: /pages/index:page2 I'd like to get: /myslug/index:page2 How do I do this without modifying the paginator.php code directly? --~--~-~--~~~---~--~~ 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: Routing and Pagination Issue
Sorry my actual Route looks like: Router::connect('/:slug/pages/*',array ('controller'='scenes','action'='index')); On Dec 17, 1:30 pm, mwcbrent midwestco...@gmail.com wrote: I've found a handful of posts about this but no solutions that fit my problem. In my routes.php I have: Router::connect('/:slug/pages/index', array('controller' = 'pages', 'action' = 'index')); But when I use the Paginator it only gives me: /pages/index:page2 I'd like to get: /myslug/index:page2 How do I do this without modifying the paginator.php code directly? --~--~-~--~~~---~--~~ 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: Routing and Pagination Issue
Sorry! The actual route code is: Router::connect('/:slug/pages/*',array ('controller'='pages','action'='index')); On Dec 17, 1:30 pm, mwcbrent midwestco...@gmail.com wrote: I've found a handful of posts about this but no solutions that fit my problem. In my routes.php I have: Router::connect('/:slug/pages/index', array('controller' = 'pages', 'action' = 'index')); But when I use the Paginator it only gives me: /pages/index:page2 I'd like to get: /myslug/index:page2 How do I do this without modifying the paginator.php code directly? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Routing and Pagination Issue
I've found a handful of posts about this but no solutions that fit my problem. In my routes.php I have: Router::connect('/:slug/pages/index', array('controller' = 'pages', 'action' = 'index')); But when I use the Paginator it only gives me: /pages/index:page2 I'd like to get: /myslug/index:page2 How do I do this without modifying the paginator.php code directly? --~--~-~--~~~---~--~~ 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: Session ID Being Reset
I'm not sure that answers my question on why they get reset? Shouldn't sessions stay consistent, yet different, on each of the 3 domains? On Dec 16, 4:18 am, AD7six andydawso...@gmail.com wrote: On Dec 16, 6:02 am, mwcbrent midwestco...@gmail.com wrote: I have a Cake 1.2 Build setup on my server with 3 virtual hosts pointed to it. 1)www.domainA.com 2)www.domainB.com 3)www.domainC.com All point to the same app and generate different content based in the $_SERVER['SERVER_NAME'] parameter. Everything is working great except onwww.domainA.comandwww.domainC.comtheSession ID gets reset on EVERY page refresh. I can't for the life of me figure out why this is. Because if it did it would (to quote one of the first googled answers) be: a security hole the size of the grand canyon.? http://www.google.com/search?q=cross+domain+cookies --~--~-~--~~~---~--~~ 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: Session ID Being Reset
I should reiterate that its only important for me to maintain a consistent session independently on the 3 domains. Not to share the session, I understand that to be a security issue and not trying to achieve that. On Dec 16, 9:01 am, mwcbrent midwestco...@gmail.com wrote: I'm not sure that answers my question on why they get reset? Shouldn't sessions stay consistent, yet different, on each of the 3 domains? On Dec 16, 4:18 am, AD7six andydawso...@gmail.com wrote: On Dec 16, 6:02 am, mwcbrent midwestco...@gmail.com wrote: I have a Cake 1.2 Build setup on my server with 3 virtual hosts pointed to it. 1)www.domainA.com 2)www.domainB.com 3)www.domainC.com All point to the same app and generate different content based in the $_SERVER['SERVER_NAME'] parameter. Everything is working great except onwww.domainA.comandwww.domainC.comtheSessionID gets reset on EVERY page refresh. I can't for the life of me figure out why this is. Because if it did it would (to quote one of the first googled answers) be: a security hole the size of the grand canyon.? http://www.google.com/search?q=cross+domain+cookies --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Session ID Being Reset
I have a Cake 1.2 Build setup on my server with 3 virtual hosts pointed to it. 1) www.domainA.com 2) www.domainB.com 3) www.domainC.com All point to the same app and generate different content based in the $_SERVER['SERVER_NAME'] parameter. Everything is working great except on www.domainA.com and www.domainC.com the Session ID gets reset on EVERY page refresh. I can't for the life of me figure out why this is. My core.php has the following attributes: debug = 1 session.save = cake (tried php and database to no avail - also note when using 'database' refreshes would create 3 entries per 1 refresh?!) checkAgent = false Security.level = low AutoStart sessions = false Any reasons why this might be happening? Is there any way to cut Cake's Session handler out of my app? I feel like if I had manual control over every session call I would be able to debug this better. I seem to have the same problems with the Cookie component as well... Much appreciation --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Pagination with HasMany and SQL Aggregation
I'm not sure that this is possible but if it is, it would put Cake into a special place in my heart. I have 2 related models Articles and Ratings. Articles hasMany Ratings A Rating has a User ID an Article ID and a Rating #. In order to get an articles rating I need to query all ratings by the Article ID and average them out. How would I paginate all Articles ordered by Rating? --~--~-~--~~~---~--~~ 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: Display Images off document root
This issue has been solved when i updated my Cake build. On Oct 23, 6:13 pm, mwcbrent [EMAIL PROTECTED] wrote: I am also experiencing this, it seems to get very partial data like there may be a timeout?? On Aug 28, 4:05 am, Andrewk [EMAIL PROTECTED] wrote: Hello, I encounter the same problem, when I trying to retrieve images viaMediaview, not all images displayed, for example I have 20 thumbnails images on the page an only 8~12 first displayed, and on others displayed alt text. In my application I am using cakephp Authentication component and when I trying to display not loaded thumbnails images, by pressing web browser refresh button I redirected to login page to perform Authentication. Moreover number of displayed images on page varies from browser to browser ; I checked in Opera , Firefox and IE6. Anyone have the solution? On Aug 3, 10:16 am, gapiangco [EMAIL PROTECTED] wrote: Got it to work now! Hurray! What I did: 1. Created a layout for items/view(controller/action) which contains nothing but: ?php echo $content_for_layout; ? 2. In my items/viewaction I have: functionview($file = null) { // check if user/member is logged her // ... if ($file) { $this-layout = 'view_image'; $this-view= 'Media'; $params = array( 'id' = {$file}.jpg, 'name' = $file, 'download' = false, 'extension' = 'jpeg', 'path' = 'items' . DS ); $this-set($params); } } And yeah it now displays the images. But I did encounter some problem. Not all images are displayed. Like out of 18 images per page, 8 of them doesn't show up. Trying the right-clickproperties on Firefox shows: Location:http://localhost/projects/tattoo/items/view/z0g7KSoXbu1217687984 Width: 100px Height: 100px Size of file: Unknown (not cached) Alternate text: blank Anyone can help? On Aug 3, 1:52 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote: On Sun, Aug 3, 2008 at 10:28 AM, gapiangco [EMAIL PROTECTED] wrote: Took a second look and yeah JPEG and JPG are there. My bad. The example from the book was intended for downloading. What if from the example URL mysite.com/designs/view/$slug where: designs: controller view: action $slug: slug name of the design category And from that URL, a list of images available under that specified category will be displayed. Something like a gallery of images. How to use MediaView on such? Would be nice to have more examples on the cookbook :-( Well - step back for a while or step out, take a deep breath and think! Do you know how to accomplish the above withoutMediaView? If yes then all you need to do is replace the links to images with the new controller call it say protectedimages and action called show You will have to do a certain amount of programming in the show action which will ensure that the person currently logged can see unwatermarked image or not I presume you are missing the trick that the img src will contain a URL to a controller action and some param rather than the URL to the image itself. If you want to create conditional links to image itself then you will have to write your own helper. HTH Tarique -- = Cheesecake-Photoblog:http://cheesecake-photoblog.org PHP for E-Biz:http://sanisoft.com =- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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: Display Images off document root
I am also experiencing this, it seems to get very partial data like there may be a timeout?? On Aug 28, 4:05 am, Andrewk [EMAIL PROTECTED] wrote: Hello, I encounter the same problem, when I trying to retrieve images viaMediaview, not all images displayed, for example I have 20 thumbnails images on the page an only 8~12 first displayed, and on others displayed alt text. In my application I am using cakephp Authentication component and when I trying to display not loaded thumbnails images, by pressing web browser refresh button I redirected to login page to perform Authentication. Moreover number of displayed images on page varies from browser to browser ; I checked in Opera , Firefox and IE6. Anyone have the solution? On Aug 3, 10:16 am, gapiangco [EMAIL PROTECTED] wrote: Got it to work now! Hurray! What I did: 1. Created a layout for items/view(controller/action) which contains nothing but: ?php echo $content_for_layout; ? 2. In my items/viewaction I have: functionview($file = null) { // check if user/member is logged her // ... if ($file) { $this-layout = 'view_image'; $this-view= 'Media'; $params = array( 'id' = {$file}.jpg, 'name' = $file, 'download' = false, 'extension' = 'jpeg', 'path' = 'items' . DS ); $this-set($params); } } And yeah it now displays the images. But I did encounter some problem. Not all images are displayed. Like out of 18 images per page, 8 of them doesn't show up. Trying the right-clickproperties on Firefox shows: Location:http://localhost/projects/tattoo/items/view/z0g7KSoXbu1217687984 Width: 100px Height: 100px Size of file: Unknown (not cached) Alternate text: blank Anyone can help? On Aug 3, 1:52 pm, Dr. Tarique Sani [EMAIL PROTECTED] wrote: On Sun, Aug 3, 2008 at 10:28 AM, gapiangco [EMAIL PROTECTED] wrote: Took a second look and yeah JPEG and JPG are there. My bad. The example from the book was intended for downloading. What if from the example URL mysite.com/designs/view/$slug where: designs: controller view: action $slug: slug name of the design category And from that URL, a list of images available under that specified category will be displayed. Something like a gallery of images. How to use MediaView on such? Would be nice to have more examples on the cookbook :-( Well - step back for a while or step out, take a deep breath and think! Do you know how to accomplish the above withoutMediaView? If yes then all you need to do is replace the links to images with the new controller call it say protectedimages and action called show You will have to do a certain amount of programming in the show action which will ensure that the person currently logged can see unwatermarked image or not I presume you are missing the trick that the img src will contain a URL to a controller action and some param rather than the URL to the image itself. If you want to create conditional links to image itself then you will have to write your own helper. HTH Tarique -- = Cheesecake-Photoblog:http://cheesecake-photoblog.org PHP for E-Biz:http://sanisoft.com =- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cookies Being Reset
Hi there, I'm using the built in Cookies component to read, write and save my Cookies in my app. I declare my cookies in my app_controller.php in the beforeFilter method as follows: function beforeFilter(){ $this-Cookie-name = 'myCookie'; $this-Cookie-key = 'mykey'; $this-Cookie-domain = 'mydomain.com'; $this-Cookie-secure= false; $this-Cookie-path= '/md/prefs'; } In my Users controller - Login method I write my cookie values: function login() { //onSuccess of Login: $this-Cookie-write('uid', $user['User']['id'], false, '+1 day'); $this-Cookie-write('key',$user['User']['key'], false, '+1 day'); $this-flash('Logged in', '/users/home'); } I var_dump($this-Cookie) on the login method and everyting seems to be correct, the cookie is named 'myCookie' and the values are present. But, once I redirect to the '/users/home' page the cookie is reset to the default 'CakeCookie' and no values are present. Any ideas on why this would occur, when is the cookie really instantiated? Should I take the code out of the beforeFilter? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Finding Records in Other Model
I am trying to track which users have referred other users to signup for my site. I have the following models: class TellFriend extends AppModel { var $name = 'Tell Friends'; var $belongsTo = 'User'; var $hasMany = 'ReferEmail'; } class ReferEmail extends AppModel { var $name = 'Refer Email'; var $belongsTo = 'TellFriend'; } TellFriend contains the email that they tell a friend with. ReferEmail contains only the email address and the id back to the TellFriend as FKey. Finally, I have a controller that uses those models to try to find the relation between the refer emails and my Users: class ReferralsController extends AppController { var $name = 'Referrals'; var $uses = array('ReferEmail', 'User'); public function index() { $refers = array(); $allRefers = $this-ReferEmail-findAll(); foreach($allRefers as $row) { $refer = $this-User-findByEmail($row['ReferEmail']['email'], 'User.email'); if($refer) { $data = array($row['ReferEmail']['email'] = array($refer)); array_push($refers, $data); } } $this-set(compact('refers')); } } The way I'm searching for this relation seems all wrong, its not spitting back the right data, and I'm having a brain freeze, is there a way to do this better in Cake?! --~--~-~--~~~---~--~~ 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: Can't Get Validation to Work
I know this is mundane guys but whats up with this, it was a huge selling point for me when I was reading how it could work. Is there a resource that could outline the steps here? On Jul 4, 1:58 pm, mwcbrent [EMAIL PROTECTED] wrote: I seem to be having a problem withvalidation. Everything works great so far but when I have empty fields they still get saved. Model: class Girl extends AppModel { var $name = 'Girl'; var $validate = array( 'description' = array( 'rule' = array('minLength',1) ) ); } Controller: function admin_add() { if(!empty($this-data)) { if($this-Girl-save($this-data)) { $this-flash('Girl Has Been Saved.','/admin/girls'); } else { $this-flash(Epic Fail,/admin/girls); } } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Dynamic Routing
Tried to search around for a few things before I posted but couldn't find it. I'm looking to setup a system that will do rewrites, this is similar to myspace or other sites that allow you to setup a page and change the url to something personalized. So I'm looking for the functionality of the routing to change: www.mysite.com/user/232434 to www.mysite.com/user/myhomepage Is there a way to get the routing system to check the database? Or should i just not even use the routing system and query the db with 'myhomepage' instead of the user id passed in the url? Thanks for the feedback. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---