cakephp-1.3

TypeError: $(…).on is not a function

自闭症网瘾萝莉.ら 提交于 2019-11-28 08:54:29
I am using jQuery litebox . After adding JS and CSS files I got this error TypeError: $(...).on is not a function at this line in js file "return $('body').on('click', 'a[rel^=lightbox], area[rel^=lightbox]', function(e) {" Can anybody help me to understand the problem here? I am doing this implementation in CakePHP 1.3. The problem may be if you are using older version of jQuery. Because older versions of jQuery have 'live' method instead of 'on' The usual cause of this is that you're also using Prototype, MooTools, or some other library that makes use of the $ symbol, and you're including

Leverage Browser Caching and CakePHP

给你一囗甜甜゛ 提交于 2019-11-28 05:54:28
问题 I asked my host if they supports mod_expires or not, they told me that it is supported. I use CakePHP and I tried the following code in webroot/.htaccess and `app_root/.htaccess but Google's page speed is stile considering there is issue in caching of css, js, png, jpg, etc. it found them 24 hour! as the screenshot shows below <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=31449600, public" </FilesMatch> The above code is adopted from this

How to send a multiple emails at a time in cakephp

二次信任 提交于 2019-11-28 04:42:29
问题 I need to send multiple emails at a time, can any one have example? or any idea ? I need to send mail to all my site users at a time (Mail content is same for all) Currently i using following code in a for loop $this->Email->from = '<no-reply@noreply.com>'; $this->Email->to = $email; $this->Email->subject = $subject ; $this->Email->sendAs = 'html'; 回答1: I think you have 2 possibilities: foreach Let's assume you have a function mail_users within your UsersController function mail_users(

cron job with CakePHP

匆匆过客 提交于 2019-11-28 01:58:22
问题 I have referred http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line and created cron_dispatcher.php and placed it in the app folder. I have return some test email function for the cron job to run in my users controller's test method. And i have created a Cron job in my web server's control panel like "/usr/bin/php/home4/enventur/public_html/pennystock/cron_dispatcher.php /users/test" But its giving me an error as "No input file specified." Please

How to limit data to users who own it without limiting admin users in CakePHP?

只愿长相守 提交于 2019-11-28 01:27:52
问题 Currently I am writing an application where I have multiple users. They have data that should only be visible to them and not the other authenticated users in the system. I also have administrators who manage the system and have access to all of the information. What is the best way to limit users to their data without limiting admin users? Currently I am using a callback to limit the queries by user, but the admin will get the same limits. So I need to know a better way to do it. More

Incrementing Cakephp database field by a value

时间秒杀一切 提交于 2019-11-27 23:01:29
I have this field whose value i have to increment the field value by a specific value. I am using this $data['quantity'] = 'Order.quantity+1'; which doesnt works for me quantity is a integer coloumn here. Also will it work when nothing is in database?. Regards Himanshu Sharma mark you can use updateAll() for this a little googling reveals this pretty quick: http://cakephp.1045679.n5.nabble.com/Auto-Increment-A-Field-td3491697.html Andre S I used updateAll in my code to increment views in an article. Therefore, every time an article is visited, I call the following function from within my view

CakePHP Cookie/Session problems

牧云@^-^@ 提交于 2019-11-27 20:08:37
I am having issues with my CakePHP application. This seems to be happenining only in IE, and only on certain computers. It is consistent on the computers where it is happening though. Issue one: User is logged in and on the page https://example.com/users/view and clicks sign out. User is redirected to http://example.com and appears to be logged out until the user visits another https page and they are still logged in. They can click log out as many times as they want but they are always logged in on https and only get logged out on http. Issue two: User logs in at https://example.com/users

Using username instead of email in CakePHP's Auth Component

半腔热情 提交于 2019-11-27 16:57:54
问题 Using CakePHP's Auth Component, how do I allow users to authenticate by using either their "username" or "email" field as a username, and a "pass" field as their password? 回答1: what does "using (username and email) both as username " mean? Edit: ok, so you want Auth to look in both username and email fields in the db to compare to the "username" that the user enters? then do this: function beforeFilter() { parent::beforeFilter(); $this->Auth->fields = array('username' => 'username', 'password

cakephp see the compiled SQL Query before execution

♀尐吖头ヾ 提交于 2019-11-27 16:13:11
问题 My query gets the timeout error on each run. Its a pagination with joins. I want to debug the SQL, but since I get a timeout, I can't see it. How can I see the compiled SQL Query before execution? Some cake code: $this -> paginate = array( 'limit' => '16', 'joins' => array( array( 'table' => 'products', 'alias' => 'Product', 'type' => 'LEFT', 'conditions' => array('ProductModel.id = Product.product_model_id') )), 'fields' => array( 'COUNT(Product.product_model_id) as Counter', 'ProductModel

CakePHP switch database (using same datasource) on the fly?

谁说胖子不能爱 提交于 2019-11-27 13:48:34
I have tried to build a small function that would be use in controller to switch database on the fly, i must use only one datasource. On my database.php : function __construct() { $server = Configure::read('Server'); if(!empty($server['database'])) $this->local['database'] = $server['database']; $this->default = $this->{$server['datasource']}; } Is used to switch database depending on server config. It is working great. I tried to build up this : /** * Connects to specified database * * @param array $config Server config to use {datasource:?, database:?} * @return array db->config on success,