flipflops's Profile

Recent Comments

flipflops posted on 02/29/08 05:22:44 AM
I was using pagination in the following situation using the ServiceItem model inside the ServicesController - the pagination worked but all the paging was wrong until I found out I had to set:

$this->Pagination->modelClass = 'ServiceItem';

The component was using the number of records in the Service model rather than the number of results in the ServiceItem model.

So remember to do something like this:



class ServicesController extends AppController {

 var $name = 'Services';
 var $helpers = array('Html', 'Form', 'Jhelper', 'Habtm', 'Pagination' );
 var $uses = array('Service', 'ServiceItem', 'Postcode');
 var $components = array('Map', 'Pagination');

 function admin_index() {
  $this->layout = "admin"; 
  $this->ServiceItem->recursive = 0;

  $criteria=NULL;
  $this->Pagination->resultsPerPage = array(25,50,100);
  $this->Pagination->show = 25;
  $this->Pagination->modelClass = 'ServiceItem';
  
  list($order,$limit,$page) = $this->Pagination->init($criteria); // Added
  
  $data = $this->ServiceItem->findAll($criteria, null, $order, $limit, $page); 

  $this->set('services', $data);
 }
 
}

flipflops posted on 01/16/08 08:27:45 AM
There was a good article on Digital-Web recently that goes through securing contact forms in quite a lot of detail - might be of help to you.

http://www.digital-web.com/articles/bulletproof_contact_form_with_php/
flipflops posted on 12/18/07 02:54:24 AM
Hi Stefan

The easiest thing to do is just add these values in your app/config/core.php file e.g.

define('CAKE_EMAIL_USER', 'website@mywebsite.com');

Then in the mailer component you just reference these values:


class EmailComponent
{
  /**
   * Send email using SMTP Auth by default.
   */
    var $from         = 'phpmailer@cakephp';
    var $fromName     = "Cake PHP-Mailer";
    var $smtpUserName = CAKE_EMAIL_USER;  // SMTP username
    

This way you've set the default values, but you can still over ride them when you use the component.
flipflops posted on 12/07/07 06:18:23 AM
Thanks for a great component. It is very easy to set up and use.

I do have one problem though, the HTML layout - app/views/layouts/email.thtml simply isn't rendering and I can't work out why.

The emails are sent perfectly just without the layout wrapped around them. I was hoping somebody else had experienced the same problem and found a solution.

Thanks
flipflops posted on 10/30/07 06:10:13 AM
This is a great idea, thanks. I come across a problem, have a think, google it - BANG - there is an answer straight away.

If anybody tries this and it doesn't work - remember that you need to comment out the define('CAKE_ADMIN', 'admin'); line in app/config/core.php

Are multiple admin routes a feature in 1.2?