node_load($nid) 在 Drupal 7 中给我一个致命错误
drupal 7 还很新,并且发生了很多变化。如何简单地加载节点并将其打印出来?我正在使用以下命令,但函数 node_load 给了我: PHP Fatal error: Call to undefined function node_load()
$node = node_load(15);
echo '<pre>' . print_r($node,1) . '</pre>';
Pretty new to drupal 7 and a lot has changed. How can I simply load a node and print it out? I am using the following but the function node_load gives me: PHP Fatal error: Call to undefined function node_load()
$node = node_load(15);
echo '<pre>' . print_r($node,1) . '</pre>';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来它找不到函数node_load - 我可以想象只有当你尝试在drupal框架之外执行此操作时才会发生?例如,在 PHP 页面上,您只是将其添加到网络空间中?
文件内容:
确保您创建的 drupal 模块内有 node_load,并且当它响应钩子(例如 hook_view )时,
sites > 。全部>模块> yourmodule
yourmodule.module
it sounds like it cant find the function node_load - which i can imagine only happening if you were trying to do this outside of the drupal framework? e.g. on a PHP page youve simply added into the webspace?
contents of file:
make sure you have the node_load inside a drupal module you have created, and when its responding to a hook ( e.g. hook_view )
sites > all > modules > yourmodule
yourmodule.module