添加大缩略图显示功能

This commit is contained in:
Li Jianxuan 2013-04-16 07:05:48 +00:00
parent 301d780da7
commit 69ae1d31c2
3 changed files with 81 additions and 71 deletions

View File

@ -1,66 +1,63 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/data/tag">关键词浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
?>
<div id='row-fluid'>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->metadata)) : ?>
<div id='metacontent'>
<h1>当前浏览:<?php echo $this->codename; ?></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<div class="thumb">
<a href="javascript:void(0);" class="gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>">
<img src="/service/thumb/id/<?php echo $md['id'];?>" />
</a>
</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>
<?php else : ?>
<div id='leftnav'>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul></fieldset>
<?php endif;
$type=$cg['keytype'];
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php else : ?>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<?php endif; ?>
<script>
$('a.gallery').bind('click',function(){
$.colorbox({
photo:$(this).attr('rel'),
});
});
</script>
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/data/tag">关键词浏览</a>');
if (!empty($this->codename)) $this->breadcrumb($this->codename);
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
?>
<div id='row-fluid'>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->metadata)) : ?>
<div id='metacontent'>
<h1>当前浏览:<?php echo $this->codename; ?></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<div class="thumb">
<a href="javascript:void(0);" class="gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>">
<img src="/service/thumb/id/<?php echo $md['id'];?>" />
</a>
</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>
<?php else : ?>
<div id='leftnav'>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul></fieldset>
<?php endif;
$type=$cg['keytype'];
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php else : ?>
<li><a href='/data/tag/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<?php endif; ?>
<script>
$('a.gallery').bind('click',function(){
$.colorbox({
photo:$(this).attr('rel'),
});
});
</script>

View File

@ -9,6 +9,7 @@ $this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('缩略图浏览');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'masonry');
$this->theme->AppendPlus($this,'colorbox');
?>
<div class="row-fluit">
<?php echo $this->page->getNavigation(); ?>
@ -16,7 +17,7 @@ $this->theme->AppendPlus($this,'masonry');
<?php foreach($this->metadata as $md) : ?>
<li class="items">
<h4><a href="/data/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4>
<a href="/data/<?php echo $md['uuid'];?>" class="thumbnail">
<a href="javascript:void(0);" class="thumbnail gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>">
<img src="/service/thumb/id/<?php echo $md['id'];?>" alt="">
</a>
<div class="caption">
@ -38,6 +39,11 @@ $(function(){
itemSelector : '.items',
//columnWidth : 240
});
$('a.gallery').bind('click',function(){
$.colorbox({
photo:$(this).attr('rel'),
});
});
});
</script>

View File

@ -24,7 +24,7 @@ $this->theme->AppendPlus($this,'masonry');
<?php foreach($this->metadata as $md) : ?>
<li class="items">
<h4><a href="/heihe/view/uuid/<?php echo $md['uuid'];?>"><?= $this->escape($md['title']);?></a></h4>
<a href="/heihe/view/uuid/<?php echo $md['uuid'];?>" class="thumbnail">
<a href="javascript:void(0);" class="thumbnail gallery" rel="/service/bigthumb/uuid/<?= $md['uuid'] ?>">
<img src="/service/thumb/id/<?php echo $md['id'];?>" alt="">
</a>
<div class="caption">
@ -42,8 +42,15 @@ $this->theme->AppendPlus($this,'masonry');
</div>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});});
$(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$('a.gallery').bind('click',function(){
$.colorbox({
photo:$(this).attr('rel'),
});
});
});
$('#container').masonry({
itemSelector : '.items',
});
itemSelector : '.items',
});
</script>