This question here at DA has a popular suggestion to check page.tpl.php
to see if it says print $messages;
. I verified this and this is the case.
I cleared caches many times, btw after which there actually is a drupal message saying the caches are cleared.
I made sure the dpm()
, dsm()
or drupal_set_message()
functions are nicely outside any conditional statement or php logic whatsoever. I also put all these functions on different places in the tpl
file. Still no result.
The same theme also has another tpl file that I used before and had some commented dpm(); functions that I uncommented but these didn't work anymore either.
Devel module is enabled and I am logged in as admin the whole time.
includes/bootstrap.inc
you will see that all the various message functions populate or look at a session variable with or for the contents of the message. These are then plucked via process_page() inincludes/theme.inc
which populates the$messages
variable. So, if you are calling these functions INSIDE the page template, this variable has already been set, so these new messages are either lost or should/will eventually appear when a subsequent page is loaded...dpm();
,dsm();
, and evendrupal_set_message();
from atpl
file? I mean, for all anyone should care for in this purpose, my end goal could be that I just want to output a hardcoded string withdrupal_set_message();
. If you catch my drift.$messages
before the template it processed, using them inside the template will either, once again, not work, or will be delayed until a subsequent page load. So, if within a template, you want to have further messages displayed, you could add in logic that appends information to the$messages
variable and then they would show up when it is printed, or you could do any other php coding, eg a direct print of a message yourself, etc.