简体   繁体   English

Drupal 可变消息在首页为空

[英]Drupal variable messages empty on frontpage

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:我有一个带有一些插件的 drupal 站点,一切运行良好,但我不知道为什么,在我的首页中,此代码不起作用:

if($is_front){  
   if ($messages):  
      print $messages;  
   endif;  
}  

If i try to do a var_dump of messages, it results in empty string.如果我尝试对消息进行 var_dump,则会产生空字符串。
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.此变量在显示 sys/drupal 消息时使用(例如:用户注册后),如果我将用户注册设置为显示与首页不同的页面,则显示消息,否则不显示。
Thanks谢谢

You obviously know that $messages is only populated when you submit a form and validation fails or something similar.您显然知道 $messages 仅在您提交表单并且验证失败或类似情况时才会填充。 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干杯,亚历克斯

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

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