⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.ua_get_news.php

📁 支持中、英、繁三种语言; 3、提供9套风格任意转换; 4、内嵌全球免费可视电话系统
💻 PHP
字号:
<?php
//取得新闻
function smarty_function_ua_get_news($params){
	global $news;
	global $g_db;
	$conditions = array();
	$limit = null;
	//新闻类型:news_type
	extract($params);
	$conditions[] = "News.status=1";
	if (isset($params['class'])) {
		$style_class = "class='".$params['class']."'";
	}
	if (isset($params['type'])) {
		$conditions[] = "News.type_id=".$params['type'];
	}
	if(isset($params['max'])) {
		$limit = intval($params['max']);
		$limit = " limit ".$limit;
	}else{
		$limit = " limit 10";
	}
	$fields = "News.id AS NewsId,News.title as NewsTitle,News.html_file_id as NewsHtmlFileId,News.created as CreateDate";
	$tmp_cond = implode(" and ", $conditions);
	$sql = "select ".$fields." from ".$news->getTable(true)." where ".$tmp_cond.$limit;
	$result = $g_db->GetAll($sql);
	$output = "<table id='news".getRadomStr(3)."' ".$style_class." cellspacing=0 width='100%'><tr>\n";
	$i = 0;
	foreach($result as $key=>$val){
		$output.="<td><a href='".URL."news/detail.php?id=".$val['NewsId']."' target='_blank'>".$val['NewsTitle']."</a></td>\n";
		if (isset($params['wrap']) && (($i%$params['wrap'])==0)) {
			$output.="</tr><tr>";
		}
	}
	$output.="</tr></table>";
	return $output;
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -