开发者

Alphabetic pagination with Symfony 1.4

I was wondering whether I can paginate my results using the letters in the alphabet instead of numbers. Do you know any methods to accomplish su开发者_如何学Pythonch a task in Symfony 1.4? I'm using Doctrine and I fetch the paginated records from the database.


After some search, no such pagination seem to exist directly with Symfony/Doctrine ; you will have to create your own.

You will have to iterate through A to Z for links (usability improvement: adding links only on letters "containing" elements you are handling)

And end up by Model side, by doing something such as:

$q = Doctrine_Query::create()
    ->select('e.id')
    ->from('Element e')
    ->where('e.name LIKE ?', $letter.'%');

echo $q->getSqlQuery();

etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜