Hi mao,

[EMAIL PROTECTED] wrote:
> My brief question:
> How to access CommentsController in SessionsController?

Most definitely using requestAction

> I tried
> $this->requestAction("comment/listCommentPaginated/".$currentSession["id"])
> but I didnt find a way how to pass parameters for pagination into this
> action...

There´s /always/ a solution, and usually more than one.

1) You could put $uses = array("Session","Comment"); and just pass
(array("Comment.Session_id"=>$currentSession["id"]),array('modelClass'=>"Comment"));
to the component, it will then query the Comment model, instead of the
Session model (thus giving you the number of comments that match the
results, and not the number of sessions). However this is a bit messy
dragging bits of Comment into Session like that..

2) The parameters are all in the url, in terms of passing parameters (I
assume by that you mean when you press a link?) you could easily solve
that using ajax updates*, otherwise when your Session page refreshes
you just need to construct the correct URL to call requestAction with.

[EMAIL PROTECTED] wrote:
> Hmm, no responses? But this also means I cant have two paginations on
> one page, which is in my opinion severe restriction...

It´s only been a day, and it´s August :). Regarding 2 paginations on
the same page: Sure you can :) You have 2 possibilities:

1) More complex: if you are not using ajax it´ll be up to you to
manage how the url parameters for your ´parent´controller map to what
the pagination component is expecting. using requestAction you would
pass the url that the pagination code will understand and take care of
(e.g. in the view echo
$this->requestAction(""comment/listCommentPaginated/".$currentSession["id"]."?sortBy=created)

2) Much easier: If you are using ajax updates, you would just wrap each
requestAction call in a named div, and tell the pagination
component/helper which div to update in each case*

HTH,

AD7six
* untested code example:
http://www.cakephp.org/pastes/show/f0f66adcf7e0b6b45b59d7d85954af45


--~--~---------~--~----~------------~-------~--~----~
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