<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */

/**
 * Smarty {textformat}{/textformat} block plugin
 *
 * Type:     block function<br>
 * Name:     textformat<br>
 * Purpose:  format text a certain way with preset styles
 *           or custom wrap/indent settings<br>
 * @link http://smarty.php.net/manual/en/language.function.textformat.php {textformat}
 *       (Smarty online manual)
 * @param array
 * <pre>
 * Params:   style: string (email)
 *           indent: integer (0)
 *           wrap: integer (80)
 *           wrap_char string ("\n")
 *           indent_char: string (" ")
 *           wrap_boundary: boolean (true)
 * </pre>
 * @author Monte Ohrt <monte at ohrt dot com>
 * @param string contents of the block
 * @param Smarty clever simulation of a method
 * @return string string $content re-formatted
 */
function smarty_block_getsingle($params, $content, &$smarty)
{
    if (is_null($content)) {
        return;
    }
 extract($params); 
 $toid = isset($params['inid'])? $params['inid'] : '';
 $pid = isset($_GET['id']) ? intval($_GET['id']) : $toid;
 if(!is_numeric($pid)){
 return "<script>alert('传入的参数错误,系统正返回首页');location.href='index.php';</script>";
 exit();
 	}
$psql = "select * from limao_single where lm_action=1 and lm_id=".cinput($pid);
          $listmrs = mysql_query($psql);
if(mysql_num_rows($listmrs)<=0){
return "<script type='text/javascript'>alert('此页面管理员已设置隐藏');location.href='index.php';</script>";
exit();
	}
          if($listmrs){         	
  $listcols = mysql_num_fields($listmrs)-1;
	$liststr = '';
	while($listrows=mysql_fetch_array($listmrs)){
			$listtmp = $content;
	 for($m=0;$m<=$listcols;$m++){
	$fieldname = mysql_field_name($listmrs,$m);
	$listtmp = str_replace("[\$field.".$fieldname."]",rinput($listrows[$m]),$listtmp);
}
 $liststr .= $listtmp;
}
 return $liststr;
        }else{
  return '没有符合条件的数据啊！！';
       	}


  
 }




?>
