Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Quarath on
I need to output view in XML format. I'm able to format all the fields and such so i get the whole XML in $page['content'].
Just can't figure out how to remove everything what is before and after it (HTML head, body tag and such).
Comments
I'd use template suggestions
I'd use template suggestions and override the page.tpl.php etc. Though, it might be easier using a module like this http://drupal.org/project/views_data_export
Data export module exports a
Data export module exports a file through a page -> useless in my case. I need clean XML directly when i go to http://mypage.com/myxml
Also how i get rid of everything whats around the stuff rendered in page--myxml.tpl.php?
Have you tried Views Data
Have you tried Views Data Export, it produces an XML "page" (not sure why you are using a page-myxml.tpl.php file)
I'm pretty sure you can view
I'm pretty sure you can view the XML as a page in that module.
OMG you are right, it's just
OMG you are right, it's just "hidden" under "Batched export:" option.
Thanks you.
PS: anyway would like to know how to strip those things around "content". :)
Your page.tpl.php would
Your page.tpl.php would output just $content and you would need a custom html.tpl.php (see http://drupal.org/node/1041768#comment-4011104, you will want to override based in path though). In your custom html.tpl.php either output nothing or output XML wrappers.
Ok, so now in template.php i
Ok, so now in template.php i have
which loads html--myhtml.tpl.php
and in page--myview.tpl.php is
still i'm getting some wrapers around it and content of other regions :(
Are you sure your templates
Are you sure your templates are being used (did you clear the theme registry)?
They're not from the Views
They're not from the Views templates are they?