cakephp-1.3

Cakephp Override HtmlHelper::link

随声附和 提交于 2019-12-01 00:01:18
I want to setup HtmlHelper::link() method so the default options array have escape = false. How can I achieve this without changing the core class? OBS: I already sanitized form input, so I guess this will have no problem. Thanks in advance. Cake 2.1.5 I just implemented this and I wanted to point out a few things: Your custom html helper should extend HTML helper (and don't forget to include the HTML helper class) App::uses('HtmlHelper', 'View/Helper'); class CustomHtmlHelper extends HtmlHelper { //yadda yadda } Additionally, your call in AppController should not include the word Helper:

Add a friend feature in CakePHP

元气小坏坏 提交于 2019-11-30 20:33:38
问题 I need a simple add a friend feature in my application, through some research, I would need a join table linking back to users table ? something like this: (I already have a users table) Users-Friendships-Users Can anyone give more details about this? 回答1: The friendships table should have following columns: id Integer user_from (the user who requested friendship) user_to (the user who accepted friendship) created (optional to track when your friendship started) Then you need to create proper

Missing Load plugin

╄→尐↘猪︶ㄣ 提交于 2019-11-30 09:49:07
问题 After I change some of the code from 1.3 to 2.1. Some error occur. This is the error: Missing Plugin Error: The application is trying to load a file from the forums plugin Error: Make sure your plugin forums is in the app\Plugin directory and was loaded <?php CakePlugin::load('forums'); Loading all plugins: If you wish to load all plugins at once, use the following line in your app\Config\bootstrap.php file CakePlugin::loadAll(); Notice: If you want to customize this error message, create app

Modify session cookie expiry and session timeout for a CakePHP session

99封情书 提交于 2019-11-30 08:37:32
问题 I'm struggling to accomplish the following: Alter the user's session cookie expiry date based on the user's type. I have a CakePHP web application wherein I have created my authentication component (instead of CakePHP's Auth) using CakePHP sessions. I've configured CakePHP to handle sessions using the database. Here are the relevant configuration settings that I have in my config.php: Configure::write('Session.save', 'database'); Configure::write('Session.timeout', '36'); Configure::write(

Submitting current timestamp in CakePHP

半腔热情 提交于 2019-11-30 06:57:17
问题 What is the method to submit a current timestamp directly on an INSERT or an UPDATE ? If I were running regular SQL, I would use the function NOW() for the specific SQL field on submission. How would I do that with CakePHP? $this->Model->save($this->data) 回答1: In CakePHP, you can include the NOW() function unescaped by using DboSource::expression $this->data['SomeModel']['your_datetime_field'] = DboSource::expression('NOW()'); $this->Model->save($this->data); This is the preferred way of

Missing Load plugin

与世无争的帅哥 提交于 2019-11-29 17:22:38
After I change some of the code from 1.3 to 2.1. Some error occur. This is the error: Missing Plugin Error: The application is trying to load a file from the forums plugin Error: Make sure your plugin forums is in the app\Plugin directory and was loaded <?php CakePlugin::load('forums'); Loading all plugins: If you wish to load all plugins at once, use the following line in your app\Config\bootstrap.php file CakePlugin::loadAll(); Notice: If you want to customize this error message, create app\View\Errors\missing_plugin.ctp. Somebody, please help me? Write the following line in your app\Config

Select All Events with Event->Schedule->Date between start and end dates in CakePHP

ぐ巨炮叔叔 提交于 2019-11-29 17:06:25
Trying to figure out how to build a query in CakePHP where I can select all Events that are between X and Y dates (user-entered dates). The problem lies in that the Event doesn't have the dates in it's table. Event hasMany Schedule Schedule belongsTo Event Schedule hasMany Date Date belongsTo Schedule Events table : details of the event - name, location, description...etc Schedules table : start and end date with repeat options Dates table : the actual dates of the event created from the data in Schedules So - I actually need to select any Events that have at least one Date entry between the X

Cakephp SMTP emails syntax error

孤者浪人 提交于 2019-11-29 14:53:22
I've got a problem with email sending in cake. My method looks like this: $this->Email->smtpOptions = array( 'port'=>'465', 'timeout'=>'30', 'auth' => true, 'host' => 'ssl://smtp.gmail.com', 'username'=>'mymail@gmail.com', 'password'=>'mypass', ); $this->Email->from = "admin@localhost"; $this->Email->to = "my_test_mail@centrum.cz"; $this->Email->subject = "Test"; $this->Email->sendAs = "text"; $this->Email->delivery = 'smtp'; $this->Email->send('Hello message body!'); But when I try to send the email I get: 555 5.5.2 Syntax error. l3sm512374fan.0 What do I need to chnage in order for this to

Leverage Browser Caching and CakePHP

自古美人都是妖i 提交于 2019-11-29 12:00:17
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 article . Also I used the following: <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg

cron job with CakePHP

最后都变了- 提交于 2019-11-29 08:47:44
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 help me, how to solve it ?? Thanks in Advance Nidhin Baby I have done it in different way, Please see