I was trying to figure out why my linked site name was indented and spent a little time looking at this part of the page.tpl.php file:
<div id="page" class="container-16 clear-block">
<div id="site-header" class="clear-block">
<div id="branding" class="grid-4 clear-block">
<?php if ($linked_logo_img): ?>
<span id="logo" class="grid-1 alpha"><?php print $linked_logo_img; ?></span>
<?php endif; ?>
<?php if ($linked_site_name): ?>
<h1 id="site-name" class="grid-3 "><?php print $linked_site_name; ?></h1>
<?php endif; ?>
<?php if ($site_slogan): ?>
<div id="site-slogan" class="grid-3 omega"><?php print $site_slogan; ?></div>
<?php endif; ?>
</div>
The whole logic for assigning the alpha and omega tags seems screwy since it doesn't know if the previous element was output. The linked_site_name should always be output since it's a required field but the linked_logo_img and site_slogan are not.
This bit seems to do the trick for me but it's kind of klunky:
<h1 id="site-name" class="grid-3 <?php print ($linked_logo_img ? '' : 'alpha ') . ($site_slogan ? '' : ' omega'); ?>"><?php print $linked_site_name; ?></h1>
Comments
Comment #1
dvessel commentedEh, yeah.. That definitely needs improving. I'll see if there's a cleaner way.
Comment #2
rok@luckypressure.com commentedWhat about a simple "switch" statement?
There is 4 cases:
logo+title+slogan > logo has class "alpha" & slogan has class "omega".
logo+title >logo has class "alpha" & title has class "omega".
title
title+slogan >title has "alpha" & slogan has "omega".
I should learn how to write this simple stuff in php and how to create a patch...
Comment #3
dvessel commentedI'll have an upcoming patch that simplifies it but it's won't be specific to this. It will look like this: