Passing $view->url so that pager links are correct

pcdonohue - December 5, 2007 - 00:41
Project:Component
Version:5.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi,

I've set up an embedded view inside of a page, and am using the component module to issue an ajax call to load a view. The use case is basically that I want to use ajax to load new pages of the view, rather than having to load the whole page that the view is embedded in.

So using jquery, I call the component module to load the view, via a $.get() call to 'component/view/viewname'

Everything is working fine except that the pager links now point to 'component/view/viewname' instead of the original page it was embedded in. i.e. instead of pointing to 'mysite.com/welcome?page=1' they point to 'component/view/welcomeview?page=1'

A little bit of digging brought up the reason, http://drupal.org/node/99721#comment-252005 quoted below

If you have any Exposed filters on the embedded View, you need to pass-in a correct URL, otherwise the Submit button on the filters will break (i.e. point only just to the View, so after clicking the button you'll get it NOT embedded inside your original page).

The correct way is for example like this:

<?php
$view
= views_get_view('myCustomView');
$view->url = 'node/$arg';
print
views_build_view('page', $view, array(0 => 3), false, false);
?>

So how do I pass the correct url, so that component knows to build the view with that url?

Patrick

#1

pcdonohue - February 6, 2008 - 20:55

Thoughts? :)

#2

aasarava - October 8, 2009 - 04:54

pcdonohue, did you ever find a solution to the pager link problem? I've run into the same problem (in 6.x-dev). Anyone?

 
 

Drupal is a registered trademark of Dries Buytaert.