Clinkpager Without Cdbcriteria

Hi, I am a newbie in yii. I want to know whether it’s possible to create a Pagination using CLinkPager without CDBCriteria. I have an array generated from a query builder. But CLinkPager requires offset which comes from criteria by default. Can I convert this array into a criteria or is there some other way?

Actually, it does not.

CLinkPager requires CPagination, so instead of (example from docs)

    $criteria=new CDbCriteria();


    $pages=new CPagination($count);

    // results per page




you can do something like this:

    $data = array(...); // here's your array generated

    $pages=new CPagination(count($data));

    // results per page


    $start = $pages->currentPage * $pages->pageSize;

    $end = $start + $pages->pageSize;

    $models = array_slice($data, $start, $end);

(haven’t tested it by myself, but should work).