cakephp-2.0

CakePHP 2.0 Auth Login not working

六月ゝ 毕业季﹏ 提交于 2019-12-10 11:58:00
问题 I have been fighting with this for awhile. I have a CakePHP 2.0 application that needs Authentication, due to the fact that it must be in another language, I stepped away from the automagic 'User' with 'Username' and 'Password' convention and made my own database table: utilizatori('id', 'nume', 'parola') In my AppController I have the following defined which if I understood correctly should override the default CakePHP associations and make it use my new structure: class AppController

How to insert multiple records

这一生的挚爱 提交于 2019-12-10 11:19:36
问题 I am a new cake php developer.I am trying to insert multiple record but i cant.My table Structure is given below: Table Name : agents ============================================== id | Contact | Name | email_add | Address ============================================== Controller Code : public function send_money() { $this->layout='agent'; $this->Agent->create(); $this->Agent->set($this->data); if(empty($this->data) == false) { if($this->Agent->save($this->data)) { $this->Session->setFlash(

Auth for static page cakephp [closed]

别说谁变了你拦得住时间么 提交于 2019-12-10 10:57:55
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am new in cakephp.. I am making a website , there no users hierarchy , there is only the admin and public users. I want to disallow the public users from entering a certain static page. of course the page is located in view/pages , so its view/pages/adminPanel.ctp . please

CakePHP: How to use Containable for nested HABTM models

早过忘川 提交于 2019-12-10 10:42:27
问题 I'm trying to use Containable to return a model with several of its associated models (and those arrays of data). The models deal with test results. Here are the models: Models: Question : has and belongs to many Category Category : has and belongs to many Question Attempt : has many AttemptedQuestions AttemptedQuestion : belongs to Question I want to return an Attempt with all of it's AttemptedQuestions and their corresponding Quesions + Category So basically, the relationships map like this

How to make cakePHP 2.x in sub directory appear in root (with mod_rewrite in htaccess)? [closed]

為{幸葍}努か 提交于 2019-12-10 10:37:58
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I'm working on an cake app which is inside a sub directory (because I need to run it along side another app on the same domain). I want the pages powered by cake to appear as if they'r e top level. So instead of example.com/cake_dir/page... I want example.com/page... I think the best way to make this work is by

CakePHP save multiple rows

橙三吉。 提交于 2019-12-10 10:33:10
问题 I am using two models 'User' and 'UserImage'.. Where in i am going to save multiple rows into user_images table.. The view for UserImage is below.. echo $this->Form->input('UserImage.0.photo'); echo $this->Form->input('UserImage.1.photo'); echo $this->Form->input('user_id'); echo $this->Form->end(__('Submit')); Then how to save multiple rows.. 回答1: You should specify the model of each field if you have more models involved. Also, you need to specify for each record the related field (user_id)

CakeEmail debug

我怕爱的太早我们不能终老 提交于 2019-12-10 10:13:06
问题 I'm trying to set up a test email in my controller that outputs the email as it would look, without actually sending the email. I am using CakePHP 2.1 At the top of my controller I have: App::uses('CakeEmail', 'Network/Email'); And in my controller the method is: $email = new CakeEmail('default'); $email->from(array('me@example.com' => 'My Site')); $email->to('you@example.com'); $email->subject('About'); $email->send('My message'); In my email config I have set the $default to Debug mode:

Adding conditions to Containable in CakePHP

旧街凉风 提交于 2019-12-10 04:37:00
问题 Previously I was relying on recursive, but I didn't get solution for some, then I found that Containable works fine for these. I am developing a movie review website. In that I need to show the list of movies which is related to a particular Genre. I have this below code: //example $genre = "drama"; $options = array( 'contain' => array( 'Movie', 'MoveiGenre.Genre' => array( 'conditions' => array('MovieGenre.Genre.name = "'.$genre.'"') ), 'MovieGenre.Genre.name' ), 'recursive' => 2, 'limit' =>

FULL TEXT SEARCH in cakephp ? any example

北城余情 提交于 2019-12-09 11:20:49
问题 I am using ordinary search functionality in my business controller . but now need to implement FULL TEXT SEARCH with paginate can any one give idea or sample ? I am using MySQL with MyISAM tabes and this my table structure, fields marked bold are need to use in search CREATE TABLE IF NOT EXISTS businesses ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, created date NOT NULL, modified datetime NOT NULL, user_id bigint(20) NOT NULL, slug varchar(255) NOT NULL, **`name` varchar(255) NOT NULL,*

Find where id is not in array of ids

孤者浪人 提交于 2019-12-09 07:53:51
问题 To find id whose value is equal to the id of an array of ids: $this->YourModel->find('all', array( 'conditions' => array( "YourModel.id" => array(1, 2, 3, 4) ) )); How I can do the opposite, find elements where the ids are different than an array of ids? 回答1: This should work: $this->YourModel->find('all', array( 'conditions' => array( "NOT" => array( "YourModel.id" => array(1, 2, 3, 4) ) ) )); http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#complex-find-conditions 来源: https:/