cakephp-1.3

Clearing all prefixes

痴心易碎 提交于 2019-12-11 05:58:28
问题 I have several prefixes in play in an existing CakePHP app. I also have a bit of primary navigation in the layout that points to shared methods. I know I can explicitly set each prefix to false to avoid linking with the prefix, but is there a shortcut path that simply tells Cake to no use any prefixes no matter which one's context may currently exist? For example, I'm on a page where a realtor can register ( /realtor/users/register ). I have a similar prefix for inspectors and contractors

How to pull new post and comments

巧了我就是萌 提交于 2019-12-11 05:47:51
问题 I am currently developing a website where many users post topics and the associated topics' comments are shown in the page. Currently I'm developing using cake php. The very first time a user clicks the website, all the topics and comments are displayed. But when other users add new topic or comment to a topic, I need to show the update in the same page. I am confused as in how am I able to retrieve new contents and update accordingly in a page. For instance how facebook does it where when

Custom filed validation in CakePHP

旧城冷巷雨未停 提交于 2019-12-11 05:21:32
问题 i need help how to develop validation rule for next case... my cakephp web form contains several dynamically generated checkboxes. end user must select at least one of them. none of those checkboxes are fields in db table. can you help me how to create validation rule for that? tried to do by adding in model something like var $validate = array( 'topic' => array( 'rule' => 'myRule', 'message' => 'Check on at least one checkbox' ) ) function myRule() { //just give me false to know it works...

CakePHP: Disable Security Component site wide

烂漫一生 提交于 2019-12-11 04:35:51
问题 I have lot of AJAX functionality in my site and a component we freelanced was using CakePHP Security Component very tightly with the forms and this is lot of trouble. How to disable Security Component site-wide in CakePHP? Just disabling it the app_controller.php is not helping because it is tightly coupled with some validation and black-hole stuff. Any ideas? 回答1: Even if you disable it in your app_controller your individual controller may have that security enabled.As my wild guess says

CakePHP executes method names as SQL queries

℡╲_俬逩灬. 提交于 2019-12-11 04:06:12
问题 I am developing a CakePHP site locally. I created a User model that is used by the UsersController. Everything works fine on my box, but as soon as I check out the code on my host (WebFaction) CakePHP starts trying to execute the names of methods in the User model as SQL queries. # users_controller.php public function index() { $this->User->dummy_function(); $users = $this->User->find('all'); $this->set(compact('users')); } # User.php public function dummy_function() { } Now when I navigate

CakePHP / Mysql Insert UTF-8

半腔热情 提交于 2019-12-11 02:48:24
问题 all are well? So, is the following: CakePHP 1.3.11 MySQL 5.1 Apache 2.2 PHP 5.3 Charset / Collate the database created for the application: utf8 utf8_general_ci app / config / database.php 'encoding' => 'utf8' charset of all files: utf8 The problem? When I try to save, for example: "Currículo" I got in return "Currículo" Where is the problem? Note: locally on my notebook, the application works correctly, even saving incorrectly, that is, even saving "Currículo" CakePHP when the bank takes

Cakephp Auth: $this->Auth->loginError message

给你一囗甜甜゛ 提交于 2019-12-11 02:34:09
问题 I am using Auth Component. I am setting $this->Auth->loginError in the beforeFilter. But i have another posibility. If the user entered username and password is correct but User.status = 'pending' how can i can show a different message. i am using $this->Auth->userScope to set that. but how to show different $this->Auth->loginError for these two posibilities. Username and Password = correct but Status = pending Either Username or Password = incorrect but status = active there are the two

cakephp emails not working

半城伤御伤魂 提交于 2019-12-11 01:35:26
问题 my problem is: in the controller I have: var $components = array('Email'); the method to send emails looks like this: function send_emails() { $this->Email->from = 'Somebody <somebody@example.com>'; $this->Email->to = 'Somebody Else <myspamplace@centrum.cz>'; $this->Email->subject = 'Test'; $this->Email->send('Hello message body!'); } I am using Cake 1.3 and running it on localhost with Apache 2.2.11 and PHP5. Do you guys have any idea why it doesn't work? When I put $this->Email->delivery =

inserting a new row instead of updating the current row

点点圈 提交于 2019-12-11 00:43:03
问题 hi I am having problem with the code below I am doing ajax and if the data is exactly same it doesnt insert a record. But if the text in text area changes, it should update the record, but instead it inserts a new row. here is my model <?php class Test extends AppModel { var $belongsTo = array('table1','table2'); var $validate = array( 'field1' => array( 'rule' => 'duplicateCheck', 'message' => 'Duplicate record' ), 'textbody' => array( 'rule' => 'duplicateCheck', 'message' => 'Duplicate

Rails Devise Legacy Users from CakePHP

不打扰是莪最后的温柔 提交于 2019-12-11 00:22:39
问题 I recently got Devise working. New users sign in, sign up, logout etc etc just fine. Old users however have an issue. I have gotten it to a point where I get a 401 unauthorized, which seems to me that the hash is just incorrectly being created when signing in and of course not matching correctly. My user model: class User < ActiveRecord::Base require "digest/sha1" # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable,