cakephp

Render View from AppExceptionHandler

时光怂恿深爱的人放手 提交于 2020-01-13 03:44:09
问题 I'm working with CakePHP 2.0 and want to handle a ForbiddenException. I've followed the example explained at the CakePHP Cookbook. My exception is now caught at the AppExceptionHandler but I don't know how to move from here. I want to render a relevant View but $this is not available. Does anyone have a starting point for me? Edit: My code so far is identical to the Cookbook example: In app/Config/core.php Configure::write('Exception.handler', 'AppExceptionHandler::handle'); In app/Config

Hosting CakePHP app with Amazon Web Services (EC2, etc.)?

心已入冬 提交于 2020-01-13 03:02:38
问题 I don't think I fully understand Amazon Web Services yet, which is why I'm asking this question. I want to know if AWS would be a nice host for a CakePHP application that of course runs off PHP, and MySQL? Would I have to change or add anything to my code if used a service like EC2? I also noticed that Amazon has it's own database system, does that mean no mysql. Also as a side question, what do you guys think of the cost AWS? Sorry if my question is a little scattered, or somewhat "noobish,"

CakePHP passing arguments in Controller::redirect

自古美人都是妖i 提交于 2020-01-12 09:09:59
问题 In controller actions to make redirect I use this: $this->redirect(array('controller' => 'tools', 'action' => 'index')); or this $this->redirect('/tools/index'); And when I pass data with redirect I use this: $this->redirect('tools/index/?myArgument=12'); But I couldn't find how to pass "myargument" by "this-redirect-array" notation. I don't want to use this because some routing issues: $this->redirect(array('controller' => 'tools', 'action' => 'index', "myArgument")); I need something like

CakePHP passing arguments in Controller::redirect

有些话、适合烂在心里 提交于 2020-01-12 09:09:05
问题 In controller actions to make redirect I use this: $this->redirect(array('controller' => 'tools', 'action' => 'index')); or this $this->redirect('/tools/index'); And when I pass data with redirect I use this: $this->redirect('tools/index/?myArgument=12'); But I couldn't find how to pass "myargument" by "this-redirect-array" notation. I don't want to use this because some routing issues: $this->redirect(array('controller' => 'tools', 'action' => 'index', "myArgument")); I need something like

Migrating from Cake 1.3 to 2.0 and beyond - migrate existing, or only use for new?

耗尽温柔 提交于 2020-01-12 06:59:33
问题 I'm nearling completion of my first CakePHP-driven website and just saw they're already working on CakePHP 2.0 (not the stable release yet). My questions: Is it incredibly time consuming to move to a new version of CakePHP (when it becomes the "stable" release that is)? I know they have migration guides, but - I've never used a framework before, so I've never had to migrate anything. Do you migrate your code for existing projects, or leave it as is and use the new stable version for future

cakephp 2 CakeEmail Could not send email error

删除回忆录丶 提交于 2020-01-11 13:32:12
问题 I am trying to get CakeEmail working and I am getting a "Could not send email" Internal Error. The last line of the stack trace is CORE/Cake/Network/Email/MailTransport.php line 47 -> MailTransport->_mail(string,string,string,string,null) In my email.php config I have class EmailConfig { public $default = array( 'transport' => 'Mail', 'from' => 'no-reply@xxxxx.com.au' ); } I receive my email address from a form and am trying to send an email to the subscriber. My code is as follows $email

Cakephp foreach condition

*爱你&永不变心* 提交于 2020-01-11 13:01:12
问题 i would have to show the table of reservation of 3 biens it should show me 3 line of 3 reservation but it show me just one line in the controllers public function index_hote() { $this->Reservation->recursive = 1; $this->loadModel("BiensPersonne"); if($this->Session->read('Auth.User.0.Personne.id')){ $options = $this->BiensPersonne->findByPersonneId($this->Session- >read('Auth.User.0.Personne.id')); $this->loadModel("Personne"); $biens=$this->Personne->findById( $options['BiensPersonne'][

Why is the CakePHP authentication component not hashing my password?

徘徊边缘 提交于 2020-01-11 12:15:14
问题 I'm using CakePHP 1.2 with Auth and ACL components. In my user register action, the password is coming in unhashed. Specifically, this expression: if ($this->data['User']['password'] != $this->Auth->password($this->data['User']['confirm_password'])) This is evaluating to true, even when I submit identical values for password and confirm_password . I know that password is unhashed because when I remove the call to Auth->password , the expression evaluates to false. I expected the Auth module

Dynamically change database connection in cakephp 3

梦想的初衷 提交于 2020-01-11 12:04:51
问题 I'm trying to change the database connection used in cakephp 3 on the fly. Every answer to this question that I found refers to cakephp 2 (These three for instance). This guy found a solution for cakephp 3 having a finite number of databases, and specifically defining which Database would be used by which Table file. The thing is that I want to create a new database for every new user, and change to his database when he logs in. I can't know in advance all the databases that will exist, to

how to retrieve data sent by Ajax in Cakephp?

房东的猫 提交于 2020-01-11 09:13:46
问题 I have been stuck at this problem for a whole day. What im trying to do is to send 2 values from view to controller using Ajax. This is my code in hot_products view: <script> $(function(){ $('#btnSubmit').click(function() { var from = $('#from').val(); var to = $('#to').val(); alert(from+" "+to); $.ajax({ url: "/orders/hot_products", type: 'POST', data: {"start_time": from, "end_time": to, success: function(data){ alert("success"); } } }); }); }); and my hot_products controller: public