Rewrite URLs with. Htaccess not working with cakephp 2.1
hello I need your aid I use. htaccess Rewrite to rewrite URLs with cakephp 1.xxx correment everything worked but now with cakephp 2.1 it does not work below the rating used here: RewriteEngine On RewriteCond% {REQUEST_FILENAME}!-D RewriteCond% {REQUEST_FILENAME}!-F RewriteRule ^ (. *) $ Index.php [QSA, L] Machine RewriteRule ^ (. *) $-Art.html / articles / index -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: 3.0: a peek into CakePHP's future
Finally. On Friday, July 6, 2012 8:19:30 AM UTC-5, Andy Gale wrote: > > On Fri, Jul 6, 2012 at 2:17 PM, Marsson C. > > wrote: > > > > Does it mean Cake 3.0´s Model will return objects instead of arrays ? > > Yes > > "Model layer rewrite: > > Models to return objects from queries" > > > -- > Andy Gale > http://andy-gale.com > http://twitter.com/andygale > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: While redirecting from http to https , session expired
Take a look at this: http://book.cakephp.org/2.0/en/development/sessions.html#session-configuration Jeremy Burns Class Outfit http://www.classoutfit.com On 29 Nov 2012, at 10:57, sagar shirsath wrote: > Hi , > I have implemented ssl on my local and on the server , the problem > that i am facing is redirection from http to https works fine on my local > machine , > but when i deploy it on the server and tried to redirect , the session > expires and again asking to loigin , please reply asap is anybody knows the > solution . > > Thanks in advance. > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial
My guess is there is a problem with the web.config and URL rewrites. The web.config files you have, don't quite look like the recommended web.config at http://book.cakephp.org/2.0/en/installation/advanced-installation.html Unfortunately, I've not played with CakePHP on IIS7 using this method of URL redirect. Actually, it could be a permissions issue. Visiting http://dev.ov-ervaringen.nl/index.php yields an error that looks like CakePHP is correctly determining the controller name (but this one doesn't exist). So if the PostsController was being found, it might not be executable/readable, due to permissions on that file. Regards Reuben Helms On Thursday, 29 November 2012 22:44:38 UTC+10, Jorick de Lange wrote: > > Hi everyone, > > So, I (we, actually) decided to create a website. Because of the need to > extend later on, we decided to use a framework. CakePHP looked very well to > fit our needs. Installed it, configured it, and after some .htacces import > to web.config files, it was functional! See http://dev.ov-ervaringen.nl/for > the default page of CakePHP. > > Happy as I was, I started to follow the blog tutorial. Created the desired > pages and I came to the point where you actualy can see the magic happen: I > browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, > back to the tutorial, to make sure I didn't make a typo. Nothing. > Everything seems fine. > > Now, I'm stuck. I don't have a clue where to search for the problem. > > Here are the files: > > in app/Controller/PostsController.php > >> class PostsController extends AppController { >> public $helpers = array('Html', 'Form'); >> >> public function index() { >> $this->set('posts', $this->Post->find('all')); >> } >> } > > > in app/Model/Post.php > >> class Post extends AppModel { >> } > > > in app/View/Posts/index.ctp > >> >> Blog posts >> >> >> Id >> Title >> Created >> >> >> >> >> >> >> > >> >> Html->link($post['Post']['title'], >> array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?> >> >> >> >> >> >> > > > And, my web.config files: > > in root: > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > > in app/ > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > > in app/webroot/ > >> >> >> >> >> >> >> >> >> >> >> > matchType="IsDirectory" ignoreCase="false" negate="true" /> >> > matchType="IsFile" ignoreCase="false" negate="true" /> >> >> > appendQueryString="true" /> >> >> >> >> >> > > > --- > > Is there anyone who is seeing the problem and has the solution to solve it? > > Thanks in advance, > > Jorick. > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
So, that error confirms my suspicion. PHP is trying to write the session to disk, but it can't write to /var/chroot/home/content/72/5132572/tmp. I'm not familiar with your hosted environment set up. If you could create that structure, and ensure the web server has permissions to write to it, then you should be fine. Otherwise, you'll need to work with your hosting company to set session.save_path to a directory that only you have access to, and that your web server can write to. This command: chmod -R 777 app/tmp/ , opens full permissions on your CakePHP temp directory, and all sub directories and files, to make sure that the web server (and another process on the machine) can write to them. This would fix possible permission errors with CakePHP writing cached files (model cache), or logs. Regards Reuben Helms On Friday, 30 November 2012 10:03:13 UTC+10, roundrightfarm wrote: > > from my core file > Configure::write('Session.save', 'php'); > > but in phpinfo() > session.save_path says "no value" > > this is the first warning to appear on all pages of my site, not just > the login > Warning (2): session_start() [function.session-start]: open(/var/ > chroot/home/content/72/5132572/tmp/sess_lt2tdtqr39hy7fgd95qnknj1l1, > O_RDWR) failed: No such file or directory (2) [APP/cake/libs/ > cake_session.php, line 589] > > what does this line suggested by Andras do? > chmod -R 777 app/tmp/ > > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Custom login
I'm not sure that I follow all of that but if you want to manually log a user in you can do it by passing the User.id: $this->Auth->login($user_id); Where $user_id is the User.id, or primary key of the row in the database. On Thu, Nov 29, 2012 at 8:43 AM, Jorge Guerra wrote: > Hi, I am a new member in this group and now I am developing a website and > I've got a trouble and I reckon I need a little of help for one task. > > I've got problems for creating a custom login with a temporal password, I > need to create a new password which it is temporal for accesing once and > after that this password will be delete. > > Now I am working working at the method login for generating the session. The > original method it is > http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in > > I added a elseif comparing the data with the temporal password but I do not > know how I can generating this session when the username and the password > it's the same according the database. > > That's the problem how could I generating the session of a user manually > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Throwing a custom 503 exception in CakePHP 2
The second suggestion calls for using require, instead of App::uses in your bootstrap.php, something like require ROOT . DS . APP . DS . 'Error' . DS . 'exceptions.php'; And just have exceptions.php in app/Error, mimicking/mirroring placement in lib/Cake/Error. You may need to double check if ROOT . DS . APP is the right combo of definitions to use. Regards Reuben Helms On Friday, 30 November 2012 10:00:18 UTC+10, mercury12 wrote: > > I tried your second suggestion. In "app/Lib/Error" I created > "exceptions.php" and put the "ServiceUnavailableException" class inside > this file. > > Then I wrote this into "bootstrap.php": > App::uses('exceptions', 'Lib/Error'); > > But I get the same error? > > On Friday, November 30, 2012 1:51:36 AM UTC+2, Reuben wrote: >> >> Looking at App::uses(), it expects the first parameter to be a classname, >> rather than a file name >> >> Perhaps doing App::uses('ServiceUnavailableException', 'Lib'), and >> renaming the file to ServiceUnavailableException.php might be better, and >> more in keeping with the convention of one class per file. >> >> When Cake bootstraps its own exceptions (in lib/Cake/bootstrap.php), it >> does a require CAKE . 'Error' . DS . 'exceptions.php'; You could possibly >> follow their lead, and bundle all your exceptions in >> app/Error/exceptions.php, then require that from your bootstrap. Then you >> wouldn't need to use App::uses() at all. >> >> On Friday, 30 November 2012 09:32:34 UTC+10, mercury12 wrote: >>> >>> Then I also put "App:uses()" inside bootstrap and inside controller >>> class. >>> But still I got the same error. >>> >>> >>> On Friday, November 30, 2012 1:29:20 AM UTC+2, Reuben wrote: You would probably need to have the App::uses() in your controller, rather than the bootstrap. I'm not sure what the best method of including the new exception type, from the bootstrap, other than a include_once() statement.. and that doesn't look nice. I've always been a bit lazy and have just included the class definition for the new exception directly in the bootstrap.php, and that's not particularly nice either. Regards Reuben Helms On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote: > > I need to give a *503 Service Unavailable* HTTP header. > > Normally I use these for 404 and 500 codes > > throw new NotFoundException();throw new InternalErrorException(); > > But I couldn't find relevant exception for 503 in CakePHP 2.2? > > In my "app/lib/AppExceptionHandler.php" file I have this > class/function that handles errors. > > class AppExceptionHandler { > public static function handle($error) { > } > > Edit: > >- > >Inside "*app/Lib*" folder I created a file named "*MyExceptions.php >*". I wrote the following code inside this file: > >class ServiceUnavailableException extends CakeException { >protected $_messageTemplate = 'Service is not available now'; >} > >- > >In "*bootstrap.php*" I wrote this: > >App::uses('MyExceptions', 'Lib'); >- > >Then inside "*MyNewController.php*" file I wrote this: > >throw new ServiceUnavailableException("tryout"); > > But then I get this error when I throw this exception: > > Fatal error: Class 'ServiceUnavailableException' not found in > /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php > on line 3560 > Warning (2): Cannot modify header information - headers already sent > by(output started at > /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, > line 19] > > What do I miss? Thank you > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: IIS 7, CakePHP 2.2.3 and the Blog Tutorial
Please define "Nothing" for us. Also, do you have debug set to 2? On Thu, Nov 29, 2012 at 7:44 AM, Jorick de Lange wrote: > Hi everyone, > > So, I (we, actually) decided to create a website. Because of the need to > extend later on, we decided to use a framework. CakePHP looked very well to > fit our needs. Installed it, configured it, and after some .htacces import > to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for > the default page of CakePHP. > > Happy as I was, I started to follow the blog tutorial. Created the desired > pages and I came to the point where you actualy can see the magic happen: I > browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back > to the tutorial, to make sure I didn't make a typo. Nothing. Everything > seems fine. > > Now, I'm stuck. I don't have a clue where to search for the problem. > > Here are the files: > > in app/Controller/PostsController.php >> >> class PostsController extends AppController { >> public $helpers = array('Html', 'Form'); >> >> public function index() { >> $this->set('posts', $this->Post->find('all')); >> } >> } > > > in app/Model/Post.php >> >> class Post extends AppModel { >> } > > > in app/View/Posts/index.ctp >> >> >> Blog posts >> >> >> Id >> Title >> Created >> >> >> >> >> >> >> > >> >> Html->link($post['Post']['title'], >> array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?> >> >> >> >> >> >> > > > And, my web.config files: > > in root: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > > in app/ >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > > > in app/webroot/ >> >> >> >> >> >> >> >> >> >> >> >> > matchType="IsDirectory" ignoreCase="false" negate="true" /> >> > ignoreCase="false" negate="true" /> >> >> > appendQueryString="true" /> >> >> >> >> >> > > > --- > > Is there anyone who is seeing the problem and has the solution to solve it? > > Thanks in advance, > > Jorick. > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
from my core file Configure::write('Session.save', 'php'); but in phpinfo() session.save_path says "no value" this is the first warning to appear on all pages of my site, not just the login Warning (2): session_start() [function.session-start]: open(/var/ chroot/home/content/72/5132572/tmp/sess_lt2tdtqr39hy7fgd95qnknj1l1, O_RDWR) failed: No such file or directory (2) [APP/cake/libs/ cake_session.php, line 589] what does this line suggested by Andras do? chmod -R 777 app/tmp/ -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Throwing a custom 503 exception in CakePHP 2
I tried your second suggestion. In "app/Lib/Error" I created "exceptions.php" and put the "ServiceUnavailableException" class inside this file. Then I wrote this into "bootstrap.php": App::uses('exceptions', 'Lib/Error'); But I get the same error? On Friday, November 30, 2012 1:51:36 AM UTC+2, Reuben wrote: > > Looking at App::uses(), it expects the first parameter to be a classname, > rather than a file name > > Perhaps doing App::uses('ServiceUnavailableException', 'Lib'), and > renaming the file to ServiceUnavailableException.php might be better, and > more in keeping with the convention of one class per file. > > When Cake bootstraps its own exceptions (in lib/Cake/bootstrap.php), it > does a require CAKE . 'Error' . DS . 'exceptions.php'; You could possibly > follow their lead, and bundle all your exceptions in > app/Error/exceptions.php, then require that from your bootstrap. Then you > wouldn't need to use App::uses() at all. > > On Friday, 30 November 2012 09:32:34 UTC+10, mercury12 wrote: >> >> Then I also put "App:uses()" inside bootstrap and inside controller class. >> But still I got the same error. >> >> >> On Friday, November 30, 2012 1:29:20 AM UTC+2, Reuben wrote: >>> >>> You would probably need to have the App::uses() in your controller, >>> rather than the bootstrap. >>> >>> I'm not sure what the best method of including the new exception type, >>> from the bootstrap, other than a include_once() statement.. and that >>> doesn't look nice. I've always been a bit lazy and have just included the >>> class definition for the new exception directly in the bootstrap.php, and >>> that's not particularly nice either. >>> >>> Regards >>> Reuben Helms >>> >>> On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote: I need to give a *503 Service Unavailable* HTTP header. Normally I use these for 404 and 500 codes throw new NotFoundException();throw new InternalErrorException(); But I couldn't find relevant exception for 503 in CakePHP 2.2? In my "app/lib/AppExceptionHandler.php" file I have this class/function that handles errors. class AppExceptionHandler { public static function handle($error) { } Edit: - Inside "*app/Lib*" folder I created a file named "*MyExceptions.php*". I wrote the following code inside this file: class ServiceUnavailableException extends CakeException { protected $_messageTemplate = 'Service is not available now'; } - In "*bootstrap.php*" I wrote this: App::uses('MyExceptions', 'Lib'); - Then inside "*MyNewController.php*" file I wrote this: throw new ServiceUnavailableException("tryout"); But then I get this error when I throw this exception: Fatal error: Class 'ServiceUnavailableException' not found in /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php on line 3560 Warning (2): Cannot modify header information - headers already sent by(output started at /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, line 19] What do I miss? Thank you >>> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Throwing a custom 503 exception in CakePHP 2
Looking at App::uses(), it expects the first parameter to be a classname, rather than a file name Perhaps doing App::uses('ServiceUnavailableException', 'Lib'), and renaming the file to ServiceUnavailableException.php might be better, and more in keeping with the convention of one class per file. When Cake bootstraps its own exceptions (in lib/Cake/bootstrap.php), it does a require CAKE . 'Error' . DS . 'exceptions.php'; You could possibly follow their lead, and bundle all your exceptions in app/Error/exceptions.php, then require that from your bootstrap. Then you wouldn't need to use App::uses() at all. On Friday, 30 November 2012 09:32:34 UTC+10, mercury12 wrote: > > Then I also put "App:uses()" inside bootstrap and inside controller class. > But still I got the same error. > > > On Friday, November 30, 2012 1:29:20 AM UTC+2, Reuben wrote: >> >> You would probably need to have the App::uses() in your controller, >> rather than the bootstrap. >> >> I'm not sure what the best method of including the new exception type, >> from the bootstrap, other than a include_once() statement.. and that >> doesn't look nice. I've always been a bit lazy and have just included the >> class definition for the new exception directly in the bootstrap.php, and >> that's not particularly nice either. >> >> Regards >> Reuben Helms >> >> On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote: >>> >>> I need to give a *503 Service Unavailable* HTTP header. >>> >>> Normally I use these for 404 and 500 codes >>> >>> throw new NotFoundException();throw new InternalErrorException(); >>> >>> But I couldn't find relevant exception for 503 in CakePHP 2.2? >>> >>> In my "app/lib/AppExceptionHandler.php" file I have this class/function >>> that handles errors. >>> >>> class AppExceptionHandler { >>> public static function handle($error) { >>> } >>> >>> Edit: >>> >>>- >>> >>>Inside "*app/Lib*" folder I created a file named "*MyExceptions.php*". >>>I wrote the following code inside this file: >>> >>>class ServiceUnavailableException extends CakeException { >>>protected $_messageTemplate = 'Service is not available now'; >>>} >>> >>>- >>> >>>In "*bootstrap.php*" I wrote this: >>> >>>App::uses('MyExceptions', 'Lib'); >>>- >>> >>>Then inside "*MyNewController.php*" file I wrote this: >>> >>>throw new ServiceUnavailableException("tryout"); >>> >>> But then I get this error when I throw this exception: >>> >>> Fatal error: Class 'ServiceUnavailableException' not found in >>> /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php >>> on line 3560 >>> Warning (2): Cannot modify header information - headers already sent >>> by(output started at >>> /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, >>> line 19] >>> >>> What do I miss? Thank you >>> >> -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: association between Models
If Group belongsTo a User then when you find the group, the user should be available in the ['User'] array. i.e. $note = $this->Group->read(null, $groupId); assertEquals(isset($note['Group']), true); assertEquals(isset($note['User']), true); On Friday, 30 November 2012 03:46:59 UTC+10, Chris wrote: > > > hi guys,... I can't find " GroupUser " association between Models > can anyone help please,...? > > I have a Notification Model: > > class Notification extends AppModel { > var $name = 'Notification'; > > var $validate = array( > 'user_id' => array( > 'rule' => 'notEmpty', > ), > 'friend_id' => array( > 'rule' => 'notEmpty', > ), > 'photo_id' => array( > 'rule' => 'notEmpty', > ), > 'group_id' => array( > 'rule' => 'notEmpty', > ), > 'blog_id' => array( > 'rule' => 'notEmpty', > ), > ); > var $belongsTo = array( > 'User' => array('className' => 'User', 'foreignKey'=> 'friend_id'), > 'Photo' => array('className' => 'Photo', 'foreignKey'=> 'photo_id'), > 'Group' => array('className' => 'Group', 'foreignKey'=> 'group_id'), > 'Blog' => array('className' => 'Blog', 'foreignKey'=> 'blog_id') > ); > > } > ?> > > and Group Model: > > > class Group extends AppModel { > var $name = 'Group'; > > var $validate = array( > 'user_id' => array( > 'rule' => 'notEmpty', > ), > 'name' => array( > 'rule' => 'notEmpty', > ), > 'description' => array( > 'rule' => 'notEmpty', > ), > ); > var $belongsTo = array( > 'User' => array('className' => 'User', 'foreignKey'=> 'user_id') > ); > > } > ?> > > finding Group is OK,... > link($groupBannerShow->square($note), '/groups/view/' . > $note['Group']['id'], array('escape'=>false)) ?> > > but I also need to find " GroupUser " in a view,... > > I'm getting error: Undefined index: GroupUser > > link($note['GroupUser']['firstname'] . ' ' . > $note['GroupUser']['lastname'], '/profile/' . > $note['GroupUser']['username']) ?> > > thanks in advance > chris > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Throwing a custom 503 exception in CakePHP 2
Then I also put "App:uses()" inside bootstrap and inside controller class. But still I got the same error. On Friday, November 30, 2012 1:29:20 AM UTC+2, Reuben wrote: > > You would probably need to have the App::uses() in your controller, rather > than the bootstrap. > > I'm not sure what the best method of including the new exception type, > from the bootstrap, other than a include_once() statement.. and that > doesn't look nice. I've always been a bit lazy and have just included the > class definition for the new exception directly in the bootstrap.php, and > that's not particularly nice either. > > Regards > Reuben Helms > > On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote: >> >> I need to give a *503 Service Unavailable* HTTP header. >> >> Normally I use these for 404 and 500 codes >> >> throw new NotFoundException();throw new InternalErrorException(); >> >> But I couldn't find relevant exception for 503 in CakePHP 2.2? >> >> In my "app/lib/AppExceptionHandler.php" file I have this class/function >> that handles errors. >> >> class AppExceptionHandler { >> public static function handle($error) { >> } >> >> Edit: >> >>- >> >>Inside "*app/Lib*" folder I created a file named "*MyExceptions.php*". >>I wrote the following code inside this file: >> >>class ServiceUnavailableException extends CakeException { >>protected $_messageTemplate = 'Service is not available now'; >>} >> >>- >> >>In "*bootstrap.php*" I wrote this: >> >>App::uses('MyExceptions', 'Lib'); >>- >> >>Then inside "*MyNewController.php*" file I wrote this: >> >>throw new ServiceUnavailableException("tryout"); >> >> But then I get this error when I throw this exception: >> >> Fatal error: Class 'ServiceUnavailableException' not found in >> /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php >> on line 3560 >> Warning (2): Cannot modify header information - headers already sent >> by(output started at >> /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, >> line 19] >> >> What do I miss? Thank you >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Throwing a custom 503 exception in CakePHP 2
You would probably need to have the App::uses() in your controller, rather than the bootstrap. I'm not sure what the best method of including the new exception type, from the bootstrap, other than a include_once() statement.. and that doesn't look nice. I've always been a bit lazy and have just included the class definition for the new exception directly in the bootstrap.php, and that's not particularly nice either. Regards Reuben Helms On Friday, 30 November 2012 09:20:30 UTC+10, mercury12 wrote: > > I need to give a *503 Service Unavailable* HTTP header. > > Normally I use these for 404 and 500 codes > > throw new NotFoundException();throw new InternalErrorException(); > > But I couldn't find relevant exception for 503 in CakePHP 2.2? > > In my "app/lib/AppExceptionHandler.php" file I have this class/function > that handles errors. > > class AppExceptionHandler { > public static function handle($error) { > } > > Edit: > >- > >Inside "*app/Lib*" folder I created a file named "*MyExceptions.php*". >I wrote the following code inside this file: > >class ServiceUnavailableException extends CakeException { >protected $_messageTemplate = 'Service is not available now'; >} > >- > >In "*bootstrap.php*" I wrote this: > >App::uses('MyExceptions', 'Lib'); >- > >Then inside "*MyNewController.php*" file I wrote this: > >throw new ServiceUnavailableException("tryout"); > > But then I get this error when I throw this exception: > > Fatal error: Class 'ServiceUnavailableException' not found in > /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php > on line 3560 > Warning (2): Cannot modify header information - headers already sent > by(output started at > /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, > line 19] > > What do I miss? Thank you > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Problem with Elements
Hi Franklin If the model that you authenticate against is the Person model, then you should be able to get away with public function index() { $this->set('people', $this->Auth->user(); } Since Auth->user() should return the whole model. Though you might want to double check with a bit of debug (DebugKit, or CakeLog::debug($this->Auth->user()) or errorLog(print_r($this->Auth->user(), true)); Alternatively, there's: public function index() { $person = $this->Person->read(null, $this->Auth->user('id')); $this->set('people', $person); } Once small niggle on readability. Setting 'people' implies that there are might be multiple people in the variable. If there's only ever going to be the one person, I would set('person') instead (i.e. $this->set(compact('person'));) , or put the $person into an array, so you can have a foreach in your index (i.e. $this->set('people', array($person)); ) Regards Reuben Helms On Friday, 30 November 2012 08:10:59 UTC+10, Franklin Piercing wrote: > > Hi, this is what i´m trying to do, i have this index.ctp view where i show > some information about the logged user (such as name, mail, etc).. but in > the Users table there´s a field called info that the user can update, the > thing is that, in my index fuction in my Users´s controller i have this > > public function index() { > $this->Person->id = $this->Session->read('Auth.User.id'); > $this->set('people', $this->Person->read()); > } > > it shows the info perfect, so, in my index view i have a little section > with a textfield where the user can update this "info" field, so the thing > is that i'm trying to create this form in an element and include it into my > index view, i have my controller's action called update_info with the logic > to do so.. but it doesn´t works, i don´t know why, anybody canhelp me with > this or maybe give me ideas about other ways to do it??? > > thanx a lot! > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Throwing a custom 503 exception in CakePHP 2
I need to give a *503 Service Unavailable* HTTP header. Normally I use these for 404 and 500 codes throw new NotFoundException();throw new InternalErrorException(); But I couldn't find relevant exception for 503 in CakePHP 2.2? In my "app/lib/AppExceptionHandler.php" file I have this class/function that handles errors. class AppExceptionHandler { public static function handle($error) { } Edit: - Inside "*app/Lib*" folder I created a file named "*MyExceptions.php*". I wrote the following code inside this file: class ServiceUnavailableException extends CakeException { protected $_messageTemplate = 'Service is not available now'; } - In "*bootstrap.php*" I wrote this: App::uses('MyExceptions', 'Lib'); - Then inside "*MyNewController.php*" file I wrote this: throw new ServiceUnavailableException("tryout"); But then I get this error when I throw this exception: Fatal error: Class 'ServiceUnavailableException' not found in /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php on line 3560 Warning (2): Cannot modify header information - headers already sent by(output started at /var/www/vhosts/example.com/httpdocs/app/Controller/MyNewController.php:3560)[APP/Lib/AppExceptionHandler.php, line 19] What do I miss? Thank you -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Printing to file from web controller, and from shell batch
And I forgot to mention, that is done within the Controller action, and can probably be safely migrated to a Shell or Task, when I get around to that bit. On Friday, 30 November 2012 09:12:08 UTC+10, Reuben wrote: > > My current hair brained scheme is to do the following: > > $view = new View(); > $data = $this->MyModel->getForPrint($id); > $view->element('MyModel/print', array('print' => $data, 'fileName' => > $fileName)); > /* continue processing */ > > Unfortunately, I've still got quite a way to go before I can test that > this will work, so if there are any better suggestions, please let me know. > > One thing to note is that this may not be appropriate for a class element > where output is expected to be returned from the $view->element call. > However, since the element is calling the FPDF library, and it is taking > care of writing the file to disk, it may work in this case. > > Regards > Reuben Helms > > On Friday, 30 November 2012 08:40:30 UTC+10, Reuben wrote: >> >> I have some functionality that I'm currently migrating from CodeIgniter >> 1.7.3 to CakePHP 2.2.3, and I'm wondering how best to tackle a particular >> scenario. >> >> The currently functionality that I'm migrating reads data from the >> database, and will generate a PDF file via FPDF. >> >> Currently, I have a controller that will give an option to print to >> screen, or print to file. In both cases, the controller action will access >> the model to get the information it needs for printing, and then will call >> render('print') to generate the PDF. The printToFile action will pass a >> file name which will indicate to FPDF to output to a file, rather than >> stream to the browser. >> >> The print view calls an element, passing the data and filename, to >> actually generate the PDF. >> >> Now, I have a different controller, that will probably be migrated to a >> shell or task (since it is run from the command line), that wants to call >> the print to file functionality, but I'm not sure how to arrange it. I've >> generally felt that one controller calling the functionality of another >> controller is bad form, so I'm looking for ideas. One possibility is to >> call the element functionality directly, from the controller(/shell/task), >> but that may not be such a good idea, either. >> >> In CodeIgniter, I had a library function that I would call from the >> controller that would use FPDF directly. >> >> Can any give me some pointers on calling View functionality repeated from >> a batch (whether it be from a Controller, as it is at the moment, or a >> Shell/Task, as it may end up getting migrated to)? Keeping in mind that >> PDF generation is not the only thing that the batch files does, so control >> needs to be passed back to the batch file at some point, to keep processing. >> >> Regards >> Reuben Helms >> > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Printing to file from web controller, and from shell batch
My current hair brained scheme is to do the following: $view = new View(); $data = $this->MyModel->getForPrint($id); $view->element('MyModel/print', array('print' => $data, 'fileName' => $fileName)); /* continue processing */ Unfortunately, I've still got quite a way to go before I can test that this will work, so if there are any better suggestions, please let me know. One thing to note is that this may not be appropriate for a class element where output is expected to be returned from the $view->element call. However, since the element is calling the FPDF library, and it is taking care of writing the file to disk, it may work in this case. Regards Reuben Helms On Friday, 30 November 2012 08:40:30 UTC+10, Reuben wrote: > > I have some functionality that I'm currently migrating from CodeIgniter > 1.7.3 to CakePHP 2.2.3, and I'm wondering how best to tackle a particular > scenario. > > The currently functionality that I'm migrating reads data from the > database, and will generate a PDF file via FPDF. > > Currently, I have a controller that will give an option to print to > screen, or print to file. In both cases, the controller action will access > the model to get the information it needs for printing, and then will call > render('print') to generate the PDF. The printToFile action will pass a > file name which will indicate to FPDF to output to a file, rather than > stream to the browser. > > The print view calls an element, passing the data and filename, to > actually generate the PDF. > > Now, I have a different controller, that will probably be migrated to a > shell or task (since it is run from the command line), that wants to call > the print to file functionality, but I'm not sure how to arrange it. I've > generally felt that one controller calling the functionality of another > controller is bad form, so I'm looking for ideas. One possibility is to > call the element functionality directly, from the controller(/shell/task), > but that may not be such a good idea, either. > > In CodeIgniter, I had a library function that I would call from the > controller that would use FPDF directly. > > Can any give me some pointers on calling View functionality repeated from > a batch (whether it be from a Controller, as it is at the moment, or a > Shell/Task, as it may end up getting migrated to)? Keeping in mind that > PDF generation is not the only thing that the batch files does, so control > needs to be passed back to the batch file at some point, to keep processing. > > Regards > Reuben Helms > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Problem with Elements
Hi, this is what i´m trying to do, i have this index.ctp view where i show some information about the logged user (such as name, mail, etc).. but in the Users table there´s a field called info that the user can update, the thing is that, in my index fuction in my Users´s controller i have this public function index() { $this->Person->id = $this->Session->read('Auth.User.id'); $this->set('people', $this->Person->read()); } it shows the info perfect, so, in my index view i have a little section with a textfield where the user can update this "info" field, so the thing is that i'm trying to create this form in an element and include it into my index view, i have my controller's action called update_info with the logic to do so.. but it doesn´t works, i don´t know why, anybody canhelp me with this or maybe give me ideas about other ways to do it??? thanx a lot! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Please send Links for tutorials of Restful via cakephp
I did not understand about http://book.cakephp.org/2.0/en/development/rest.html. I would like to learn restful via cakephp. Thz you. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
IIS 7, CakePHP 2.2.3 and the Blog Tutorial
Hi everyone, So, I (we, actually) decided to create a website. Because of the need to extend later on, we decided to use a framework. CakePHP looked very well to fit our needs. Installed it, configured it, and after some .htacces import to web.config files, it was functional! See http://dev.ov-ervaringen.nl/ for the default page of CakePHP. Happy as I was, I started to follow the blog tutorial. Created the desired pages and I came to the point where you actualy can see the magic happen: I browsed to http://dev.ov-ervaringen.nl/posts/index/ and... Nothing. OK, back to the tutorial, to make sure I didn't make a typo. Nothing. Everything seems fine. Now, I'm stuck. I don't have a clue where to search for the problem. Here are the files: in app/Controller/PostsController.php > class PostsController extends AppController { > public $helpers = array('Html', 'Form'); > > public function index() { > $this->set('posts', $this->Post->find('all')); > } > } in app/Model/Post.php > class Post extends AppModel { > } in app/View/Posts/index.ctp > > Blog posts > > > Id > Title > Created > > > > > > > > > > Html->link($post['Post']['title'], > array('controller' => 'posts', 'action' => 'view', $post['post']['id'])); ?> > > > > > > And, my web.config files: in root: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > in app/ > > > > > > > > > > > > > > > > > > > > in app/webroot/ > > > > > > > > > > > matchType="IsDirectory" ignoreCase="false" negate="true" /> > ignoreCase="false" negate="true" /> > > appendQueryString="true" /> > > > > > --- Is there anyone who is seeing the problem and has the solution to solve it? Thanks in advance, Jorick. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Custom login
Hi, I am a new member in this group and now I am developing a website and I've got a trouble and I reckon I need a little of help for one task. I've got problems for creating a custom login with a temporal password, I need to create a new password which it is temporal for accesing once and after that this password will be delete. Now I am working working at the method login for generating the session. The original method it is http://book.cakephp.org/2.0/en/core-libraries/components/authentication.html#identifying-users-and-logging-them-in I added a elseif comparing the data with the temporal password but I do not know how I can generating this session when the username and the password it's the same according the database. That's the problem how could I generating the session of a user manually -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
While redirecting from http to https , session expired
Hi , I have implemented ssl on my local and on the server , the problem that i am facing is redirection from http to https works fine on my local machine , but when i deploy it on the server and tried to redirect , the session expires and again asking to loigin , please reply asap is anybody knows the solution . Thanks in advance. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
If this happens when you try the login action, it means something is getting echo'd to the stream before the Auth component has had a chance to start the session. Check app/tmp/logs/debug.log and error.log, and perhaps even the PHP log file, if you have one getting generated. There might something like a permissions error, where it can't write to a file that it needs to, so echo's an error, but this messes with session generation. Regards Reuben Helms On Friday, 30 November 2012 08:54:51 UTC+10, roundrightfarm wrote: > > when I set debug to 2, I get warnings related to session_start() and > session_write_close() and warnings that it "Cannot modify header > information - headers already sent" > > > > On Nov 29, 4:10 pm, Andras Kende wrote: > > I would check these first : > > > > app/config/core.phpchange to Configure::write('debug', 2); too see > if any error messages showing up… > > > > chmod -R 777 app/tmp/ > > > > could be that your site is older cakephp core their server is newer php… > might need to update cake core… > > > > Andras Kendehttp://www.kende.com > > > > On Nov 29, 2012, at 12:43 PM, roundrightfarm > wrote: > > > > > > > > > > > > > > > > > Greetings, I am a cake newbie. My Cakephp site had worked fine for 3 > > > years on a single server, except for rare (once every 3-6 months) > > > occurances of prolonged (3 -24 hrs) 500 Internal Server Errors when I > > > tried to run scripts that accessed the database. Static pages on the > > > site have always worked fine. > > > > > When I would call my hosting company regarding these 500 errors I was > > > never able to get a definite answer as to why they were occuring, but > > > one tech support guy suggested that it could simply be memory issues, > > > and since that I was on an older type server, I should switch to a > > > newer server cluster and the 500 errors may stop happening. > > > > > I had them switch me to the new server type and now I am unable to use > > > the login portions of my website. All static pages still load fine. > > > when I try to login, no error appears, but it simply redisplays the > > > same login screen with the password erased. My hosting company has > > > looked at it and can find anything wrong on their end and are > > > insisting it is a scripting issue. However, it seems like a server > > > issue to me, since I didn't change any code and it stopped working on > > > the newer server. They suggest the only thing that might need changing > > > in the scripting due to the new server is the absolute path to my site > > > on the shared server. > > > > > If this is the case, what cake file do I change the absolute path in? > > > Any insights into other cake files that may need to be looked at? I > > > did have a similar issue a couple years ago when the server was > > > maintained and/or upgraded and adding > > > > > #Options +Includes > > > Options -Multiviews > > > > > to the .htaccess file fixed the problem. However, I have tried a > > > couple modifications of this file and have tried renaming it to > > > "erase" it, but the problem persists unchanged. > > > > > Thanks for your help > > > > > -- > > > Like Us on FaceBookhttps://www.facebook.com/CakePHP > > > Find us on Twitterhttp://twitter.com/CakePHP > > > > > --- > > > You received this message because you are subscribed to the Google > Groups "CakePHP" group. > > > To post to this group, send email to > > > cake...@googlegroups.com. > > > > To unsubscribe from this group, send email to > cake-php+u...@googlegroups.com . > > > Visit this group athttp://groups.google.com/group/cake-php?hl=en. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
when I set debug to 2, I get warnings related to session_start() and session_write_close() and warnings that it "Cannot modify header information - headers already sent" On Nov 29, 4:10 pm, Andras Kende wrote: > I would check these first : > > app/config/core.php change to Configure::write('debug', 2); too see if any > error messages showing up… > > chmod -R 777 app/tmp/ > > could be that your site is older cakephp core their server is newer php… > might need to update cake core… > > Andras Kendehttp://www.kende.com > > On Nov 29, 2012, at 12:43 PM, roundrightfarm wrote: > > > > > > > > > Greetings, I am a cake newbie. My Cakephp site had worked fine for 3 > > years on a single server, except for rare (once every 3-6 months) > > occurances of prolonged (3 -24 hrs) 500 Internal Server Errors when I > > tried to run scripts that accessed the database. Static pages on the > > site have always worked fine. > > > When I would call my hosting company regarding these 500 errors I was > > never able to get a definite answer as to why they were occuring, but > > one tech support guy suggested that it could simply be memory issues, > > and since that I was on an older type server, I should switch to a > > newer server cluster and the 500 errors may stop happening. > > > I had them switch me to the new server type and now I am unable to use > > the login portions of my website. All static pages still load fine. > > when I try to login, no error appears, but it simply redisplays the > > same login screen with the password erased. My hosting company has > > looked at it and can find anything wrong on their end and are > > insisting it is a scripting issue. However, it seems like a server > > issue to me, since I didn't change any code and it stopped working on > > the newer server. They suggest the only thing that might need changing > > in the scripting due to the new server is the absolute path to my site > > on the shared server. > > > If this is the case, what cake file do I change the absolute path in? > > Any insights into other cake files that may need to be looked at? I > > did have a similar issue a couple years ago when the server was > > maintained and/or upgraded and adding > > > #Options +Includes > > Options -Multiviews > > > to the .htaccess file fixed the problem. However, I have tried a > > couple modifications of this file and have tried renaming it to > > "erase" it, but the problem persists unchanged. > > > Thanks for your help > > > -- > > Like Us on FaceBookhttps://www.facebook.com/CakePHP > > Find us on Twitterhttp://twitter.com/CakePHP > > > --- > > 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. > > Visit this group athttp://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
What type of session storage does your installation use? Out of the box functionality is to write session to file, however, if your server process doesn't have permissions to write to the sessions directory, then that would stop you logging in. Look at config/core.php to determine what type of sessions you are using, and if it's PHP, look at phpinfo() to work out where session data is being written to. You probably don't want this written to /tmp, as it could conflict with other sessions on the shared machine. See if you can get it changed to something like app/tmp/sessions, so you're the only one writing to that directory. And as Andras mentioned, setting debug to 2 may help, showing errors on the screen. Regards Reuben Helms On Friday, 30 November 2012 06:43:00 UTC+10, roundrightfarm wrote: > > Greetings, I am a cake newbie. My Cakephp site had worked fine for 3 > years on a single server, except for rare (once every 3-6 months) > occurances of prolonged (3 -24 hrs) 500 Internal Server Errors when I > tried to run scripts that accessed the database. Static pages on the > site have always worked fine. > > When I would call my hosting company regarding these 500 errors I was > never able to get a definite answer as to why they were occuring, but > one tech support guy suggested that it could simply be memory issues, > and since that I was on an older type server, I should switch to a > newer server cluster and the 500 errors may stop happening. > > I had them switch me to the new server type and now I am unable to use > the login portions of my website. All static pages still load fine. > when I try to login, no error appears, but it simply redisplays the > same login screen with the password erased. My hosting company has > looked at it and can find anything wrong on their end and are > insisting it is a scripting issue. However, it seems like a server > issue to me, since I didn't change any code and it stopped working on > the newer server. They suggest the only thing that might need changing > in the scripting due to the new server is the absolute path to my site > on the shared server. > > If this is the case, what cake file do I change the absolute path in? > Any insights into other cake files that may need to be looked at? I > did have a similar issue a couple years ago when the server was > maintained and/or upgraded and adding > > #Options +Includes > Options -Multiviews > > to the .htaccess file fixed the problem. However, I have tried a > couple modifications of this file and have tried renaming it to > "erase" it, but the problem persists unchanged. > > Thanks for your help > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Printing to file from web controller, and from shell batch
I have some functionality that I'm currently migrating from CodeIgniter 1.7.3 to CakePHP 2.2.3, and I'm wondering how best to tackle a particular scenario. The currently functionality that I'm migrating reads data from the database, and will generate a PDF file via FPDF. Currently, I have a controller that will give an option to print to screen, or print to file. In both cases, the controller action will access the model to get the information it needs for printing, and then will call render('print') to generate the PDF. The printToFile action will pass a file name which will indicate to FPDF to output to a file, rather than stream to the browser. The print view calls an element, passing the data and filename, to actually generate the PDF. Now, I have a different controller, that will probably be migrated to a shell or task (since it is run from the command line), that wants to call the print to file functionality, but I'm not sure how to arrange it. I've generally felt that one controller calling the functionality of another controller is bad form, so I'm looking for ideas. One possibility is to call the element functionality directly, from the controller(/shell/task), but that may not be such a good idea, either. In CodeIgniter, I had a library function that I would call from the controller that would use FPDF directly. Can any give me some pointers on calling View functionality repeated from a batch (whether it be from a Controller, as it is at the moment, or a Shell/Task, as it may end up getting migrated to)? Keeping in mind that PDF generation is not the only thing that the batch files does, so control needs to be passed back to the batch file at some point, to keep processing. Regards Reuben Helms -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: portal to server cluster problem
I would check these first : app/config/core.phpchange to Configure::write('debug', 2); too see if any error messages showing up… chmod -R 777 app/tmp/ could be that your site is older cakephp core their server is newer php… might need to update cake core… Andras Kende http://www.kende.com On Nov 29, 2012, at 12:43 PM, roundrightfarm wrote: > Greetings, I am a cake newbie. My Cakephp site had worked fine for 3 > years on a single server, except for rare (once every 3-6 months) > occurances of prolonged (3 -24 hrs) 500 Internal Server Errors when I > tried to run scripts that accessed the database. Static pages on the > site have always worked fine. > > When I would call my hosting company regarding these 500 errors I was > never able to get a definite answer as to why they were occuring, but > one tech support guy suggested that it could simply be memory issues, > and since that I was on an older type server, I should switch to a > newer server cluster and the 500 errors may stop happening. > > I had them switch me to the new server type and now I am unable to use > the login portions of my website. All static pages still load fine. > when I try to login, no error appears, but it simply redisplays the > same login screen with the password erased. My hosting company has > looked at it and can find anything wrong on their end and are > insisting it is a scripting issue. However, it seems like a server > issue to me, since I didn't change any code and it stopped working on > the newer server. They suggest the only thing that might need changing > in the scripting due to the new server is the absolute path to my site > on the shared server. > > If this is the case, what cake file do I change the absolute path in? > Any insights into other cake files that may need to be looked at? I > did have a similar issue a couple years ago when the server was > maintained and/or upgraded and adding > > #Options +Includes > Options -Multiviews > > to the .htaccess file fixed the problem. However, I have tried a > couple modifications of this file and have tried renaming it to > "erase" it, but the problem persists unchanged. > > Thanks for your help > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
portal to server cluster problem
Greetings, I am a cake newbie. My Cakephp site had worked fine for 3 years on a single server, except for rare (once every 3-6 months) occurances of prolonged (3 -24 hrs) 500 Internal Server Errors when I tried to run scripts that accessed the database. Static pages on the site have always worked fine. When I would call my hosting company regarding these 500 errors I was never able to get a definite answer as to why they were occuring, but one tech support guy suggested that it could simply be memory issues, and since that I was on an older type server, I should switch to a newer server cluster and the 500 errors may stop happening. I had them switch me to the new server type and now I am unable to use the login portions of my website. All static pages still load fine. when I try to login, no error appears, but it simply redisplays the same login screen with the password erased. My hosting company has looked at it and can find anything wrong on their end and are insisting it is a scripting issue. However, it seems like a server issue to me, since I didn't change any code and it stopped working on the newer server. They suggest the only thing that might need changing in the scripting due to the new server is the absolute path to my site on the shared server. If this is the case, what cake file do I change the absolute path in? Any insights into other cake files that may need to be looked at? I did have a similar issue a couple years ago when the server was maintained and/or upgraded and adding #Options +Includes Options -Multiviews to the .htaccess file fixed the problem. However, I have tried a couple modifications of this file and have tried renaming it to "erase" it, but the problem persists unchanged. Thanks for your help -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Using jQuery.ajax - Sending non-forms values to server
Hi Miles You are the man. I have been pulling my hair over this, wanting to send parameters to my jquery calls without using some temporary form. I am so happy today. Thank you, thank you and thank you. -Sri Adhi On Wednesday, April 22, 2009 5:17:58 PM UTC-4, Miles J wrote: > > You have to send it within a data array like so: > > jQuery.ajax({ > type: "POST", > url: '/controller/action', > data: "data[Model][name]=value&data[name]=value" > }); > > And in the controller: > > $this->data['Model']['name'] OR > $this->data['name'] -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Including an External Library file that has functions that aren't in a class?
That's certainly one way. But what is the purpose of the app/libs though? I am wondering if we can create a custom library and load/cache it instead of calling it in every controller. -Sri Adhi -- View this message in context: http://cakephp.1045679.n5.nabble.com/Including-an-External-Library-file-that-has-functions-that-aren-t-in-a-class-tp1331401p5712502.html Sent from the CakePHP mailing list archive at Nabble.com. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Including an External Library file that has functions that aren't in a class?
Might it be better to create a component? You could have AppController load it so that it's always available. On Wed, Nov 28, 2012 at 10:20 PM, bluesclues9 wrote: > Hi > I ran into a similar situation in which I need to write up my own functions > that are to be used in multiple views(jquery calls). For example: I need to > check existence of a file in my file library and I need to do this in > multiple controllers. > > I am thinking of writing commonly used functions in a php file and use them > in jquery calls. > > Would you let me know how I do that? > > I tried creating a php file called myutil.php and kept it under /app/libs > folder. > I have also added this in app_controller.php as App::Import('Lib', > 'myutil'); > > However, when I made a call to this, I was getting errors like > myutil.phpController does not exist under app/controllers. > > Where am I going wrong with this? > > -Sri Adhi > > > > > -- > View this message in context: > http://cakephp.1045679.n5.nabble.com/Including-an-External-Library-file-that-has-functions-that-aren-t-in-a-class-tp1331401p5712490.html > Sent from the CakePHP mailing list archive at Nabble.com. > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
association between Models
hi guys,... I can't find " GroupUser " association between Models can anyone help please,...? I have a Notification Model: array( 'rule' => 'notEmpty', ), 'friend_id' => array( 'rule' => 'notEmpty', ), 'photo_id' => array( 'rule' => 'notEmpty', ), 'group_id' => array( 'rule' => 'notEmpty', ), 'blog_id' => array( 'rule' => 'notEmpty', ), ); var $belongsTo = array( 'User' => array('className' => 'User', 'foreignKey'=> 'friend_id'), 'Photo' => array('className' => 'Photo', 'foreignKey'=> 'photo_id'), 'Group' => array('className' => 'Group', 'foreignKey'=> 'group_id'), 'Blog' => array('className' => 'Blog', 'foreignKey'=> 'blog_id') ); } ?> and Group Model: array( 'rule' => 'notEmpty', ), 'name' => array( 'rule' => 'notEmpty', ), 'description' => array( 'rule' => 'notEmpty', ), ); var $belongsTo = array( 'User' => array('className' => 'User', 'foreignKey'=> 'user_id') ); } ?> finding Group is OK,... link($groupBannerShow->square($note), '/groups/view/' . $note['Group']['id'], array('escape'=>false)) ?> but I also need to find " GroupUser " in a view,... I'm getting error: Undefined index: GroupUser link($note['GroupUser']['firstname'] . ' ' . $note['GroupUser']['lastname'], '/profile/' . $note['GroupUser']['username']) ?> thanks in advance chris -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: autopopulating fields
What I usually do, is that when I choose an item to view - in your case, the kanji - I store the chosen id in the session. Then any other action I can do from the View page that concerns the current kanji, just grabs the id from the session. No need to use a hidden field, that a user migth change in the browser. The id is removed from the session, when I return to the list. Enjoy, John On Tuesday, 27 November 2012 10:29:04 UTC+2, Jeff Smith wrote: > > I am working on a site to help me (and hopefully others) learn Japanese > kanjis. The site is located at http://galacticcartel/kanjis (temporary > url). > > I want to make it so when I am viewing a kanji (example > http://www.galacticcartel.com/kanjis/view/1) and I click New example I > would like the kanji field to auto populate with the correct id (which I > would hide). > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: how to implement Smarty 3?
Il giorno sabato 17 novembre 2012 15:21:56 UTC+1, Martin Aguilar ha scritto: > > For years I've been working on my own framework but now I wan't to migrate > to cakephp. > On my framework I used smarty for themes and to separate code from views. > I always find smarty clean, nice and with a very good performance. > Now I want to use it on cake but I found people saying that it has no > purpose. > And couldn't find a good article about implementing it. The only thing > that I found it's for cake 1.3 and smarty 2 and the article it's damage. > > http://bakery.cakephp.org/articles/tclineks/2006/10/27/how-to-use-smarty-with-cake-smartyviewOn > point 4, I see a lot of unreadable symbols. > > Any help on implementing smarty 3 on cake 2? > What it's your opinion onimplementing smarty or any other template system? > > Hi martin, when i use smarty inside cake i use a simple vendor layer that wrap smarty where i can set/manage variables Set autorender to false and use smarty as usual -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Completely Stuck trying to list names of Contacts class
I assume you want to populate a field called 'contact_id' in your clients table? If so... Your Client model should have a belongsTo association with the Contact model: var $belongsTo = array( 'Contact' ); In the add (and also edit) action of your clients_controller: $contacts = $this->Client->Contact->find('list'); // note that it's daisy chaining the models along the associations Note: if the contacts table contains a field called 'client_id' so that each contact can only belong to one client, you'll also need to link the Contact model with the Client model: var $belongsTo = array( 'Client' ); Then you'll also need to add a constraint to your find so that you only brings back contacts for 'this' client: $contacts = $this->Client->Contact->find( 'list', array( 'conditions' => array( 'Contact.client_id' => $clientId // where $clientId is 'this' client ) ) ); the $contacts variable is now an array populated with the matching contacts with two keys; 'id' => 'name'/'title' depending on what you've called it. At the end of the add/edit action make sure you are sending the $contacts variable through to the view: $this->set('contacts, $contacts); This will make the $contacts variable available in the view. If you have more than one variable to pass through you can either repeat the set command for each, or do this (which is preferable): $this->set(compact( 'contacts', 'otherVariable', 'etc' )); This will hunt for variables called $contacts, $otherVariable and so on and make view variables from them if they exist. In your form, have an input called 'Client.contact_id'. The Cake form helper will automatically look for a variable called $contacts (it's knocked off the '_id' and looked for a variable that matches the plural). If it finds one it will by default render the input as a select list populated with your list of contacts. Also by default it will select the first option. To stop it doing that, do this: echo $this->Form->input('Client.contact_id', array('empty' => true)); Hope that gets you started. On 28 Nov 2012, at 20:22, Andrew Cook wrote: > I just don't even kind of understand how to access my data.. I went through > the blog tutorial and that was all fine, but for my application all I'm > wanting to do is this: > > I want to create a new Client via a form, which I've created.. in a dropdown > list box I want to list all of the names in the Contact table I can't > figure out how to do it at all... I am just not getting how things are > related I guess.. > > > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > 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. > Visit this group at http://groups.google.com/group/cake-php?hl=en. > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.