Posted by wernerglinka on November 15, 2011 at 5:55am
4 followers
| Project: | Views RSS |
| Version: | 7.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
The current version generates a comma separated list inside the element. I needed a element for each category. I modified function theme_views_rss_fields_element in views_rss_views_fields.theme.inc to achieve that. On line 112 it says:
else {
return "<$key>" . check_plain(htmlspecialchars_decode($value['#markup'])) . "</$key>";
}I changed that to:
else {
if ($key == 'category') {
$row_temp = '';
if (strpos($value['#markup'], ',')) {
$categories = explode(',', $value['#markup']);
foreach ($categories as $category) {
$category = trim($category);
$row_temp .= "<category>".check_plain(htmlspecialchars_decode($category))."</category>";
}
return $row_temp;
}
}
return "<$key>" . check_plain(htmlspecialchars_decode($value['#markup'])) . "</$key>";
}Maybe the maintainer can include this in a future update.
Comments
#1
How about a patch based on your proposal?
#2
This feature has been implemented in both 2.x-dev branches.
Please note that they are still under development, most features should already work fine though (however be warned that things still could change there).
Also, would be great if I could get some feedback on them...
#3
^I am using the 7.x-2.x-dev version and I have my ITEM ELEMENTS: category set to Tags. For my Tags field setting I have "display multiple items on same row checked" and I am using the simple separator ","
However, my tags are all still printing out in the same element as so:
<item><category>Tag 1, Tag 2, Tag 3</category>
</item>
It would be great if I could wrap each of the tags in their own category as such:
<item><category>Tag 1</category>
<category>Tag 2</category>
<category>Tag 3</category>
</item>
However, I'm not able to get this working. Also, I noticed that the core functionality of the views_rss module is changed in the newer versions so the patch in this thread no longer works. I believe the new function to process the
<category>elements is views_rss_core_preprocess_channel_categoryAny suggestions on how I can make this work? Thanks!
#4
#5
First, please do not re-open already closed issues. If you need help, please open new support ticket.
Then, for
All taxonomy termsfield there is no "display multiple items on same row" option - therefore I guess you are using different field, so it's quite possible it is not going to work as it was not tested/designed for other fields.Please switch to
All taxonomy termsfield, useRSS <category> elementfield display type and create a new ticket if it still does not work for you.#6
Thanks, that did it. Sorry for re-opening the status queue.