How to create custom Style output in views in Drupal 6 ? besides Grid, Table, HTML list?

懵懂的女人 提交于 2019-12-12 18:09:31

问题


I need to alter the output of a view that displays in a in a block in order to apply it to some format of a Jquery UI script so I need the following format for a grouped taxonomy query that I'va configured for some node type..

<div id="tab">
    <ul>
        <li><a href="#tabs-1">Tab1Title</a></li>
        <li><a href="#tabs-2">Tab2Title</a></li>
        <li><a href="#tabs-3">Tab3Title</a></li>
    </ul>

</div>

    <div id="tabs-1">Content2</div>
    <div id="tabs-2">Content2</div>
    <div id="tabs-3">Content3</div>

回答1:


You need to create a Style Plugin, and expose it to views 2 API.

A complete style plugin is made up of these components:

  1. An implementation of hook_views_api so Views will load your include files;
  2. An implementation of hook_views_plugins to declare your style plugin;
  3. An implementation of the views_plugin_style class;
  4. A theme preprocess function for your style theme;
  5. A theme .tpl.php page.

Here is good reference about extending views 2 with custom modules (from which I taken this component list): http://groups.drupal.org/node/10129




回答2:


You need to create your own views style-plugin. Look at views_plugin_style_default.inc in your views module folder.

Then go to Style plugins and find out more about how to implement a style plugin from your own module.

You basically implement the hook_views_style_plugins() and then create your own class that extends views_plugin_style.

Best of luck!



来源:https://stackoverflow.com/questions/4888040/how-to-create-custom-style-output-in-views-in-drupal-6-besides-grid-table-ht

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!