Drupal 6

robmaceachern - August 22, 2008 - 16:17
Project:Views Node Feed
Version:5.x-1.1
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Any plans for a Drupal 6 version of Views Node Feed?

Thanks.

#1

andrewlevine - August 23, 2008 - 03:42

Not at the moment but I will likely be asked to port this for work in the next few weeks. Patches accepted in case that's your thing :)

#2

tizzo - December 3, 2008 - 21:39
Status:active» needs review

I guess I needed this before you did! Updating for the new views 2 API required a pretty significant rewrite. I tried to stay as faithful to the original as possible.

One improvement is that the D6 version no longer requires an argument (/node_feed) in order to load the feed. Simply creating a feed in the UI with the style type "Views Node Feed" and specifying preferred feed in the style settings is all that is necessary. This allows you to create feeds that end in .xml (which can be handy when working with some existing Flash widgets).

This module currently exposes both $node and $nodes to the views_node_feed template (I dropped $type) and as such it builds fully loaded nodes before using the template to generate the output for each node (so it only works with nodes).

Given that views 2 can make lists of things that aren't nodes (and that they might be useful as XML/JSON) perhaps this should be reworked and it should be left to users to perform a node_load (or user_load as the case may be) in order to allow lists to be made from users, etc). Doing this would, however, also mean that the name is somewhat outdated (it could make a views feed of things that aren't nodes).

Perhaps this module should be retitled "views_template" (a less clever derivation of the contemplate naming)?

This patch should be run from inside views_node_feed directory.

AttachmentSize
views_node_feed-Drupal-6.patch 18.73 KB

#3

andrewlevine - December 2, 2008 - 18:05

tizzo, you are great! Thanks for this, I will make sure I look at this and get you feedback when I'm at work on Friday, no matter what my boss says. (sorry suzi, if you are looking at this)

#4

andrewlevine - December 7, 2008 - 05:36
Status:needs review» fixed

Hey, I committed this to a development branch. Thanks again

#5

jenniferism - December 9, 2008 - 21:34

subscribe

#6

jjjames - December 20, 2008 - 01:18

This looks cool thanks

#7

System Message - January 3, 2009 - 01:20
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#8

davexd - January 4, 2009 - 23:46
Status:closed» needs work

When I change my Feed Style to this "Views Node Feed", I'm then asked to configure the style. However, I can only see a label: "Views Node Feed Template" and an empty drop down box.

eg. http://img.skitch.com/20090104-p9p9djjthyx8cihcar254kc8se.jpg

#9

tizzo - January 8, 2009 - 17:34

You need to create a views node feed first at admin/settings/views_node_feed.

You're right though, it really should just give you a link to create one and not render an empty list. I'll roll a patch and update.

#10

guix - January 19, 2009 - 11:54

HUGE module ! Tizzo's port to D6 works perfectly, looking forward for a D6 stable release. Maybe at least a few views node feed templates like the XML one ? Which would resolve Davexd's issue.

PS : why is it impossible to choose 6.x-1.x-dev for the Version field ?

#11

jjjames - January 28, 2009 - 08:23

Thanks tizzo for making this patch. It would be great if someone could roll this out into an official D6 module. It's one of the missing links of D6 :)
I appreciate your guys work!

#12

gdoteof - February 14, 2009 - 01:18

I can't officially add it, but this is the patch applied (I also added the version number to the .info file) and should work like any other module for drupal 6.

thanks, this solved my views->xml problem pretty elegantly.

edit: i can't seem to edit the file but it should probably be considered a -dev version and it isn't labeled as such

AttachmentSize
views_node_feed-6.x-1.0.tar.gz 8.99 KB

#13

jjjames - February 14, 2009 - 07:36

wow great! now i just need to learn how to add cck fields to the output! (any help appreciated)

#14

gdoteof - February 14, 2009 - 15:25

something like $node->field_name_of_cck_field[0]['value'];

#15

no2e - February 14, 2009 - 23:08

subscribed

#16

andrewlevine - February 15, 2009 - 05:05
Status:needs work» closed

gdoteof, Just so you know, you can get the nightly snapshot of the Drupal 6 version here: http://drupal.org/node/343850

If there are any bugs, please open those separately.

#17

jjjames - February 15, 2009 - 05:11

Thanks...but it doesn't work for me :(

my field name is: field_image

and it's blank when i put the code:

<?php
print $node->field_image[0]['value'];
?>

do i literally put the 0 and 'value' inside the brackets? or do i have to replace them with some logic?

I would appreciate any help.
Thanks!

#18

andrewlevine - February 15, 2009 - 05:24

Do

<?php
var_dump
($node);
?>

to see what fields you have available.

#19

jjjames - February 15, 2009 - 08:53

That's great info! Here's what came up.

object(stdClass)#48 (30) { ["nid"]=> string(1) "2" ["type"]=> string(8) "feedtest" ["language"]=> string(0) "" ["uid"]=> string(1) "1" ["status"]=> string(1) "1" ["created"]=> string(10) "1234499544" ["changed"]=> string(10) "1234499544" ["comment"]=> string(1) "2" ["promote"]=> string(1) "1" ["moderate"]=> string(1) "0" ["sticky"]=> string(1) "0" ["tnid"]=> string(1) "0" ["translate"]=> string(1) "0" ["vid"]=> string(1) "2" ["revision_uid"]=> string(1) "1" ["title"]=> string(10) "test image" ["body"]=> string(19) "please work in rss?" ["teaser"]=> string(19) "please work in rss?" ["log"]=> string(0) "" ["revision_timestamp"]=> string(10) "1234499544" ["format"]=> string(1) "1" ["name"]=> string(5) "user1" ["picture"]=> string(0) "" ["data"]=> string(6) "a:0:{}" ["path"]=> string(18) "content/test-image" ["field_image"]=> array(1) { [0]=> array(10) { ["fid"]=> string(1) "1" ["list"]=> string(1) "1" ["data"]=> array(0) { } ["uid"]=> string(1) "1" ["filename"]=> string(11) "Photo 1.jpg" ["filepath"]=> string(31) "sites/default/files/Photo 1.jpg" ["filemime"]=> string(10) "image/jpeg" ["filesize"]=> string(5) "72396" ["status"]=> string(1) "1" ["timestamp"]=> string(10) "1234499532" } } ["last_comment_timestamp"]=> string(10) "1234499544" ["last_comment_name"]=> NULL ["comment_count"]=> string(1) "0" ["taxonomy"]=> array(0) { } }

Can you please help my sorry-ass figure out how to display the image path in the feed?!

Thanks alot :)

#20

jjjames - February 15, 2009 - 08:58

Actually, I'd also really like to understand what all of this code means. Is there a reference so that I can decipher this useful info?

#21

andrewlevine - February 15, 2009 - 17:00

see http://us2.php.net/var_dump

you probably want something like:

<?php
print $node->field_image[0]['filepath'];
?>

#22

jjjames - February 15, 2009 - 21:27

Thanks that worked great! you are the man!

Just a quick question, how do I put the site's root in front of the image path?

right now it's sites/default/files/Photo 1.jpg
i want it to be: http://mysite.com/sites/default/files/Photo 1.jpg

I really appreciate your help!

#23

jjjames - February 15, 2009 - 22:29

Sorry to bother you again...but how would I display the comments? I have a comment but a var dump shows just this:

object(stdClass)#51 (30) {
["nid"]=>
string(1) "3"
["type"]=>
string(8) "feedtest"
["language"]=>
string(0) ""
["uid"]=>
string(1) "1"
["status"]=>
string(1) "1"
["created"]=>
string(10) "1234733529"
["changed"]=>
string(10) "1234733529"
["comment"]=>
string(1) "2"
["promote"]=>
string(1) "1"
["moderate"]=>
string(1) "0"
["sticky"]=>
string(1) "0"
["tnid"]=>
string(1) "0"
["translate"]=>
string(1) "0"
["vid"]=>
string(1) "3"
["revision_uid"]=>
string(1) "1"
["title"]=>
string(12) "second image"
["body"]=>
string(18) "this is the body"
["teaser"]=>
string(18) "this is the body"
["log"]=>
string(0) ""
["revision_timestamp"]=>
string(10) "1234733529"
["format"]=>
string(1) "1"
["name"]=>
string(5) "user1"
["picture"]=>
string(0) ""
["data"]=>
string(6) "a:0:{}"
["path"]=>
string(20) "content/second-image"
["field_image"]=>
array(1) {
[0]=>
array(10) {
["fid"]=>
string(1) "2"
["list"]=>
string(1) "1"
["data"]=>
array(0) {
}
["uid"]=>
string(1) "1"
["filename"]=>
string(12) "Photo 44.jpg"
["filepath"]=>
string(32) "sites/default/files/Photo 44.jpg"
["filemime"]=>
string(10) "image/jpeg"
["filesize"]=>
string(5) "68312"
["status"]=>
string(1) "1"
["timestamp"]=>
string(10) "1234733529"
}
}
["last_comment_timestamp"]=>
string(10) "1234733529"
["last_comment_name"]=>
NULL
["comment_count"]=>
string(1) "0"
["taxonomy"]=>
array(0) {
}
}

thanks again for your help :)

#24

gdoteof - February 17, 2009 - 02:10

gdoteof, Just so you know, you can get the nightly snapshot of the Drupal 6 version here: http://drupal.org/node/343850

If there are any bugs, please open those separately.>>>

I get an access denied on that node?

#25

andrewlevine - February 17, 2009 - 02:51

looks like a glitch occured with the packaging system. republishing to see if it repackages...

#26

chipway-drupal - February 23, 2009 - 13:27

Hi,

could you upload a d6 dev version so we could be many testing it ?

Thank you

#27

andrewlevine - February 23, 2009 - 14:55

cwdrup, I'm trying...I have an issue filed with the Drupal infrastructure team

#28

espry - March 7, 2009 - 17:25

Any progress? It still seems impossible access the 6-version. Could you pls post elsewhere? I really need this v. useful module. Thanks.
EDIT: I realize that the version attached above works.

#29

andrewlevine - March 10, 2009 - 15:22

@espry: I am working on this. I got the node deleted by a drupal.org admin and recreated it, hopefully it will show up by tonight. If not I will have try to get it debugged by an drupal.org admin :\ Hopefully I'll get things sorted out soon.

#30

andrewlevine - March 13, 2009 - 03:26

Hey everyone. dww fixed the file issue and you should now be able to download the DRUPAL-6 version from the main project page: http://drupal.org/project/views_node_feed

#31

tizzo - March 13, 2009 - 19:12

Right now making a list of comments is possible but probably a bit tricky. In your snippet for the rendering of each node I think you would need to do an actual database query to get the comments for the node and then loop through them to add them as child elements within your node ... but it's going to be sort of non-trivial as I don't think there's an API call to grab all comments for a given node without rendering them into html. ...though there probably should be...

If you get into something this involved its probably a good idea to roll it into its own module, you really don't want too much php code floating around in your database.

That said, something LIKE:

<?php

$result
= db_query('SELECT * FROM {comments} WHERE nid = "%s"', $node->nid);
while(
$comment = db_fetch_array($result)) {
  print
$comment['cid'];
  print
$comment['subject'];
  print
$comment['comment'];
}

?>

would probably work for you.

Again, I sort of think that we should update this module so that it can make listings of things other than nodes now that views is flexible enough to base its queries on something other than the node table but that probably would not help with this particular use case.

#32

tizzo - March 13, 2009 - 19:15

Comment #31 above was created by clicking the reply link to superjames's question, as was this one. Strange.

#33

bara.munchies - May 19, 2009 - 20:18

does the D6 version include the taxonomy term view type yet or if not, is that on the roadmap?

i need an xml data view that counts my nodes sorted by taxonomy term.

i can't display any variables yet.

 
 

Drupal is a registered trademark of Dries Buytaert.