By john.kenney on
Hi:
In page.tpl.php, I am trying to get my $messages to print a certain way, but don't really know php too well / at all.
I want to print messages in one way for visitors and another for admin users.
I've got the statement below in place and this works for visitors, but lacks the 'else' part to say waht to print for admin.
<?php if ($messages && arg(0) != 'admin' && $user->name != admin) { print '<div class="message-wrapper"><p class="message-header">Sorry, there was a problem:</p>' . $messages . '<p class="message-footer">Please contact us by email at info@xyz.com if you need further assistance. Thanks!</p></div>'; } ?>
i tried this else statement, but it didn't work
<?php if ($messages && arg(0) != 'admin' && $user->name != admin) { print '<div class="message-wrapper"><p class="message-header">Sorry, there was a problem:</p>' . $messages . '<p class="message-footer">Please contact us by email at info@xyz.com if you need further assistance. Thanks!</p></div>'; } else { print $messages }?>
Can someone help me tweak this to get it to print for both cases, please?
Thank you!
Comments
If you copied that verbatim...
...you're just missing the semicolon after the last $messages
Something like:? <?php if
Something like:?
...
that works!
and it is much prettier, too.
thank you both very much!!