By ridolfidesigns on
I am struggling figuring out how to make certain code display based on a certain term. If that term is not picked, then another set of code is displayed.
Here is what I have so far:
<?php
// $Id: node-blog.tpl.php
?>
<div id="node-<?php print $node->nid; ?>" class="node<?php if ($sticky) { print ' sticky'; } ?><?php if (!$status) { print ' node-unpublished'; } ?>">
<?php print $picture ?>
<div class="title-submit">
<?php if ($page == 0): ?>
<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>
<?php if ($submitted): ?>
<span class="submitted"><?php print $submitted; ?><?php print ' in' . $terms ?></span>
<?php endif; ?>
</div>
<?php if ($taxonomy == 'Projects'): ?>
<div class="node-left">
<div class="content clear-block">
<?php print $field_upload_img_blog[0]['view'] . "\n"; ?>
</div>
</div>
<div class="node-right">
<p><?php print '<strong>Client: </strong>' . $field_featured_client[0]['view'] . "\n"; ?></p>
<p><?php print '<strong>Project Brief: </strong>' . $field_project_brief[0]['view'] . "\n"; ?></p>
<p><?php print '<strong>View Site: </strong>' . $field_site_url[0]['view'] . "\n"; ?></p>
<p><?php print $node->content['body']['#value'] . "\n";?></p>
<p><a href="<?php print $field_site_url[0]['url'] ?>" target="_blank"><img src="http://creativeinsite.us/sites/all/themes/creativeinsite/images/view_site.png" /></a></p>
</div>
<?php else: ?>
<p><?php print '<strong>Client: </strong>' . $field_featured_client[0]['view'] . "\n"; ?></p>
<p><?php print '<strong>Project Brief: </strong>' . $field_project_brief[0]['view'] . "\n"; ?></p>
<p><?php print '<strong>View Site: </strong>' . $field_site_url[0]['view'] . "\n"; ?></p>
<p><?php print $node->content['body']['#value'] . "\n";?></p>
<p><a href="<?php print $field_site_url[0]['url'] ?>" target="_blank"><img src="http://creativeinsite.us/sites/all/themes/creativeinsite/images/view_site.png" /></a></p>
<?php endif; ?>
<div class="clear-block">
<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>
</div>
</div>
Basically the reason for this is because the layout is going to change if a project type is selected for a blog entry. Is this the best way to do this?