Author: franiglesias
(2010/03/17 11:24) Almost 2 years ago
Refactoring to get a more flexible approach
1
<?php
2
$limit = 3;
if (!isset($limit)) {
3
4
}
5
if (!isset($description)) {
6
$description = false;
7
$channel = null;
8
$items = $this->requestAction(array(
9
'plugin' => 'contents',
10
...
11
?>
16
12
17
13
<div id="featured_items" class="clearfix">
18
14
<ul>
15
<?php foreach ($items as $item): ?>
19
<li>
20
<article>
<p class="clearfix"><?php if ($item['Item']['image']): ?>
21
<?php if ($item['Item']['image']): ?>
22
echo $theme->thumbnail($item['Item']['image'], array('class' => 'top left'));
23
24
<?php endif; ?>
25
<?php echo $theme->itemLink($item['Item']['title'], $item['Item']['slug']); ?>
26
<h1><?php echo $theme->itemLink($item['Item']['title'], $item['Item']['slug']); ?></h1>
</p>
27
<?php if ($description): ?>
</li>
28
<p><?php echo $item['Item']['description'] ?></p>
29
<?php endif ?>
30
</article>
<?php endforeach ?>
31
</ul>
</div>
32
$limit = 3;if (!isset($limit)) {$limit = 3;}if (!isset($description)) {$description = false;}<ul><li><article><p class="clearfix"><?php if ($item['Item']['image']): ?>echo $theme->thumbnail($item['Item']['image'], array('class' => 'top left'));echo $theme->thumbnail($item['Item']['image'], array('class' => 'top left'));<?php echo $theme->itemLink($item['Item']['title'], $item['Item']['slug']); ?><h1><?php echo $theme->itemLink($item['Item']['title'], $item['Item']['slug']); ?></h1></p><?php if ($description): ?></li><p><?php echo $item['Item']['description'] ?></p><?php endif ?></article></ul>