开发者

How to customize node / view display using Views in Drupal7

i'm using drupal7 and i have created a custom content type (vessel) which has some fields e.g. vessel name, company, reg port, some dates (downloaded date module) and has also an image. I have also created a view that lists all vessels and checked the available table, grid etc solutions but they re not covering my needs.

i actually want to "format" somehow the way the fields of my content type (vessel name, company, image etc) are displayed when a node is开发者_如何学JAVA displayed and also when the views itself is displayed. So for example i need to have the picture on the left and some of the fields (vessel name, company) right next to it (in the form of a table or something) and not below it as it does by default or in tabular format as displayed when selected with grid etc...

here's an example of what i need to have as a node:

---------------------------------------------------
|             | <vessel name>        | <port>     | 
|   <image>   | <vessel company>     |            |
|             |                      |            |
---------------------------------------------------

so far i have used cck (core drupal7) and views.

i have done some research and found some posts that are somewhat what i need but not really helped me. I understand that i need to somehow modify some .tpl.php files and place (or replace) them on the proper folders but i'm really confused. Which of all the .tpl.php files do i have to modify and where to place them given that i use Views and i'm not really sure if i have to place the file inside a \theme folder or the modules\views\theme folder or any other folder.

i'm kind of noob in both drupal and php but have a good s/w engineering background so i believe i can catch up things.

Anyone can help by saying a few words or giving some links/tutorials that does things from scratch. I almost understand how all this thing works but i guess i miss some parts (probably critical of all this).

sorry for the long post.

thank you in advance


The templates used to render the views are listed in the "Theme Information" link in the Views edition UI. You can override the templates in your theme by copying the file from the Views module folder to your theme's folder.

But the default Views's template are very verbose and complete. Using the unformatted style and your four fields in display order (when reading from left to right), you should end up with a markup rich enough to achieve your layout in CSS without additional PHP/HTML code.


I would take a look at this module, http://drupal.org/project/ds. and this module http://drupal.org/project/custom_formatters.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜