When creating a view, you have to add an entry in:
Query settings: Settings
XML File:

I'm creating a module where I want to call the view.
However the XML path, in Query Settings, is a fixed entry.

My xml path changes and I would like to programmatically change the Query Settings XML File Path, Row Path, and Default namespace.

Is it possible to change these three settings programmatically in my module and then have it render the results?

I was looking into a handler, but I did not see any handlers defined in your .INFO file.
Any assistance would be greatly appreciated.

Thanks in advance,

Comments

arantxag’s picture

Hello,

I had the same problem.

what I did was use the module variable (http://drupal.org/project/variable) to configure URLs, and modify the function fetch_file() in the
views_xml_backend_plugin_query_xml.inc adding a call like $uri=token_replace ($uri);

I made this hack while I wait to see the evolution of the module. Maybe this module should be better integrated with token, to parameterize the urls.

I hope I've helped you

Ciao

gangaloo’s picture

hello arantxag -

Thanks for the solution provided above. That module is for D7 and I am using D6. I am stuck with finding another solution.
Which I have done! :)

My solution was to create my own view in my own module.

I used this site to start off with:

http://www.chilipepperdesign.com/2010/01/15/how-to-programmatically-crea...

Then what you want to do is Export your Views XML Backend View.

In your export you will find the handlers you need:

$handler->display->display_options['query']['options']['xml_file'] = 'http://foo.bar/xml.path';
$handler->display->display_options['query']['options']['row_xpath'] = '/foo/bar';

Then in your code, you can paste that in and replace the paths with variables.
Now I call the function to render the view and display the results.

Now you have full control of what you need to do and you can make it dynamic.

I hope it helps you or others in the community,

Thanks! :)

darren oh’s picture

Status: Active » Closed (duplicate)

A patch is available: #1370704: URL as an argument.