Hi!

I have a client that needs to publish a NewsML feed. I wasn't familiar with NewsML, but did a bit of research and it's really just an XML standard like RSS is.

So my first instinct was to theme a feed view.

I was able to theme the XML wrapper by using views-view-rss--customfeed--feed-1.tpl.php.

But I can't figure out what templates to set up for "channel" and deeper nodes in the XML.

In the views admin, the Theming Information shows this for Row Style Output:

.tpl.php, --customfeed.tpl.php, --feed.tpl.php, --customfeed--feed.tpl.php, --feed-1.tpl.php, --customfeed--feed-1.tpl.php

Questions:
1. Is theming a feed view the correct approach?
2. What templates to I need to implement in my theme?

Thanks in advance for your help!
Dave

Comments

tordrup’s picture

http://drupal.org/node/284768

...which tells me theming a feed view is not really possible.

Hacky php solution, here I come!

tordrup’s picture

I created a content type called newsml-article-list, and added CCK node reference fields. I rewrote the node template to generate a NewsML document instead of an XHTML page (and the page template to do nothing but print $content).

The template iterates through an array of the node reference fields, calls node_load() on each one, and creates the NewsItem based on the loaded node.

It's far from fool-proof: even though I scrub the content to strip out tags that are illegal in NewsML, the feed still chokes on poorly-structured content if that's what the NewsItem's author writes.

Still, I'm pleased with the results. If anyone is interested in the details, drop me a line. I'd post it all now, but frankly it will take a couple of hours to scrub out client-identifying details, so I don't want to spend that time unless somebody's interested :)

Dave
--
Cooper Web Design
www.cooperwebdesign.ca

i-medic.ro’s picture

Hi,

I have to do the same thing. Can you please share the details?

Thank you!