<?php
class TagLibIvearsShow extends TagLib{
 protected $tags   =  array('IvearsShow'=>array('attr'=>'table,where,cid,order,limit,id,page,sql,field,key,mod,debug','level'=>3));
 public function _IvearsShow ($attr,$content){
       $attr = $this->parseXmlAttr($attr);
       $table=$attr['table'];//获取table值
	   if(!$table){
		  	$table="Article"; 
		  }
	   $id=$attr['id'];
		if($id){
			$where="id=$id";
			$min_where="id<$id";
			$max_where="id>$id";
		}
       $str='<?php ';
       $str .= '$field=array("id","title","content");';//定义需要调用的字段
       $str .= '$Show=D("'.$table.'")->where("'.$where.'")->find();';//查询语句
	   $str .= '$ShowMin=D("'.$table.'")->where("'.$min_where.'")->find();';//上一条
	   $str .= '$ShowMax=D("'.$table.'")->where("'.$max_where.'")->find();';//下一条
       $str .='  ?>';
       return $str;
       }
 }