Do I have the corrent concept of the Views module

nightowl77 - June 14, 2009 - 14:58

Hi Guys

I just want to double check if I have this down correcly:

I can use Views to customize which fields output from another module? In other words I don't have to override theme_list if I'm not happy with the fields it outputs, the quicker and easier way would be to create a custom view, select all the fields I want, and then output that instead?

For example: The node_gallery module adds a new item to the logged in user's menu called "Gallery List". When you click "Gallery List" I can see it is calling the theme_item_list (which then calls the hook_item_list in the "node_gallery" module).

It then outputs:

A heading "Gallery LIst" at the top of the page

A Loop containing the following:

- The selected "cover image" from the gallery
- The title of the gallery
- The amount of images in the gallery
- The "date created"

The objective would be to for example add - "Uploaded by user" to the list above. So instead of trying to override theme_item_list (which I just cannot seem to get right) you could theoretically create a View with the hand picked fields you wanted, then hook up the View to the user's menu (hopefully disabling or overriding the existing "Galleries List" Menu Item). Am I right when I say this?

Would you recommend this approach?

Thank you guys

Richard

Sort of correct

nevets - June 14, 2009 - 15:45

Modules must expose their data to views before views can list it. So given the data has be exposed to views the answer is yes though there may be limitations based on how the module makes its data available.

Views is made for lists

Tally - June 28, 2009 - 19:48

Views allows you to create lists that will display as a page. That page has an address and you can add a menu item with that address. To override the Node Gallery menu item, just disable Node Gallery menu and add a new menu item with your views address.

I am testing Node Gallery on my site http://www.restoringforeskin.org and I use views extensively to present the info I want the way I want. Node Gallery has made accessible enough fields to allow you to build a view listing of galleries and also a view listing gallery images for each user. You can also theme the output of the view to make the page look different than the default produced by Views.

Currently, Node Gallery has not released fields that allow you to build a view of all images in a specific gallery.

_______________________________
Site admin for www.RestoringForeskin.org and www.FRCchat.org

 
 

Drupal is a registered trademark of Dries Buytaert.