Drupal 6 次浏览标题中的图像,而不是内容

发布于 2024-11-26 07:19:44 字数 164 浏览 0 评论 0原文

在 Drupal 6 中,是否可以使用视图指定图像仅在属于页面时才显示?我想为每个页面制作一个不同的标题图像,因此每个页面应该只显示属于它的图像,而不显示属于其他页面的图像。或者我可以在没有视图的情况下执行此操作吗?我已经使用 ImageField 添加图像字段,但我希望它显示在标题中,而不是包含节点内容的内容。

Is it possible to , in Drupal 6 using Views, to specify that an image should be shown only if it belongs to the page? I want to make a header image that's different for every page, so each page should show only the image that belongs to it, and none of the image that belong to other page. Or can I do this without Views? I've used ImageField to add the field for the image, but I want it to display in the header, not the content with the node stuff.

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

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

发布评论

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

评论(1

羁拥 2024-12-03 07:19:44

也许我误解了,但我不会为此使用视图。我是否正确,您想要的是在给定页面的标题中显示给定的图像?我可以看到两个选项:

1)如果您的页面基本上显示一个节点,并且如果您使用图像字段添加图像,那么您可以使用CSS将其从内容中移出并移入标题中(使用绝对定位)。

类似于 :

div.field-field-<your field name> {
  position: absolute;
  top: 50px; /* Adjust to fit your theme */
  left: 0px; /* Adjust to fit your theme */

}

您应该确保在您想要的位置为图像留出了足够的空间。这个 CSS 应该放在你的主题中。


2)您可以为每个图像使用一个块,将块设置为仅在您想要的页面上显示。转到 /admin/build/block/add 创建一个新块。在“块体”下添加图像 - 这取决于您的设置,但总体思路是选择允许图像的输入格式(即 HTML img 标签)并输入 HTML 以指向该图像,例如。 >

然后在“页面特定可见性设置”下选择“仅在列出的页面上显示”并输入您想要此图像的页面的路径。

保存块,然后转到 /admin/build/block/list 并将新创建的块拖动到您想要显示的部分(例如标题)。


选项 2. 意味着您不必了解 CSS/Drupal 主题,并且页面的格式化方式独立于节点内容(您可能想要也可能不想要)。缺点是你最终可能会得到很多块,这会让事情变得有点笨拙。实现相同方式的更简洁的方法是使用 context 模块: http://drupal.org/project/context< /a>

还有其他方法可以实现您想要的(Drupal 非常灵活),但我希望这些是很好的起点!

Maybe I misunderstand, but I wouldn't use Views for this. Am I correct that what you want is to display a given image in the header of a given page ? I can see two options :

1) If you page basically display one node, and If you add the image using an imagefield, then you could use CSS to move it out of the content and into the header (using absolute positioning).

Something like :

div.field-field-<your field name> {
  position: absolute;
  top: 50px; /* Adjust to fit your theme */
  left: 0px; /* Adjust to fit your theme */

}

You should make sure you've left enough space for the image at the location you want it. This CSS should go in your theme.


2) You could use a block for each of the images, set the block to display only on the page you want. Go to /admin/build/block/add to create a new block. Add the image under 'block body' - this will depend on your setup, but the general idea is to select an input format that allows images (That is the HTML img tag) and enter the HTML to point to that image, eg. <img src='/path/to/your/image' width='50px' height='50px' />

Then under 'Page specific visbility settings' select 'show on only the listed pages' and enter the path of the page you want this image on.

Save the block, then go to /admin/build/block/list and drag the newly created block in the section you want it to show (eg. header).


Option 2. means you don't have to know CSS/Drupal Themeing, and that the way the page is formated is independant of the node content (which you may or may not want). The downside is that you may end up with a lot of blocks which will make things a bit unwidly. A cleaner way to achieve the same way is to use the context module : http://drupal.org/project/context

There are yet other ways to achieve what you want (Drupal is very flexible), but I hope these are good starting points !

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