如何在Drupal中实现季节性徽标? [英] How to implement seasonal logos in Drupal?

查看:77
本文介绍了如何在Drupal中实现季节性徽标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能可以通过CCK和视图以及徽标内容类型来完成。但是我想知道是否有人知道执行以下操作的最佳方法(也许已经有一个模块可以做到这一点):

I know this can probably be done with CCK and a view, and maybe a logo content type. But I was wondering if anybody knows of the BEST way to do the following (perhaps there is a module that does this already):

我想要季节性显示我的徽标。即如果我创建了徽标的CHRISTMAS版本,例如徽标中带有圣诞帽,则必须在圣诞节或圣诞节前7天显示。这7天必须根据PER LOGO进行更改。即我可能想在整个12月显示圣诞节徽标,但只显示一整天的圣诞节徽标。

I want SEASONAL displays of my logo. I.e. If I create a CHRISTMAS version of my logo, with for example a a christmas hat in the logo, this must be shown on Christmas, or 7 days before christmas. This 7 days must be changeable on a PER LOGO basis. I.e. I might want to show christmas logo for the whole of december, but the holloween one only for one day.

它必须自动在各种徽标和ALSO之间进行选择,以适应语言。我的网站上有三种语言,因此也有三种徽标。

It must automatically choose between the various logos and ALSO, cater for LANGUAGES. I have three languages and therefore three different logos on my site.

推荐答案

这是一个简单但有效的解决方案,使用了cck和views :

This was a simple but effective solution, using cck and views:

创建标题图片内容类型。添加图像,URL和显示时间选择列表的字段。

Create a 'header pics' content type. Add fields for images, url, and 'show when' select list.

图像我将图像上传与裁剪模块一起使用,限制为400px宽x 100px高以适合标题

Images I used image upload with cropping module, constrained to 400px wide by 100px high to fit in header block.

显示时间选择列表,我在其中填充了夏季,冬季,秋天,万圣节,圣诞节,退伍军人节等。

'show when' select list I populated with summer, winter, fall, Halloween, Christmas, Veteran's Day, etc.

url是可选的。

在视图中,按类型= header_pic和show_when =现在要显示的内容进行过滤,限制= 1。

In view, filter by type = header_pic and show_when = whatever you want displayed now, limit = 1.

需要使用Customfield PHP模块插件来获取视图,并添加:

Need the Customfield PHP module addon for views, and add:

<?php
$temp = node_load($data->nid);
if ($data->node_data_field_header_pic_url_field_header_pic_url_url) { 
    echo '<a href="' . $data->node_data_field_header_pic_url_field_header_pic_url_url 
. '" title="' . $data->node_data_field_header_pic_url_field_header_pic_url_title 
.'"><img src="/' . $temp->field_header_image[0]['filepath'] . '" /></a>';
} 
else { 
    echo '<img src="/' . $temp->field_header_image[0]['filepath'] . '" />';
}
?>

我提到的字段与您的实际字段相关。

Where the fields I've noted correlate to your actual fields.

这是仅在填充了url字段的情况下才用该url字段包装图像。

What this does is wrap the image with that url field only if the url field is populated.

然后在块显示中设置视图,并在标题区域中设置该块。根据主题,您可能需要对page.tpl.php进行一些修改,以将标题块区域移至真正的标题区域(但是一旦进入该区域,就很容易看到需要执行的操作)。

Then set the view in a block display, and set that block in the header region. Depending on theme, you may need to hack the page.tpl.php a little to move that header block region into the real header area (but once you get in there it's easy to see what you need to do).

您甚至可以在同一视图下进行页面浏览,以一次在页面(/ headerpics)上一次显示所有出色的标题图像,每个链接都有一个编辑链接,以便于管理。

You can even make a page view of this same view to display all of your great header images at once on a page (/headerpics), with an edit link by each for easy manageability.

如果您只需要季节性图像,则可以使用。这是非技术用户上传和裁剪图像的一种简单形式。管理员唯一需要的是偶尔在视图过滤器中更改季节(显示时间)。

This will work if you just want seasonal images. It's a simple form for non-technical users to upload and crop images. The only admin need is the occasional season (show when) changes in view filter.

这篇关于如何在Drupal中实现季节性徽标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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