$events = array();
foreach ($items->items as $item) {
$node = node_load(array('nid' => $item->nid));
$body_value = !empty($body_field) && !empty($item->$body_field) ? $item->$body_field : $node->images['thumbnail'];
$event = array('description' => check_markup($body_value, $body_format, FALSE),);
这是drupal模块中的一段代码
在浏览器中看到的最终输出为files/images/image-x.jpg
然而,我想通过将其转换为<image src=http://mysite.com/$node->images['thumbnail']>
将其显示为实际图像,以便浏览器输出为
<image src=http://mysite.com/files/images/image-x.jpg>
我现在如何撰写$node->images['thumbnail']
并绕过check_markup($body_value
作为check_markup($body_value
条带html?
提前致谢
答案 0 :(得分:1)
您真的不需要在您创建的check_markup
上运行<img>
,所以您可以事先做到这一点:
if (!empty($body_field) && !empty($item->$body_field)) {
$body_value = check_markup($item->$body_field, $body_format, FALSE)
}
else {
$body_value = '<img src="' . $node->images['thumbnail'] . '" alt="alt text" />';
}
$event = array('description' => $body_value);