I'm not a fan of conditionals in a template either, but when it comes to the crunch.. it's hard to avoid them.
If the design of the site itself requires a condition, such as the example I posted of showing a table if it has data, if it doesn't then show a message stating so, then a condition pretty much has to be in the template
The absolute ideal (imo..) would be something like:
Code: Select all
?>
<?xml DOCTYPE blah.. ?>
<html>
<head>
<title><?php $page->getTitle(); ?></title>
<link rel="stylesheet" href="<?php $user->getStyleSheet(); ?>" type="text/css" />
</head>
<body>
<div class="page">
<div class="bannerMenu">
<?php $page->getBannerMenu(); ?>
</div>
<div class="tbl_News">
<?php $page->getHMTLTable('tbl_News'); /* this will contain the condition and will echo the table
or the no data message as a result */ ?>
</div>
</div>
</body>
</html>
Where the <?php ?> segments are as close to just place-holders as possible.
But the problem faced there, is what if the design changes and the site owner now wants an image displayed instead of a message, or even just the message itself to change? The designer has a look - and can probably make the change, but is not supposed to - sees it is a logic process, so now the logic developer has to get involved.