如何在 Drupal 6 的视图中创建自定义样式输出?除了网格、表格、HTML 列表? [英] How to create custom Style output in views in Drupal 6 ? besides Grid, Table, HTML list?

查看:19
本文介绍了如何在 Drupal 6 的视图中创建自定义样式输出?除了网格、表格、HTML 列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更改显示在块中的视图的输出,以便将其应用于 Jquery UI 脚本的某种格式,因此我需要以下格式用于我为某些配置的分组分类查询节点类型..

<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>

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

解决方案

您需要创建一个样式插件,并将其公开给视图 2 API.

一个完整的样式插件由以下组件组成:

  1. hook_views_api 的实现,因此视图将加载您的包含文件;
  2. 实施 hook_views_plugins 来声明您的风格插件;
  3. views_plugin_style 类的实现;
  4. 风格主题的主题预处理功能;
  5. 主题 .tpl.php 页面.

这是关于使用自定义模块扩展视图 2 的很好参考(我从中获取了此组件列表):http://groups.drupal.org/node/10129

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>

解决方案

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

这篇关于如何在 Drupal 6 的视图中创建自定义样式输出?除了网格、表格、HTML 列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆