Drupal 变量消息在首页上为空
我有一个带有一些插件的 drupal 站点,一切都运行良好,但我不知道为什么,在我的首页中,此代码不起作用:
if($is_front){
if ($messages):
print $messages;
endif;
}
如果我尝试执行消息的 var_dump,它会导致空字符串。< br> 相同的代码在其他页面(不是前面)正在运行。
该变量在显示 sys/drupal 消息时使用(例如:用户注册后),如果我将用户注册设置为显示与首页不同的页面,则显示消息,否则不显示消息。
谢谢
I've a drupal site with some plugins, everything is running fine, but i don't know why, in my frontpage this code isn't working:
if($is_front){
if ($messages):
print $messages;
endif;
}
If i try to do a var_dump of messages, it results in empty string.
The same code, on other pages (not front) is working.
This variable is used when showing sys/drupal messages (ex: after user registration), if i set the user registration to show a page different than the frontpage, the message is showed, otherwise it's not.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您显然知道 $messages 仅在您提交表单且验证失败或类似情况时才会填充。我想知道该变量是否在重定向到主页时被清除,因此没有显示???
我假设您在主页上有要提交的表格或其他内容?
干杯,
亚历克斯
You obviously know that $messages is only populated when you submit a form and validation fails or something similar. I wonder if perhaps, that variable is being cleared upon redirection to the homepage and thus not showing up???
I assume you have a form or something on the homepage which you are submitting?
Cheers,
Alex