The messages always mess up my page layout, so I usually simply want them on the top of my page content.
1. remove message from its default postion
1.a Copy zone--content.tpl.php to your subtheme's template directory (if you have not done that already)
1.b Remove these lines
<?php if ($messages): ?>
<div id="messages" class="grid-<?php print $columns; ?>"><?php print $messages; ?></div>
<?php endif; ?>
2. transfer the messages variable to the region template
2.a Open template.php
2.b add a preprocess functio, or modify if you alreay have one
function THEMENAME_preprocess_region(&$vars) {
$theme = alpha_get_theme();
if ($vars['elements']['#region'] == 'content') {
$vars['messages'] = $theme->page['messages'];
}
}
3. add the messages to the region template
Just write anywhere you want in the template
<?php if ($messages): ?>
<div id="messages" class="grid-<?php print $columns; ?>"><?php print $messages; ?></div>
<?php endif; ?>
No comments:
Post a Comment