cakephp-1.3

How do I perform a jquery ajax request in CakePHP?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 01:54:55
问题 I'm trying to use Ajax in CakePHP, and not really getting anywhere! I have a page with a series of buttons - clicking one of these should show specific content on the current page. It's important that the page doesn't reload, because it'll be displaying a movie, and I don't want the movie to reset. There are a few different buttons with different content for each; this content is potentially quite large, so I don't want to have to load it in until it's needed. Normally I would do this via

cakephp: how to access another model, which has no association

百般思念 提交于 2019-12-24 00:19:24
问题 I've 3 tables: project , amenities and project_amenities . I add project form only, i want to add new amenities, which first added to amenities table and then project_amenities table. So I defined these relations: Project hasMany Amenities Amenity belongsTo Project I declared in projects_controller : var $uses = array('Amenity'); This gives error for my add action here if (!empty($this->data)){ $this->Project->create(); as Notice (8): Undefined property: ProjectsController::$Project [APP

CakePHP Subquery from SQL

会有一股神秘感。 提交于 2019-12-24 00:17:33
问题 CREATE TABLE IF NOT EXISTS `messages` ( `id` int(11) unsigned NOT NULL auto_increment, `user_id` int(11) unsigned NOT NULL, `node_id` int(11) unsigned NOT NULL, `reciever_id` int(11) unsigned NOT NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ; INSERT INTO `messages` (`id`, `user_id`, `node_id`, `reciever_id`, `created`, `modified`) VALUES (1, 1, 1, 15, '2011-12-07 00:00:00', '2011-12-07 02:00

cakephp - get table names and its column details

杀马特。学长 韩版系。学妹 提交于 2019-12-23 17:15:25
问题 Does anyone knows how to get table name from model name? Also I want to get all column names and its types of that model/table name. Is it possible to get such details of given model name? Thanks. 回答1: Table Name To get the table, see $this->Model->table Or check the model for the class variable $useTable . If that's undefined, then you can infer it from the name of the model: $tableName = Inflector::tableize($this->Model->alias); See the Inflector documentation for similarly useful methods.

Gmail automatic login script

不问归期 提交于 2019-12-23 14:23:24
问题 I have the gmail login credintals. Is it possible to login automatically to Gmail if we pass the username and password through url or by CURL. 回答1: If you rightclick the gmail login page and view source you can find the id's of the user email and login fields. You can then use these to write a javascript to fill it automatically and submit. Theres an implementation here you might check http://techtoggle.com/2009/06/how-to-autologin-into-yahoo-hotmail-lycos-mail/ Edit: its not using the

Gmail automatic login script

Deadly 提交于 2019-12-23 14:22:39
问题 I have the gmail login credintals. Is it possible to login automatically to Gmail if we pass the username and password through url or by CURL. 回答1: If you rightclick the gmail login page and view source you can find the id's of the user email and login fields. You can then use these to write a javascript to fill it automatically and submit. Theres an implementation here you might check http://techtoggle.com/2009/06/how-to-autologin-into-yahoo-hotmail-lycos-mail/ Edit: its not using the

How to not require a required input

故事扮演 提交于 2019-12-23 09:54:08
问题 I have a Building that is associated with a User . A User can also register, login, etc. I have my validation set so that key User fields (e.g. email , name , etc.) are required. When I create a building, I'm also offering the ability to associate a user on the spot. My building form has inputs for that key user info: <?php echo $this->Form->input( 'User.first_name' ) ?> <?php echo $this->Form->input( 'User.last_name' ) ?> <?php echo $this->Form->input( 'User.email' ) ?> However, I don't want

Cakephp with PHP7

∥☆過路亽.° 提交于 2019-12-23 09:34:59
问题 Can I run CakePHP 1.3 with PHP7? I have to do a migration to PHP7, but in the hosting there is a project in CakePHP 1.3 and need to know if there is any risk if I run this project in this version of PHP. 回答1: Unfortunately CakePHP 1.3 is not really compatible with PHP7 out of the box. I work on a old project in CakePHP 1.3 and my system upgraded to PHP7. There are a lot of these in the core of CakePHP 1.3 After changing these, I ran into the next batch of errors, after which I rolled back and

CakePHP Conditions on deep model associations

我的梦境 提交于 2019-12-23 05:35:07
问题 Using CakePHP 1.3, I have a Find statement with a condition on the 3rd level deep association: Hotel > Room > RoomType > name I would like my Find statement to only return Hotels with RoomTypes that have the Name "Suite". I believe the following code should work, but it does not, stating an SQL syntax error: $this->Hotel->find('first', array( 'contain' => array('Room' => array('RoomType')), 'conditions' => array( 'Hotel.Room.RoomType.name' => 'Suite' ), )); Please note that a Hotel will have

how can I test view where authentication is required, with cakePHP and SimpleTest

大憨熊 提交于 2019-12-23 05:22:28
问题 I'd like to write WebTestCase of views that requires authentification. Is it possible? How can I pass authentification? I tried with writing basic authentification in the session but it doesn't work. $_SESSION['Auth']['User']['id'] = 1; $_SESSION['Auth']['User']['username'] = 'nico'; 回答1: function login() { $this->get($this->host_name."/users/login/"); $this->assertText("Login"); $this->setField("data[User][username]",'xxxx'); $this->setField("data[User][password]",'xxxx'); $this-