cakephp-2.3

cakePHP- Email client: Reading gmail inbox on localhost

China☆狼群 提交于 2019-12-11 14:17:17
问题 I am currently doing a project, but I am still working on the local machine. The problem is that I can't seem to connect the gmail mailbox using this plugin The real problem is, that I do not know the code for connecting with gmail account on localhost using the plugin. I have this in my config : public $emailTicket = array( 'datasource' => 'ImapSource', 'server' => 'localhost', 'connect' => 'imap/tls/novalidate-cert', 'username' => '************@gmail.com', 'password' => '*********', 'port'

Apply model association info when using find('list')

本秂侑毒 提交于 2019-12-11 13:44:46
问题 For the User model I have the association: public $belongsTo = array( 'Country' => array( 'foreignKey' => 'country_id', 'conditions' => array( 'Country.code_status' => 'assigned'), 'order' => array( 'short_name_en') ) ); For some reason I was expecting that by using: $countries = $this->User->Country->find('list'); I would get a list of the possible country codes to populate a dropdown in the form and that those would comply to the association definition. This is not happening, and it is

error in joining table in cakephp

…衆ロ難τιáo~ 提交于 2019-12-11 11:47:31
问题 Controller public function index(){ $this->Store->unbindModel( array('belongsTo' => array('Employee')), true ); $options=array( 'joins' => array( array( 'table' => 'Employee', 'alias' => 'Employee', 'foreignKey' => true, 'conditions'=> array('Employee.employee_store = Store.store_name') ) )); $coupons = $this->Store->find('all', $options); } Model class Store extends AppModel { var $useTable = 'store'; } Sql : SELECT `Store`.`id`, `Store`.`store_name`, `Store`.`store_address`, `Store`.`store

How to redirect each type of user to a different page when access is denied?

十年热恋 提交于 2019-12-11 07:37:37
问题 In my app I have 3 roles of Users (user, admin, non logged user), and I want to redirect them to different pages when access is denied. How to do that? In time, what $this->Auth->authorize = array('Controller'); means? I didn't understand this in cake docs. Thanks all. 回答1: I would have it in a IF statement, but perhaps someone else can suggest a more CakePHP specific method.. if($user === 'Admin') { //Admin Redirect $redirectController = 'admin'; $redirectMethod = 'admin_index'; } elseif (

CakePHP - How to make routes with custom parameters?

不想你离开。 提交于 2019-12-11 01:18:59
问题 My Cake URL is like this: $token = '9KJHF8k104ZX43'; $url = array( 'controller' => 'users', 'action' => 'password_reset', 'prefix' => 'admin', 'admin' => true, $token ) I would like this to route to a prettier URL like: /admin/password-reset/9KJHF8k104ZX43 However, I would like the token at the end to be optional, so that in the event that someone doesn't provide a token it is still routed to: /admin/password-reset So that I can catch this case and redirect to another page or display a

PHPStorm autocomplete for CakePHP custom helpers in view files

眉间皱痕 提交于 2019-12-09 15:55:37
问题 I use PhpStorm 6.0.2 and CakePHP 2.3. In my controller file I define this and get autocomplete for my custom components: /** * @property MysuperComponent $Mysuper */ Regarding to this, in my view files I define this to reach Cake's core helpers and this works: /** * @var $this View */ I need autocomplete for custom helpers inside my views. I tried this but didn't work: /** * @property Myelegant $MyelegantHelper */ When I do this, this works partially: /** * @var $Myelegant MyelegantHelper */

Forcing language prefix on URL in CakePHP

假如想象 提交于 2019-12-08 09:47:51
问题 I'd like to force my site's URL to always have a language suffix. So, if they type www.mysite.com it should take them to www.mysite.com/en . I have a default language, so that should be used if it's their first time to the site. If it's not, I have a Cookie being set that I can use...but - I don't know where to use it. I thought about checking to see if there was a "language" parameter in the URL, then if not, redirecting, but - that seems overkill - is there a better way? Can I do this in

Creating Pagination With CakePHP For Custom Template Links

故事扮演 提交于 2019-12-07 19:41:45
问题 I've following custom template for pagination links <li class="prev"><a href="#">prev</a></li> <li><a href="#" class="active">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">6</a></li> <li><a href="#">7</a></li> <li><a href="#">8</a></li> <li>...</li> <li><a href="#">30</a></li> <li class="next"><a href="#">next</a></li> I've tried it by using following code( cakephp 2.3 version ) but not getting the result

Duplicate controller names from different plugins

末鹿安然 提交于 2019-12-07 13:24:11
问题 I have a question regarding the file loading system from Cakephp2.3. I have two plugins - let's call them "Contacts" and "Managers", loaded like this: CakePlugin::load('Contacts'); CakePlugin::load('Managers'); Each of them has a controller called "DashboardController.php" with an index() action. When I try to access the dashboard page for "Contacts", sometimes I see the following error: Error: Class "ManagersAppController" not found even though the url looks like this: http://mysite.com

User sessions and two CakePHP applications running in the same machine

坚强是说给别人听的谎言 提交于 2019-12-07 12:32:17
问题 I have 2 CakePHP applications running on the same machine. Both of them need a previous registration to have access to them and the first thing users see is the login form. I have realized that when I do login in one of them, then, I can access to the other web application without being asked for my credentials to login. (which is not correct) In my Controllers of both applications I have this to deny access without a previous login. public function beforeFilter(){ parent::beforeFilter();