'Twas brillig, and Marko Korhonen at 05/02/09 18:31 did gyre and gimble:
Hello,

I have a hard nut to crack.

I'll try to explain my situtation:

My Default_IndexController::indexAction is my frontpage.

I use action helper to call another controller/action:
Somemodule_ListController::latestAction

There I have Zend_Paginator working nicely.

This results my list to be rendered to the frontpage as sidebar block. Ok,
next I'd like to have my list pagination controlled by ajax so I attach
javascipt functions to pagination links.

But the problem is following:
Zend_Paginator partial uses url() view helper to create
first/previous/next/last links to the list.

Now becouse I used action helper, url() helper points all links to my
frontpage = /default/index/index/page/2. I know this is becouse request
object is the same as in my frontpage which is making the action call.

So, I can't have my Ajax controls pointing to the right place =(

Any thoughts?

I just ran up against a very similar problem.

What I have is:

1. A URL that can display paged links. In my case I use query strings as the URL structure is reserved for other uses.

So I have e.g.:
/administrator/entries?p=2

This is the main page (incl layout via Zend Layout) and works fine.

But if I just want the segement of the page that is jsut the paginated results, the partial URL is:
/administrator-part/somemodule/entries/list?p=2

To get these two types of links, I just rolled my own view helper to make things easier (I also had to pass through other params such as a q=foo argument) but really it's just about setting up the two different routes, one for the full layout page and one for the partial page and passing the route name as the second argument to url(). That way you can generate full page links for the href="" bits and pass the partial page for an ajax thing. That way if the ajax bit fails, it still falls back gracefully to the href and full page reload.

Col


--

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mandriva Linux Contributor [http://www.mandriva.com/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

Reply via email to