Morning all,

Obligatory apology if this has been discussed before. I've searched
around and can't seem to find what I'm looking for so far.

Basically, I've employed one of the pagination scripts from the wiki
(thanks Gwoo) and it works perfectly when I am listing my top level
models. However, when using a hasMany assocation or a HABTM assocation
I'm using the general findAll scripts to return related models. So I
end up with my array looking something like:

Array
(
    [Image] => Array
        (
            [id] => 25
            [code] => 0001
            [title] => this is a title
            [description] => this is a description dammnit
            [location] => <img src="/gallery/1155681063.jpg"
title="this is a title" />
            [status] => SUSPENDED
            [modified] => 2006-08-16 11:30:37
            [created] => 0000-00-00 00:00:00
            [deleted] => N
        )

    [ImageVersion] => Array
        (
            [0] => Array
                (
                    [id] => 30
                    [image_id] => 25
                    [width] => 467
                    [height] => 365
                    [dpi] => 100x100 pixels/inch
                    [size] => 37
                    [modified] => 2006-08-16 14:08:01
                    [created] => 2006-08-16 14:08:01
                    [deleted] => N
                )

            [1] => Array
                (
                    [id] => 29
                    [image_id] => 25
                    [width] => 500
                    [height] => 338
                    [dpi] => 96x96 pixels/inch
                    [size] => 32
                    [modified] => 2006-08-16 13:52:10
                    [created] => 2006-08-16 13:52:10
                    [deleted] => N
                )

        )
)

I would like to include pagination on this second level but I'm not
sure how to go about it using the current components and models. I
have an old pagination script I generally employ which grabs all
records from the database into an array or object and then removes
those that do not belong to the current page.

A nicer way of doing things would obviously be to only grab 10 (or
records per page parameter) records from the DB but I can't think at
the moment how to go about it using the CakePHP findAll method. I'm
thinking it may have something to do with bindModel on the fly but I
haven't mastered that bit yet.

Has anybody implemented something like this so far? Or has anyone ideas?

Thanks guys,
Mike

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to