Posted by texas-bronius on January 20, 2009 at 2:36am
Jump to:
| Project: | Views Node Feed |
| Version: | 5.x-1.1 |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Right off, I am able to build a custom xml feed of node fields, but I don't see how to access/expose all the fields I had defined the the View "fields" list. Normally when working with views, these fields (linked node title, etc) are available only when using List View. I switch back and forth bw List View and Node Feed in "View Type" and see no difference..?
Comments
#1
Right now, views_node_feed doesn't use fields. It simply calls a node_load on every node that is selected from your view to get the data. You should be able to access the nodes data the same way you usually do after calling node_load.
Reopen if you are still having problems
#2
I'm having some trouble. using cck + uberrcart on D5.
i'm trying this code:
<PRODUCT><PRODUCT_URL><?php print $node->path ?></PRODUCT_URL> - WORKS
<PRODUCT_NAME><?php print $node->title ?></PRODUCT_NAME> - WORKS
<PRICE><?php print $node->sell_price ?></PRICE> - WORKS
<MODEL><?php print $node->model ?></MODEL> - WORKS
<DETAILS><?php print $node->content['body']['#value'] ?></DETAILS> - DOESN'T WORK!
<IMAGE><?php print $node->field_image_cache['0']['filepath']; ?></IMAGE> - DOESN'T WORK!
</PRODUCT>
Any special reason why I can't call
$node->field_name['0']['#value']?#3
I've been messing around with this some more.
For some reason, which i cannot understand, i can now use:
<IMAGE><?php print $node->field_image_cache['0']['filepath']; ?></IMAGE>And it works. i have no idea what was going on before. I found that the (probably) correct why to print a field is:
<?php print check_plain($node->field_fieldname[0][value]); ?>There is still one problem with CCK fields - I can only get the 'value' of a field and not it's 'view' - so i don't really get the info i need.
I found that instead of printing the body, i print the teaser (which in my case is just what i need) and that way i don't get the CCK fields and everything elese, just a short teaser:
<DETAILS><?php print $node->teaser ?></DETAILS>The problem with the teaser is that i sometimes get it with a break (in 3 line) and i don't know if it makes any differance:
<DETAILS>The early works of Le Blanc, the artist who made us all…
</DETAILS>
and sometimes it looks ok like this:
<DETAILS>Looking back at those times, I can see one…</DETAILS>Besides that - everything looks really good!
Thanks for this great module!
#4
The $node->content array is used when a node is being rendered with node_view and is not referenced when node_load is called (which is what views_node_feed does). It's sort of complicated but I'm sure you could hack something up where you call node_view(). Check out the difference between node_load and node_view in the API docs. Specifically the function stack node_view -> node_build_content -> node_prepare.
Hope that helps
#5
Ha! The "way [I] usually do" is through the Views interface! :D
Thanks for the great module. I will sit content with what I have and will love to learn more about views/theming as time permits..
#6
By the way, it would be better if we could simply load fields instead of doing node_load (for performance and usability). I just don't have the time or views chops to work this out.
#7
This seems really cool, but yeah, would be nice if you could just directly add CCK fields.
#8
An undocumented feature of Views Bonus Pack, you can create XML feeds using CCK fields. It creates XML files, CSV Files, etc, but if you leave the filename blank, you just get an XML feed. Very simple!
http://drupal.org/node/373847