【问题标题】:code to create alternating grid view of nodes on homepage - Drupal 6.20在主页上创建节点的交替网格视图的代码 - Drupal 6.20
【发布时间】:2011-06-22 08:03:01
【问题描述】:

我试图在主页上创建一个所有节点的网格视图,该视图迭代了 3 种不同的模板模式,因此我可以为每个传递到视图的节点设置不同的图像缓存预设。 我使用 page-front.tpl.php 进行家居设计,目前有一个模板预处理指向 node-front.tpl.php。

我想真正实现这一点的唯一方法是在模板预处理中?

所以我希望代码能让我能够为模式中的 3 个交替节点中的每一个分配不同的图像缓存预设,例如:

for node "1", display template pattern "1" with imagecache preset "big-image".
for node "2", display template pattern "2" with imagecache preset "tall-image".
for node "3", display template pattern "3" with imagecache preset "small-image".
for node "4", display template pattern "1" with imagecache preset "big-image".
for node "5", display template pattern "2" with imagecache preset "tall-image".
for node "6", display template pattern "3" with imagecache preset "small-image".

等等

那里有任何 Drupal 专家愿意试一试吗?

【问题讨论】:

    标签: php templates drupal themes preprocessor


    【解决方案1】:

    好吧,使用 Views 可以轻松获取数据和网格显示。但是更改每个输出以使用不同的图像缓存预设可能会很棘手。

    我可能会生成视图,然后根据您要使用的大小根据当前行更改图像缓存输出的行 tpl 的输出。

    【讨论】:

      【解决方案2】:

      在我看来,这主要是一个视图问题:您希望视图返回不同的图像缓存预设,由节点 ID 确定。对于这种类型的事情,您最好修改相关视图的视图模板......查看各种模板,我可以看到您在字段模板中执行此操作,也可以在其中一个父模板中执行此操作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-11-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多