cakephp-2.0

sending data via ajax in Cakephp

…衆ロ難τιáo~ 提交于 2019-12-22 15:35:16
问题 i am new to cakephp and trying to send data from ajax to my controller action.. i have a popup model in which there is a input box ..i want to grab that value and send to controller without page refresh here is my code .. <a class="button anthracite-gradient" onclick="openPrompt()">submit </a> my javascript function openPrompt() { var cancelled = true; $.modal.prompt('Please enter a value:', function(value) { $.ajax({ type:"POST", url:"/cakephp/controller/action/", success : function(data) {

CakePHP 2.1 - Custom Validation Rule - Check for Unique Field Value Combination

自作多情 提交于 2019-12-22 10:45:05
问题 I have a couple of columns (ip, provider_id) for which I want combinations of values to always be unique. Therefore, I am trying to build a custom validation function. But I am having issues grabbing on the value of the secondary field. This is my code so far in the model: public $validate = array( 'ip' => array( 'rule' => array('uniqueClick', 'provider_id'), 'message' => 'The click is not unique.' ) ); public function uniqueClick ($ip, $field) { $count = $this->find('count', array(

cakephp 2.3 ajax form submission [closed]

怎甘沉沦 提交于 2019-12-22 09:35:35
问题 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 5 years ago . I am trying to create a simple form to submit data to the database with ajax. here is my view <?php echo $this->Html->script('jquery', FALSE); ?> <?php echo $this->Html->script('validation', FALSE); ?> <div id="success"></div> <h2>Contact Us</h2> <?php echo $this->Form->create(); echo $this->Form->input('name',

Run plugin's shell in cakephp 2.0

喜欢而已 提交于 2019-12-22 07:13:05
问题 I have created a new CakePHP 2.0 app and want to run a plugin's shell. <?php // app\Plugin\Tmaker\Vendors\Shells\TmakerShell.php class TmakerShell extends Shell { } However, I can't see it when running Console/cake from the command-line. Please advise my what I have missed? 回答1: According to the latest documentation, the path for shells has changed to app/Console/Command/ . Move your shell to the following location: app/Plugin/Tmaker/Console/Command/TmakerShell.php (not sure if plugin

Run plugin's shell in cakephp 2.0

半世苍凉 提交于 2019-12-22 07:12:48
问题 I have created a new CakePHP 2.0 app and want to run a plugin's shell. <?php // app\Plugin\Tmaker\Vendors\Shells\TmakerShell.php class TmakerShell extends Shell { } However, I can't see it when running Console/cake from the command-line. Please advise my what I have missed? 回答1: According to the latest documentation, the path for shells has changed to app/Console/Command/ . Move your shell to the following location: app/Plugin/Tmaker/Console/Command/TmakerShell.php (not sure if plugin

Calling AppModel function in AppController for cakephp

牧云@^-^@ 提交于 2019-12-22 05:35:15
问题 I have a function that I want all of my controllers to be able to use, so I have defined it in AppController. Now part of what this function will do has no business being in a controller and so it should be in a model, but since this is a universal operation, it only seems correct that it be in AppModel. My function looks as followed: class AppController extends Controller { public function i_need_this_everywhere ($term) { // do some stuff // this is the line that is an issue // it seems like

CakeEmail problems on server

情到浓时终转凉″ 提交于 2019-12-21 21:40:40
问题 I'm using cakeEmail for simple form and on localhost it worked great, but on server(hosting) It shows me this error: CONNECTION REFUSED Error: An Internal Error Has Occurred. Stack Trace CORE/Cake/Network/Email/SmtpTransport.php line 101 → CakeSocket->connect() CORE/Cake/Network/Email/SmtpTransport.php line 61 → SmtpTransport->_connect() CORE/Cake/Network/Email/CakeEmail.php line 1124 → SmtpTransport->send(CakeEmail) APP/Controller/ProductsController.php line 26 → CakeEmail->send(string)

Simple AJAX / JSON response with CakePHP

大憨熊 提交于 2019-12-21 21:25:50
问题 I'm new to cakePHP. Needless to say I don't know where to start reading. Read several pages about AJAX and JSON responses and all I could understand is that somehow I need to use Router::parseExtensions() and RequestHandlerComponent , but none had a sample code I could read. What I need is to call function MyController::listAll() and return a Model::find('all') in JSON format so I can use it with JS. Do I need a View for this? In what folder should that view go? What extension should it have?

Twitter OAuth - Invalid or expired access token

為{幸葍}努か 提交于 2019-12-21 17:02:04
问题 I am trying to share post using twitteroauth with latest version. Below is my code. require APP."Vendor/twitteroauth-master/autoload.php"; // twitter v0.5.1 SDK if(isset($_REQUEST['oauth_verifier'])) { $request_token = []; $request_token['oauth_token'] = $this->Session->read('twtr_oauth_token'); $request_token['oauth_token_secret'] = $this->Session->read('twtr_oauth_token_secret'); /* If denied, bail. */ if (isset($_REQUEST['denied'])) { exit('Permission was denied. Please start over.'); } /*

Getting associated models with $this->Auth in Cakephp

こ雲淡風輕ζ 提交于 2019-12-21 07:55:31
问题 I am using CakePHP 2.0's integrated Auth component. I have the following tables : Users Groups Profiles My model relations are as follows: User belongsTo Group User hasMany Profiles While logged in to the site, I noticed the Auth session contains only User table information, but I need the information of Groups and Profiles tables too for the logged in user. Is there any way to do that with the Auth component? 回答1: There is no way to do this with the AuthComponent because of the way it