We're using the Views XML Backend module to display XML data in our Drupal site from an XML-based Web API. (We actually have an integration tool wrapping the API, so we can transform data going into the Web API call. For example, I'm transforming JSON data into XML.)

I'd like to be able to use pagination in Drupal so that the users see that they are viewing results 1-20 of 500 results (for example), then pass the pagination information along to the Web API. The API (which was written in-house) can take the number of results to retrieve and either the page number or the first result to retrieve.

How can I achieve this?

I'm relatively new to Drupal, so please be patient. Thanks!

  • what specific community modules are you using for views + xml ? – tenken Jan 23 '14 at 21:54

Searching for pager in the issue queue of Views XML Backend shows that the plugin can output the info you want.

You should be able to add to the Header region of the view a Global Results Counter which shows text like "Viewing X of N to M records". All of this is done in the Views Administration UI for your View.

You could then call the page via curl or via views_embed_view using php programatically to pass and or set the page number and records per page as needed to get the results you want.

  • thanks for your reply. I take it then that there's no way that you know of to do this without going into PHP? Either way, can you provide a little more detail? Where would I go to put the code? – Don 01001100 Jan 27 '14 at 16:10
  • I'm sorry, i just ment under views you can embed the views results counter. it's just an option under the Header area for any View. I dont know your codebase so I cant tell you where to place php code or how to call your custom built webservice to hit this view. The View would probably live at a url path defined in hook_menu or using the Services community module. – tenken Jan 28 '14 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.