为 Drupal Views RSS 准备数据

发布于 2024-10-15 23:04:13 字数 818 浏览 2 评论 0原文

我正在使用视图 RSS 模块,并且想要自定义显示,而不是视图设置中可用的内容。在“提要样式”选项部分的“提要”选项卡上,我分配了“标题”和“描述”等字段。但是,“字段”部分下包含一个图像字段,我想将其包含在“描述”中。

在views-view-field.tpl.php中,我打印了$row并得到了这个...

stdClass Object
(
    [nid] => 23
    [node_title] => Title
    [node_revisions_body] => <p>Test Body</p>
    [node_revisions_format] => 4
    [node_created] => 1294704278
    [node_data_field_feature_img_fid] => 13
    [node_data_field_feature_img_list] => 1
    [node_data_field_feature_img_data] => a:2:{s:3:&quot;alt&quot;;s:0:&quot;&quot;;s:5:&quot;title&quot;;s:0:&quot;&quot;;}
    [view_name] => xml_grid_item_feed:feed_1
)

...我如何使用它来将图像数据与正文结合起来以在RSS提要中输出?就此而言,这个模板文件非常通用,如果我在这里进行编辑,可能会搞砸网站中的其他内容。还有哪里比这里更有意义呢?使用预处理器函数将两者结合起来会更好吗?谢谢。

I'm using the Views RSS Module and want customize the display a bit more than what's available in the views settings. On the Feed Tab in the Feed Style option section I have assigned the Title and Description etc fields. However there's an image field that's included under the Fields section that I'd like to include inside the Description.

In the views-view-field.tpl.php I've print_r-ed $row and got this...

stdClass Object
(
    [nid] => 23
    [node_title] => Title
    [node_revisions_body] => <p>Test Body</p>
    [node_revisions_format] => 4
    [node_created] => 1294704278
    [node_data_field_feature_img_fid] => 13
    [node_data_field_feature_img_list] => 1
    [node_data_field_feature_img_data] => a:2:{s:3:"alt";s:0:"";s:5:"title";s:0:"";}
    [view_name] => xml_grid_item_feed:feed_1
)

...how can I use this to combine the image data with the body to output in the RSS feed? For that matter this template file is quite generic and would probably screw up other stuff in the site if I edited here. Where would make more sense than here? Would it be better to use a preprocessor function to combine the two? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

病毒体 2024-10-22 23:04:13

在视图中每个字段的选项下,有一个标记为“重写此字段的输出”的复选框。您可以使用它将多个字段组合在一起,请记住帮助文本:“请注意,由于渲染顺序,您不能使用此字段之后的字段;如果您需要此处未列出的字段,请重新排列您的字段

在这种情况下,请确保您的图像字段出现在正文字段上方,然后编辑正文字段以启用重写并添加适当的标记,如替换模式下所列。

Under the options for each field in a view, there is a checkbox labeled "Rewrite the output of this field". You can use that to combine multiple fields together, keeping in mind the help text that reads "Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields."

In this case, make sure your image field appears above the body field, then edit the body field to enable rewriting and add the appropriate tokens, as listed under Replacement patterns.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文