Posts made in July, 2009

  • CakePHP has some great pagination functions built in – however these are normally categorised with “sortby” and “Number per page”.
    I found on another blog this code (http://foldifoldi.com/news/?p=169):

    function index($filter = null) {
    $this->SttwTrack->recursive = 0;
     
    $this->set(’filter’, $filter);
     
    // query all distinct first letters used in names
    $letters = $this->SttwTrack->query(’SELECT DISTINCT [...]

    Share with your friends and help out this site:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • E-mail this story to a friend!
    • LinkedIn
    • Live
    • Reddit
    • StumbleUpon
    • Twitter
    • Yahoo! Bookmarks
    Read More...
  • For a CakePHP n00b the pagination thing might seem a bit complicated. Well to be frank it is in someways. For instance you can only currently paginate stuff easily when there is a model involved!
    For instance here is a pagination with a deep association:

    $this->UserProfile->User->Friend->recursive = -1;
    $this->set(’userFriends’, $this->paginate($this->UserProfile->User->Friend,
    array(’Friend.user_id’ => $userid, ‘Friend.accepted’ => 1)));
     
    $this->set(’userFriendsWaiting’, $this->paginate($this->UserProfile->User->Friend,
    array(’Friend.user_id’ => [...]

    Share with your friends and help out this site:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • E-mail this story to a friend!
    • LinkedIn
    • Live
    • Reddit
    • StumbleUpon
    • Twitter
    • Yahoo! Bookmarks
    Read More...
  • Age old argument isnt it? When should you stop supporting a browser that is outdated? Ok so I know the majority of the time outdated is subjective – but lets face it – Im pretty sure that there isnt one person on the face of this earth that doesnt think think IE6 is outdated.
    But what [...]

    Share with your friends and help out this site:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • E-mail this story to a friend!
    • LinkedIn
    • Live
    • Reddit
    • StumbleUpon
    • Twitter
    • Yahoo! Bookmarks
    Read More...
  • I sometimes think it is useful to see exactly what variables (and values are being passed to the view in cakePHP), especially if the project you are working on is complex with much pseudo repetitive data.
    A simple solution to do this is to insert this piece of code in your view:

    foreach ($this->getVars() as $name) {
     
    pr($$name);
    }

    Share [...]

    Share with your friends and help out this site:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • E-mail this story to a friend!
    • LinkedIn
    • Live
    • Reddit
    • StumbleUpon
    • Twitter
    • Yahoo! Bookmarks
    Read More...
  • Right,
    When I started out on this I hit t’internet looking for any kind of hints as to the best way of going about this. The first thing I came across was the use of a Self Referential HABTM relationship ( User<-HABTM->User ), naturally not being the uber Cake Nerd this really didnt work out too [...]

    Share with your friends and help out this site:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • E-mail this story to a friend!
    • LinkedIn
    • Live
    • Reddit
    • StumbleUpon
    • Twitter
    • Yahoo! Bookmarks
    Read More...

Ad