Routes, Rewrites such
Hi all, I'm trying to get my head round the best way to use the same CakePHP App code for multiple clients, the best way I can think of is to have a client identifier at the beginning of the path for the app, use rewrites/custom routes to facilitate this. So far I have added the following rule to the .htaccess file for the app, which extracts the client identifier out to a query string element... RewriteRule (test)(/.*) $2?client=$1 [QSA,N] ... but now I need to work out how to make sure the app adds this identifier back on to the beginning of any URL generated by Cake. Any clues on how I might do this? Not too hot with playing with routes yet. Thanks, T -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Re: Routes, Rewrites such
I managed to get this working in the end. I got rid of the Rewrite Rule added the following rules to get this working... Router::connect('/:cid', array( 'controller' = 'events', 'action' = 'index' ), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); Router::connect('/:cid/:controller', array( 'action' = 'index' ), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); Router::connect('/:cid/:controller/:action/*', array(), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); And it also took me a while before I realised that I also needed to add... Router::connectNamed(array('cid', 'event_id')); ... to get url generation working OK when the event_id parameter was included in the link. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. 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
Allowing access to plugin pages
Hi there, Just wondering how to grant access to a plugin page using Auth. Have tried using... $this-Auth-allow(array('*')); in the before filter for the controller app, which is being called, but it doesn't seem to make a difference. Any ideas? T Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 To unsubscribe, reply using remove me as the subject.
Help! Files being read from wrong directory
Hi there, Hope someone can help, as I've just spent the last 2.5 hrs trying to track down the cause of this problem, without any success. I have a cakePHP application happily running in it's own subdirectory on our shared hosting server, I have frequently used an alternative subdirectory to upload a test version of the app to ensure all is OK on the live server before I updated the live site. My problem is ( not sure if this occurred previously, as didn't receive this kind of error) that my site appears to be reading the controller files in from the wrong subdirectory. I'm not sure how this is happening, as there as I can't find any kind of hard coding of the directory anywhere. I have tried to read through the CakePHP code to try to diagnose the problem have got as far as the App::__mapped() function is returning the wrong path, which it gets from the App::__map property, however I can't, for the life of me, find where this is populated, so I'm at an apparent deadend. Please can someone help me with this? Thanks, T Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 To unsubscribe, reply using remove me as the subject.
Paginate not returning correct hasNext
I've implemented pagination on my bookings system, the paginator helper is not enabling the next button, despite there being further records on the following page. I have tracked the problem down to the following line in the controller.php core file, where it seems that it is returning the wrong value for $count... @ approx line 1070 controller.php $count = $object-find('count', array_merge($parameters, $extra)); For some reason it is returning 1, even though there are 3 records that match this search criteria. Here is the merged array array_merge($parameters, $extra) for reference... Array ( [conditions] = Array ( [Dj.user_id] = 1 ) [contain] = Array ( [0] = Dj [Event] = Array ( [0] = Night ) [Promoter] = Array ( [0] = User ) ) ) I even ran the SQL statement that this generates (copied from the debugging info at the bottom of the page)... SELECT COUNT(*) AS `count` FROM `bookings` AS `Booking` LEFT JOIN `djs` AS `Dj` ON (`Booking`.`dj_id` = `Dj`.`id`) WHERE `Dj`.`user_id` = 1 ... and it gave me the correct answer of 3, so why is cake returning 1? Please help! Toby Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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: Paginate not returning correct hasNext
Ignore me. My afterFind callback was changing the value! Only took me 2 hrs to track that one down! Doh! On Dec 3, 2:22 pm, TobyG goo...@toby-g.net wrote: I've implemented pagination on my bookings system, the paginator helper is not enabling the next button, despite there being further records on the following page. I have tracked the problem down to the following line in the controller.php core file, where it seems that it is returning the wrong value for $count... @ approx line 1070 controller.php $count = $object-find('count', array_merge($parameters, $extra)); For some reason it is returning 1, even though there are 3 records that match this search criteria. Here is the merged array array_merge($parameters, $extra) for reference... Array ( [conditions] = Array ( [Dj.user_id] = 1 ) [contain] = Array ( [0] = Dj [Event] = Array ( [0] = Night ) [Promoter] = Array ( [0] = User ) ) ) I even ran the SQL statement that this generates (copied from the debugging info at the bottom of the page)... SELECT COUNT(*) AS `count` FROM `bookings` AS `Booking` LEFT JOIN `djs` AS `Dj` ON (`Booking`.`dj_id` = `Dj`.`id`) WHERE `Dj`.`user_id` = 1 ... and it gave me the correct answer of 3, so why is cake returning 1? Please help! Toby Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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