简体   繁体   English

在Drupal中加载节点,PHP代码不起作用

[英]load node in drupal the php code is not working

I have created a node accessing the content using node_load method. 我创建了一个使用node_load方法访问内容的节点。 The php code embedded in the node is printing as text rather than executing the php script. 节点中嵌入的php代码将作为文本打印,而不是执行php脚本。

<?php 
    $theme_path = $base_path.path_to_theme(); 
?>
<img src="<?php print $theme_path;?>/images/menu-line.png" width="113" height="1">

And accessing this node from the page.tpl.php using the node_load method. 然后使用node_load方法从page.tpl.php访问此节点。

<?php 
    $result  = node_load(array('title' => 'node menu'));
    print $result->body; 
?>

It sounds like your text format of that node is set to filtered or full HTML. 听起来该节点的文本格式设置为已过滤或完整的HTML。 It should be set to php. 它应该设置为php。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM