Four new tutorials about IIS, ACL, an online editor, and pagination

Published on and tagged with acl  cakephp  tutorial

The first tutorial covers, as its title indicates, a very special topic: CakePHP Under IIS 6 without Rewrite. “Tutorial” is a little bit overstated as it is very short: you find the nitty-gritty in two sentences ;-)

The tutorial ACL access checking describes how to use Access Control Lists (ACL) to secure both controller-actions and database-items (=model-items).

Online Editor – Xinha shows how to integrate the wysiwyg online editor Xinha in a CakePHP application. There exists a similar tutorial for the FCKeditor.

The last tutorial, Very simple pagination, presents a pagination solution. Another solution is already explained in Three Steps to Pagination.

Update 2007-01-07: The tutorials listed here do no longer exist as the wiki has been shut down. If you want to include a wysiwyg editor, try the tutorial Using TinyMCE with CakePHP or Using Fckeditor with CakePHP, for a ACL tutorial see User Permissions and CakePHP ACL, and for a pagination tutorial see Pagination.

Update 2007-07-04: The links in this article point now to archive.org, where the tutorials are archived. But be warned: most of those tutorials are outdated.

15 comments baked

  • KesheR

    thanks…

  • Anonymouse

    Your two pagination URLs are no longer valid. Please update.

  • SAT

    hey…

    your CakePHP Under IIS 6 without Rewrite. link not working kindly update that link

    Thanks & Regards
    Sat

  • cakebaker

    @SAT: I updated the links in the article. The tutorial may still work, but I recommend to look at the bakery or the google group for newer information.

    HTH

  • cakebaker

    @yunhaihuang: I’m not sure I understand you correctly, but yes, if you assign a new value to the $paginate variable then that value is used for the pagination. A simple example:

    class PostsController extends AppController {
        public $paginate = array('limit' => 2);
    
        public function index() {
            debug($this->paginate('Post')); // returns two posts
            $this->paginate = array('limit' => 3);
            debug($this->paginate('Post')); // returns three posts
        }
    }
    

    Hope that helps!

  • yunhaihuang

    thanks!

  • yunhaihuang

    hi!
    may view page show a list of months which have the exhibitions, and each month show the exhibitions is hold in that month.
    i want to display each page content two months, and each month display three exhibitions. how can i do this?
    may i use two different paginator in the same view page?

  • yunhaihuang

    hi! please help me to solve these two questions:
    1.in the paginator helper, may i modify the sql query of function counter . because in default, this query is “SELECT COUNT(*) AS `count` FROM ….”, i want to modify it like “SELECT COUNT(MONTH(startdate)) AS `count` FROM… ” (startdate (data type: date) is one field in my database). how can i do this?

    2.My view page show a list of months which have the exhibitions, and each month show the exhibitions is hold in that month.
    i want to display each page content two months, and each month display three exhibitions. how can i do this?
    may i use two different paginator helper in the same view page? if can, how to do this?

  • yunhaihuang

    hi! please help me to solve these problem:
    1. can i modify the sql query of function paginateCount(), which counts how many pages is, to fix an Individual pagninate? i don’t want to override this function as “http://book.cakephp.org/view/164/pagination”, doing this will affect my other paginate.
    in default, it’s sql is “count(*) as count…”, i want to edit it like “count(distinct MONTH(startdate)) as count…”. if i can, how to do that?

  • yunhaihuang

    2. in my view, i display a list of months which hold exhibitions, each month i display the exhibitions is hold in. I want to show only two months on each page, in each month, only 3 exhibition is displayed. so i have to paging with two different criterion. how do i do this? i’m using ajax in paging. the function to retrieve data is index().
    thanks a lots!

  • cakebaker

    @yunhaihuang: An idea for point 1 is to create a new model which uses the same table as the original model. In this new model you then override the paginateCount() method. But I’m not sure whether this is the best solution…

    Regarding point 2 I don’t know how you could accomplish that, you might ask in the CakePHP Google group or in the IRC channel, maybe someone there has an idea…

    Hope that helps!

  • cakebaker

    @yunhaihuang: Probably a better idea for point 1 is to set a certain value for the conditions and depending on this value you either perform the normal count or the custom count. Example:

    // in your controller
    $this->paginate['YourModel']['conditions'] = 'custom';
    
    // in your model 
    public function paginateCount($conditions = null, $recursive = 0) {
        if ($conditions == 'custom') {
            // perform count with custom query
        } else {
            // perform normal count
        }
    }
    
  • Thinking about the pagination feature - cakebaker

    […] I was asked by yunhaihuang some questions about advanced pagination stuff I couldn’t answer […]

  • yunhaihuang

    Thanks a lots for your advices. i’ve solve my first problem by using your idea. thanks a lot!
    The second problem hasn’t been solved yet!

  • cakebaker

    @yunhaihuang: Cool to hear you could solve at least one problem!

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License