分页方法替换

This commit is contained in:
wlx 2011-10-26 09:34:19 +00:00
parent 099884dd4e
commit 915b7c1ab5
1 changed files with 13 additions and 20 deletions

View File

@ -23,27 +23,20 @@ $this->breadcrumb()->setSeparator(' > ');
<?php endforeach; ?>
</ul></fieldset>
</div>
<?php if (count($this->paginator)): ?>
<?php if (!empty($this->metadata)) : ?>
<div id='metacontent'>
<h1>当前浏览:<?php echo $this->codename; ?></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php
$i=0;
foreach ($this->paginator as $item):
$i++;
if (mb_strlen($item['description'])>700)
{
$item['description'] = mb_substr($item['description'],0,400,'UTF-8').'...';
}
if($i%2==0) $style="style='background:#fafafa;'";
else $style="";
echo '<div class="mditem" '.$style.'>
<div class="thumb"><img src="/data/thumb/id/'.$item['id'].'" /></div>
<h2><a href="/data/'.$item['uuid'].'">'.$this->escape($item['title']).'</a>
</h2>
<p>'.$item['description'].'</p>
</div>';
endforeach;
?>
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<div class="thumb"><img src="/service/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach; ?>
<?php echo $this->page->getNavigation(); ?>
</div>
<?= $this->paginator; ?>
<?php endif; ?>