诺马利在德鲁巴7我们有node.tpl.php
<?php print render($title_prefix); ?>
<?php if (!$page): ?>
<h2<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>"><?php print $title; ?></a>
</h2>
<?php endif; ?>
<?php print render($title_suffix); ?>它采用了$node_url,并将其放在每个节点的标题上。
我确实显示了5个节点(页面):
我已经创建了图像First.gif、Second.gif和我希望加载该图像,而不是标题。
我确实检查了各种实现,但没有为我找到任何解决方案。
更新I确实尝试过编辑template.php文件,并添加了用图像替换标题的函数-如果图像存在的话。我需要这个在Drupal 7-请看这里- http://drupal.org/node/221854
有什么帮助吗?谢谢..
发布于 2012-01-26 11:40:48
因为每个节点都有自己的id,所以我建议您在特定的files文件夹中包含node-12、node-13等图像。
在你的node.tpl.php里
<?php
// path to our file depending on node id
$file = "path/to/file/node-{$node->nid}.gif";
// check if file exists
if (file_exists($file)) {
// theme $title as image with theme_image()
$title = theme('image', array('path' => $file));
}
?>
<h2<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>"><?php print $title; ?></a>
</h2>然而,我相信这不是最好的发展方式,但它适用于你的问题。
https://stackoverflow.com/questions/8976315
复制相似问题