几天来我一直在试图解决这个问题。希望有人能帮忙。
我正在为一个网站实施一个新主题。我将 html 添加到 page.tpl.php 文件中,并使用适当的变量填充它,到目前为止它工作正常。
它由页眉、页脚以及左右 div 组成。左侧 div 成功显示 $content 变量的输出。
右侧的 div 应该显示一个 Flash 视频,后跟两个图像,所有图像都是垂直显示的,每个页面都有所不同。我真的被困住了。
我该如何添加这些?
I have been trying to figure this out for days. Hope someone can help.
I am implementing a new theme for a site. I added the html to a page.tpl.php file, populated it with the appropriate variables, and it works OK so far.
It consists of a header, footer, and a left and right div. The left div successfully displays the output of the $content variable.
The right div is supposed to show a flash video followed by two images, all displayed vertically, which vary with each page. And here I'm really stuck.
How do I go about adding these?
发布评论
评论(4)
根据您想要编程的程度,您可能会使用块。我不想编程太多,用你想要的每个图像/视频组合创建一堆块。如果您不介意编程,您可以在模块中创建一个块,其中包含在正确页面上提取正确图像/视频所需的所有代码。
但最基本的方法是在 /admin/build/block/add 中,然后将该块与 /admin/build/block 上的正确区域关联起来。您可以控制这些块在块编辑表单上显示的页面。
此链接可能对您有用。
Depending on how much you want to program you're probably going to use blocks. I you don't want to program a lot create a bunch of blocks with each image/video combo you want. If you don't mind programming you can create a block in a module with all the code necessary to pull up the right images/videos on the right page.
But the most basic way will be at /admin/build/block/add then associate the block with the right area on /admin/build/block. You can control which pages these blocks wind up on on the block edit form.
This link may be handy for you.
您需要做的第一件事是将文件添加到每个页面。您可以使用 CCK 和 文件字段。
将文件放入页面后,您需要将它们从 $content 中取出,默认情况下它们会显示在此处。您可以通过在 CCK 中的“显示字段”下关闭这些字段来完成此操作。
现在这些文件不再位于 $content 中,您需要将其放在其他位置。大多数主题都有一个 $right 区域,您可以使用它。所以把 $right 放在你的右边 div 中。您可以使用块填充 $sidebar,因此您需要一个包含给定页面的文件的块。
您可以使用视图来实现此目的。创建一个新的节点视图,添加节点 ID 参数,并从 URL 为其指定默认值。这基本上告诉视图查看当前节点/页面。在“字段”下,选择“内容”并找到您使用 CCK 添加的文件字段。最后,添加“块”类型的显示。节省。
现在您在当前页面上有一个包含文件的块,并且每个页面上都有 $right 区域,因此只需转到块管理页面并将此块放入该区域即可。
The first thing you need to do is add the files to each page. You can do that with CCK and filefield.
Once you have the files in the pages, you need to get them out of $content, where they'll show up by default. You can do this by turning the fields off under Display Fields in CCK.
Now that the files are no longer in $content, you need to put it in something else. Most themes have a $right region you can use for that. So put $right in your right div. You can populate $sidebar with blocks, so you need a block containing the files for the given page.
You can make this with Views. Create a new node view, add an argument for node ID, and give it a default value from the URL. This basically tells the view to look at the current node/page. Under Fields, choose "Content" and find the file fields you added with CCK. Finally, add a display of type "Block." Save.
Now you have a block with the files on the current page, and you have the $right region on every page, so just go to the Blocks admin page and put this block in that region.
斯科特和查克已经提供了这个问题的详细信息,但我想我只想指出每个答案可能合适的场景。
如果您希望这些视频和照片块显示在不是节点页面的页面上,那么您可能需要采用类似于 Chuck 提供的答案的解决方案。
最有可能的是,听起来您确实希望视频和照片与左侧显示的内容相关。如果是这样的话,那么斯科特告诉你你需要知道的事情。
Scott and Chuck have already provided the details for this question, but I thought I would just point out scenarios when each answer may be appropriate.
If you want those video and photo blocks to display on pages which are NOT node pages, then you will probably need to go with a solution similar to the answer Chuck provided.
Most likely, it sounds like you do want the the video and photos to be related to the content shown on the left. If that is the case, then Scott told you what you need to know.
上述建议的最后一条如下:
谢谢大家!
One final piece to the advice from those above was the following:
Thanks, all!