Closed (fixed)
Project:
Views data export
Version:
7.x-3.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Jun 2011 at 14:03 UTC
Updated:
25 Aug 2013 at 13:56 UTC
Hi, I ma using the latest dev version to generate xml.
I am getting this result
<?xml version="1.0" encoding="UTF-8" ?>
<nodes>
<node>
<product>GG Spiro</product>
<description>Velmi pohodlná golfová čepice Galvin Green Spiro. Vyrobená z bavlny. Potěší každého kdo si jí nasadí.</description>
<price>740</price>
</node>
<node>
<product>GG Abel</product>
<description>Nepromokavá a velmi lehká golfové čepice Galvin Green Abel.</description>
<price>960</price>
</node>
I wonder how I could rename "nodes" and "node" tags. Thanks.
Comments
Comment #1
steven jones commentedYou can do this by adding three theme preprocess functions that override the defaults of using the base table to create labels for the root and child nodes.
Have a look at:
template_preprocess_views_data_export_xml_headertemplate_preprocess_views_data_export_xml_footertemplate_preprocess_views_data_export_xml_bodyIn theme/views_data_export.theme.inc
Comment #3
dedek commentedThanks for great module. Will you be so glad as to explain how to rename "nodes" "and "node" more detaily (for no programmers)? For "products" and "product".
Comment #4
rosso69 commentedThanks for this soultion (#1), i only have question left.
I like to use an id in when i change template_preprocess_views_data_export_xml_body i still get the same root node name.
Is there a way to change $vars['item_node'] for each item?
Comment #5
liquidcms commentedtpls are cool and all; but sure would be nice if this was a simple views config option.
Comment #6
liquidcms commentedhmm.. figured to find node/nodes in those tpl files or the theme.inc; but nope... so bit more work to figure this out... suspect this could be made a bit more simple.
Comment #7
liquidcms commentedcopy the following functions and paste into your template.php:
template_preprocess_views_data_export_xml_header
template_preprocess_views_data_export_xml_footer
template_preprocess_views_data_export_xml_body
from theme/views_data_export.theme.inc
and rename as:
[yourtheme]_preprocess_views_data_export_xml_header
[yourtheme]_preprocess_views_data_export_xml_footer
[yourtheme]_preprocess_views_data_export_xml_body
and change all occurrences of $vars['view']->base_table to your root node name (like "product" or maybe even t("product")).
Comment #8
steven jones commentedComment #9
strykaizerFor me, this worked in template.php (replacing nodes/node with articles/article)