Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
6.x-2.5
Component:
feed displays
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Oct 2008 at 06:59 UTC
Updated:
27 May 2012 at 12:01 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
merlinofchaos commentedViews does not currently support this, though it may in the future. It basically requires making a variant of the node_rss style plugin that uses fields and puts them in. Kristof made a patch for View for Drupal 5 that does this, maybe if we're lucky he or someone clued will be able to do this for Views 2 as a module.
Comment #2
illuminaut commentedJust want to mention that I'm in need of this feature, too. Any workarounds for the moment? Since the RSS feed "Node" row-style allows you to select title+teaser, it seems like there could be a way to hack the teaser to include one or more CCK fields. Could that approach work or wouldn't it be any easier than creating a new row-style plugin?
Any particular reason why the Node row-style for feeds aren't themable?
Comment #3
Bensbury commentedI've seen some workarounds with people writing their own mini-module or editing lines in drupal code.
However folk really haven't explicitly said where they did the hacking and when I tried the mini-module this chap made drupal said it was not compatible with Drupal core 6. +++
(which basically means the solution is way to complex for me to figure out).
Really could use that patch though.
Comment #4
Bensbury commentedI'd like find out how to do this from Kristof.
In my searching for how to do this I see any people posting about custom fields in RSS views and most get no reply because no one has the answer.
There are new ones very couple of days.
I think this is feature request has a bit of demand.
Comment #5
WorldFallz commentedI agree it seems a valuable feature and there has been some interest expressed in it-- though the posts you mention are almost all yours since you just spammed the forums resurrecting posts over a year old and updating them with the exact same request of yours to comment on this issue.
That's not really a good way to go about getting a feature implemented. 100 people could "+1" this thread and it will make no difference unless someone 1) provides the code or 2) offers to sponsor it. You can't comment people into doing your bidding.
I'm guessing for the time being most of this can be addressed with contemplate and/or views_datasource. In d7 there's some work being done on an issue to incorporate different output format rendering in core.
Comment #6
Bensbury commentedHi,
The reason I did that was to direct people who have made the same requests and ask the same question to a central location.
It makes no sense to have people posting new threads constantly when they could all come to a central one.
Also the news threads I see never get an answer and that is depressing when you have a problem and no one responds to your post.
If I knew the answer I would 'spam' those old threads with the answer so the people who find them in the search would get the answer.
In my spam it informs people from those threads of the closest ways to do it: Views/contemplate/cck and format_xml_elements function of which some people claim works with Drupal 5.
(doesn't work for me)
The reason for that is I have spent a lot of time typing various things into the search box and finding the same questions in a variety of threads.
And different searches pull up different threads, so you won't guarantee people will find the same bunch; depending on their choice of keywords.
I also check those threads to see if there has been any new information posted too.
The original poster is going to check their thread: like I do.
Also other people also will be finding these threads and my 'spam' will direct them to a location where something might get done about it.
A person who knows something about it might come here.
In this thread Merlin of Chaos has suggested it might be a feature for Views2 and also that Kristof might know how to make a patch for Drupal 6.
If a 100+ request it I would feel that Kristof or someone in the know would be more inclined to make a patch for it than just one person; and in that 100 there would be people who could assist.
I'm trying to centralise an effort and if I find a solution you can bet I'll be posting it here.
I've found some new stuff on views_datasource which someone has written a patch for.
If it works out I'll be letting people know.
Comment #7
Bensbury commentedSOLUTION for XML in RSS Feeds
I found a work around.
Hopefully someone can find a better way.
It uses the views_data source model ...well actually a rewrite for it. No Contemplate.
I’m using a patched version of the views_datasource module by jozzhart and jacerider put here:
(obviously you still need views2)
http://drupal.org/node/307223
Please read his instructions
Then added a patch for the XML output here by mbutcher:
http://drupal.org/files/issues/views_datasource-306066_01.patch
I installed all the views datasource modules (that seems to make it work).
Made the view a page.
Chose the style as XML data document.
Made the Row Style Unformatted.
In the row style settings made the separator: |
Then you make your view and it outputs XML!
There is one problem and that is it makes the element tags read the variable name:
eg:
However you can hack this in a very bad way (I’m not a coder).
In views-views-xml.tpl.php in modules/views_datasource:
From line 50: $label = str_replace('_value', '', str_replace("profile_values_profile_", '', $label)); //strip out Profile: from profile fields
Add:-->
--------
if (is_null($value) || ($value === '')) continue;
http://drupal.org/node/318864
This uses the end of the string which is delimited by the underscores _
The only caveat is to avoid using underscores in your CCK names.
My output looks like:
If that helps you then great!
As this is kind of off-topic now is there somewhere I should post this solution?
Comment #8
miro.log commentedHi,
after having looked around for a while for an answer to the following, I see that my understanding of views is too limited to be able to imagine if what follows is possible.
is there a way to add book content-type related non-cck informations to the XML output, in a similar manner as for field labels (as shown on #7, by retrieving this information directly from views-view-xml.tpl.php)?
I imagine it would be very useful to obtain such an output, especially for pre-press usage of the rendered XML...
This is the expected output:
<tagline1_depth>This is the tagline</tagline1_depth>where depth is the depth of a book node...
Many thanks,
miro
Comment #9
miro.log commentedHi,
I did it (in views-view-xml.tpl.php), an also added a few lines to easily remove undesidered fields from the rendered XML... If anybody is interested I can post the code here (actually it's totally messy an full of comments, so I would need to prepare it for posting it here).
Thanks,
Miro
Comment #10
aurelien-bordeaux commentedThat would be great!
Comment #11
darrenmothersele commentedThere are RSS settings for the fields added by CCK here:
http://localhost/admin/content/node-type/examplenodetype/display/advanced
Where I can select if and how the CCK fields should be rendered in RSS feeds. Is it not possible to use this setting within the feed node style within Views 2?
Comment #12
tyromind commentedYes mirob, please post. I switched to using the filefield instead of the upload module, however it broke the built-in attachment of the files in the feed, and as far as I have found, there's no built-in way to substitute in a filefield in it's place.
Comment #13
darrenmothersele commented+1 for mirob to post how you've done this in views-view-xml.tpl.php
I have added fields into the XML by hacking .
In views_plugin_row_node_rss() in the file views_plugin_row_node_rss.inc provided by views it includes a call to other modules to alter the RSS, like this:
Shouldn't CCK fields add themselves into the RSS here?
Comment #14
darrenmothersele commentedthis may be a CCK issue: #310846: no CCK Fields in RSS
Comment #15
miro.log commentedHi, sorry for this late.
Here the hacked
views-view-xml.tpl.php,views_xml.module(I just commented a few lines in theviews_xml_strip_illegal_charsfunction, to maintain line breaks in the XML) and the exported view I used.Basically I was in need of a method for the quick rendering of stored nodes in a pre-press ready XML.
The method is intended for the use with book nodes, because of their depth variable, an integer that can be used to better define the XML tags, by specifying their depth in the publication hierarchy, and to reproduce the hierarchies of an exported company database (flat .csv file) by mass-importing childs into parents, as (for example) products into families of products.
This way, it becomes very simple to map them to their relative Indesign paragraph styles: an
<xml tag>will be named differently on a per depth basis:<title_0>can represent the main publication title, while<body_1>can represent the content of a chapter and<cck-custom-field_4>a styled note at the end of a page.Hope this can help, also letting you know me if my approach is somehow or conceptually (from a drupal perspective) wrong...
CCK field I added to setup this demo: txt001, txt002, txt003, txt004, txt005.
1. views-view-xml.tpl.php
download hacked views-view-xml.tpl.php
- for an "automatic" rendering of the XML (as on the original views_xml.module), uncomment lines marked as
// AUTOMATIC- to render stored book nodes on a per-field basis (by manually adding them as elements of a "custom XML layout"), uncomment lines marked as
// MANUALdownload hacked views-view-xml.tpl.php
2. views_xml.module
3. the exported view
$view = new view;
$view->name = 'print_exporter_xml_001';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
'depth' => array(
'label' => 'Depth',
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 1,
'id' => 'depth',
'table' => 'book_menu_links',
'field' => 'depth',
'relationship' => 'none',
),
'title' => array(
'label' => 'Title',
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'body' => array(
'label' => 'Body',
'exclude' => 0,
'id' => 'body',
'table' => 'node_revisions',
'field' => 'body',
'relationship' => 'none',
),
'field_txt001_value_1' => array(
'label' => 'Publication name',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_txt001_value_1',
'table' => 'node_data_field_txt001',
'field' => 'field_txt001_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_con001_value' => array(
'label' => 'Publication content 001',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_con001_value',
'table' => 'node_data_field_con001',
'field' => 'field_con001_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_txt002_value_1' => array(
'label' => 'Typology name',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_txt002_value_1',
'table' => 'node_data_field_txt002',
'field' => 'field_txt002_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_con002_value' => array(
'label' => 'Typology content 001',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_con002_value',
'table' => 'node_data_field_con002',
'field' => 'field_con002_value',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'field_dec001_value' => array(
'label' => 'Optional decimal data 001',
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'be_2',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_dec001_value',
'table' => 'node_data_field_dec001',
'field' => 'field_dec001_value',
'relationship' => 'none',
),
'name' => array(
'label' => 'Term',
'link_to_taxonomy' => 0,
'exclude' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'relationship' => 'none',
),
'weight' => array(
'label' => 'Weight',
'exclude' => 0,
'id' => 'weight',
'table' => 'term_data',
'field' => 'weight',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('sorts', array(
'field_txt001_value' => array(
'order' => 'ASC',
'id' => 'field_txt001_value',
'table' => 'node_data_field_txt001',
'field' => 'field_txt001_value',
'relationship' => 'none',
),
'field_txt002_value' => array(
'order' => 'ASC',
'id' => 'field_txt002_value',
'table' => 'node_data_field_txt002',
'field' => 'field_txt002_value',
'relationship' => 'none',
),
'field_txt006_value' => array(
'order' => 'ASC',
'id' => 'field_txt006_value',
'table' => 'node_data_field_txt006',
'field' => 'field_txt006_value',
'relationship' => 'none',
),
'field_txt003_value' => array(
'order' => 'ASC',
'id' => 'field_txt003_value',
'table' => 'node_data_field_txt003',
'field' => 'field_txt003_value',
'relationship' => 'none',
),
'field_txt004_value' => array(
'order' => 'ASC',
'id' => 'field_txt004_value',
'table' => 'node_data_field_txt004',
'field' => 'field_txt004_value',
'relationship' => 'none',
),
));
$handler->override_option('filters', array(
'type' => array(
'operator' => 'in',
'value' => array(
'book' => 'book',
'page' => 'page',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'list');
$handler->override_option('style_options', array(
'grouping' => '',
'type' => 'ul',
));
$handler->override_option('row_plugin', 'unformatted');
$handler->override_option('row_options', array(
'separator' => '|',
));
$handler = $view->new_display('page', 'XML', 'page_1');
$handler->override_option('style_plugin', 'views_xml');
$handler->override_option('style_options', array());
$handler->override_option('path', 'exporter/xml');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Export XML',
'weight' => '0',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_2');
$handler->override_option('path', 'themed export');
$handler->override_option('menu', array(
'type' => 'normal',
'title' => 'Export themed XML',
'weight' => '0',
'name' => 'primary-links',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'weight' => 0,
));
Please find attached the expected XML (obtained in D5+node_import+hacked export_dxml) and the hacked .tpl.php file (D6).
It would be great if an RSS feed could be formatted in such a manner. I imagine this could be done via custom .tpl.php files within views_data_source: such custom .tpl.php files could then become selectable as addictional "styles" within the views2 Basic setting/style/Defaults: How should this view be styled form (please correct me if I'm wrong).
By customizing such .tpl.php files, a collaborative publishing enviroment would be easily customized to offer a pre-press ready XML, based on tags (currently I'm basing it on a book structure only.
Comment #16
miro.log commentedHere a sample of the rendered XML (sorry, I was unable to correctly publish it between the code tags so I took a screenshot).
Comment #17
yang_yi_cn commentedsubscribe
Comment #18
presleyd commentedVery interested, subscribing
Comment #19
adamcarsonb commentedI would like this feature for an easy way to pull data into Actionscript's XML loader. I know there are other methods like AMFPHP and others, but they're way too overkill for my typical needs.
subscribing...
Comment #20
dermotholmes commentedIm on the actionscript XML loader bandwaggon too
subscribing :)
Comment #21
merlinofchaos commentedFor pure XML see views bonus pack or views_datasource
Comment #22
presleyd commentedJust a note to others that neither of these two add-ons is updated for the latest versions of Views since the API changes and bonus pack isn't out for Drupal 6 either.
Comment #23
merlinofchaos commentedpresleyd: Why are you spreading lies? http://drupal.org/project/views_datasource for Drupal 5 and 6 right there.
VPB is undergoing work, I didn't realize there wasn't a dev release out.
Comment #24
presleyd commented@merlin
Note that I said they are not updated for the Views 2 API changes and that only VBP does not have a 6 package.
That version of Datasource does not work with the recent Views 2 API changes as per the numerous issues open about it: http://drupal.org/project/issues/views_datasource?states=all
Comment #25
dwees commentedCheck out:
http://drupal.org/node/307223#comment-1040887
Comment #26
Bensbury commentedDatasource works fine with Views 2.
Look at comment #7
It works, and it's XML.
That was the whole point of researching this.
You need the patch as mention in #7 which is also in the link above in comment #25.
Also AMFPHP seemed scary at first but actually it isn't hard to set up at all and it's fantastic as you can avoid parsing XML if you are using this for Flash-Drupal communication.
The node turns up as a Flash Object with the fields as separate properties.
I made a .zip file with all the modules/patches included to help people use it here:
http://drupal.org/node/219365#comment-1083913
Comment #27
drewish commentedI might be missing the usecase that everyone has in mind but I really think the proper place for this to happen in the CCK field's display handler RSS. They can cram what ever data they want into the additional elements and it gets formatted correctly with XML namespaces and all.
Comment #28
john.arroyo commentedI'm on the actionscript XML bandwaggon too. Essentially just want an easy way to add custom fields to an xml feed
Comment #29
tyromind commentedsame here. hacked it together at the moment using file field podcast to get file fields to flash - worked as a test - but need to pass along other fields as well
Comment #30
ambientdrup commentedI have this working per post #7 above with Drupal 6.x and Views 2.x and Views Datasource. I'm getting a valid XML document output. This is working for all of my CCK text fields. However, how do I output image files (using CCK imagefield) into my XML doc using the XML Data document plug in. Is this possible? I have uploaded image files into my custom content type, but I can't get those image files to output nicely in my XML - as a path to the file for example, or a URL to the file. I'd prefer to output them as URL to the image file. I'm currently getting this as the output:
1 a:0:{}That's how the image field is outputting.
Is this possible to tweak so the URL is output?
-backdrifting
Comment #31
Anonymous (not verified) commentedSubscribing
Comment #32
onu commentedhey guys great work, I got all the stuff to work and I get a nice clean xml out of it, awesome. My problem is same as backdrifting, I try to include link/url to a image/images that I post in a custom cck field. I'm using views_datasource and all i get is a:1:{s:11:"description";s:0:"";} where the link should be.
Please help, this is for a personal portfolio and I've been trying to get to this point for a while now and I'm so close.
Cheers
Michal
Comment #33
ambientdrup commentedHere's a workaround for the image issue. If I use Link field and add the full URL paths to the respective uploaded images it works. The URL gets output in the XML. Here's some instructions on this:
1) I created "link" fields for all my images - so I have an image field and then a corresponding link field for the same image.
2) In the link field I add the full URL path to the image that I upload to the server
3) In my View I export the link fields as URL, as link. The URLs then output correctly to the XML doc. In your XML you should get something like this:
/sites/default/files/599px-Second_stellation_of_dodecahedron_0_0.png
with full path before the /sites obviously. I don't output the actual image field in my View. Just the URL link field for the images.
So I was able to pull the URL into the Flash piece we're using and to display the image so this appears to work.
Hope that helps. It's a workaround until someone develops a patch for the image field output.
-backdrifting
Comment #34
onu commentedthanks backdrifting, this solution works ( a bit more work but better than nothing),
how can we get this Views Datasource issue fixed? who do we contact?
Cheers
Comment #35
capellicI too want to add an image field (ImageField) to my RSS feed. Per drewish's suggestion (#27), it looks like this issue and patch takes care of this? I haven't tried it out yet.
http://drupal.org/node/353090
Comment #36
lelizondo commented@merlinorchaos: where's the patch for drupal 5?
Comment #37
Oghnia commentedsubscribe
Comment #38
Sinan Erdem commentedCheck out the views bonus pack. It has a plugin for outputting xml files. It worked fine for me... It writes the url of the images and I can easily use the xml in Flash.
Comment #39
lelizondo commentedwith drupal 5.x? couldn't find anything to output xml files with drupal 5.x
Comment #40
Sinan Erdem commentedI am using Drupal 6.
On project site of VBP they say for D5:
I dont know if it is made yet...
Comment #41
tyromind commentedjust in case anyone missed:
Issue #365183: node_feed() silently discards $node->content regarding RSS handling in Drupal core has been fixed in 6.10 - CCK fields will now show up in RSS feeds - goto Content Type / Display Fields to show/hide/select formatters - views still only has the node option so you can't set the field options from there using the standard Feed display.
Comment #42
perandre commentedI'm interested in customizing all my (cck'ish) feeds with views...would be great.
Comment #43
theunraveler commentedSubscribe.
Comment #44
emackn commentedAs of today, not sure how far it goes back, but views_datasource does not work.
Comment #45
lelizondo commentedActually doing this is pretty easy with contemplate, you just have to customize the rss template using xml elements, see http://drupal.org/node/300790 for an example.
then, you can apply all kind of filters with views. the only limit for this solution is that you can't use a 'fields type' view, it has to be a 'node type' but it works. also, I don't know if it works with images, didn't try that.
after you map the fields with xml elements you can share content across drupal sites with rss/feed api very easy. for example, I'm sharing a calendar using date field and calendar modules in both sites and I create the events in one site and with feed api and feed element mapper I publish the events in both sites using calendars, is pretty cool! I might create a tutorial for these as soon as I have some free time and I'll let you know.
Comment #46
merlinofchaos commentedI'm closing this issue; this will not be a feature within Views. It should be a feature of a module. If not VBP or the sadly undermaintained Views Datasource, another module can or should do it, if it hasn't already happened.
Comment #47
jyg commented| Posted by darrenmothersele on October 17, 2008 at 12:31pm
| There are RSS settings for the fields added by CCK here:
| http://localhost/admin/content/node-type/examplenodetype/display/advanced
| Where I can select if and how the CCK fields should be rendered in RSS feeds. Is it not possible to use this setting within the feed
| node style within Views 2?
Wow, did everyone ignore this golden piece of advice? Its not exactly theming, but at least you can remove node fields! There's nothing on the .../display/ page that shows you there's a .../display/advanced/ page! ??? Why isn't this documented?
Thank you darrenmothersele!
jyg
Comment #48
balakumarjayapal commentedHi i want to display image url with delimiter in Views with XML Data Document
I need like this format
"<"image">"http://www.eg.com/img/1.jpg | http://www.eg.com/img/2.jpg | http://www.eg.com/img/3.jpg |http://www.eg.com/img/4.jpg "<"/image>"
but it display like this in views
"<"image>"http://www.eg.com/img/1.jpg"<"/image">"
"<"image>"http://www.eg.com/img/2.jpg"<"/image">"
"<"image>"http://www.eg.com/img/3.jpg"<"/image">"
"<"image>"http://www.eg.com/img/4.jpg"<"/image">"
Please any one help me new to drupal & php . i want to display all the images with in single tag for particular node.
Comment #49
WorldFallz commentedPlease don't hijack old closed issues. Issues are free-- create your own ;-)