<a href="/?region_id={zhuayi:echo.$fields['region_id'] /}<?php echo get_url('region_id');?>" class="<?php if($_GET['region_id'] && $fields['region_id'] == $_GET['region_id']){echo 'select';};?>">{zhuayi:echo.$fields['region_name'] /}</a>
<?php
function get_url($unset){
if($_GET){
foreach($_GET as $key => $val){
if($key != $unset){
$str .= '&'.$key.'='.$val;
}
}
}
return $str;
}
?>
<?php
/*----------用户列表-------*/
function link_list($atts)
{
extract($atts, EXTR_OVERWRITE);
//------
global $query,$user;
if (empty($_REQUEST['page']))
{
$_REQUEST['page']= 1;
$startnum = 0 ;
}
else
$startnum = ($_REQUEST['page']-1)*$limit;
if (!empty($_REQUEST['search']))
{
$search_a .= " and url like '%".$_REQUEST['search']."%'";
}
if (!empty($user['userid']))
{
if($_SERVER['SCRIPT_NAME'] == '/mysite.php'){
$search_a .= " and add_user ='".$user['userid']."'";
}
}
if (!empty($_GET['region_id']))
{
$search_a .= " and region_id = '".$_GET['region_id']."'";
}
if (!empty($_GET['shoulu']))
{
$shoulu = explode('-',trim($_GET['shoulu']));
if($_GET['shoulu'] == 100000){
$search_a .= " and baidu > ".trim($_GET['shoulu']);
}else{
if(is_numeric($shoulu[0]) && is_numeric($shoulu[1])){
$search_a .= " and baidu > $shoulu[0] and baidu < $shoulu[1]";
}
}
}
if (!empty($_GET['classid']))
{
if(is_numeric($_GET['classid'])){
$search_a .= " and a.classid = '".$_GET['classid']."'";
}
}
if (!empty($_GET['pr']))
{
$search_a .= " and a.pr = '".$_GET['pr']."'";
}
if (!empty($_REQUEST['order']))
{
$search_a .= " order by ".$_REQUEST['order']." desc ";
}
else
{
$search_a .= " order by a.id desc";
}
$sql = "select a.*,b.*,c.classname,c.classid from ".T."link as a left join ".T."user as b on a.add_user = b.userid left join ".T."class as c on a.classid = c.classid where id>0 ".$search_a." limit $startnum,$limit";
$reset = $query->query($sql);
//echo $sql;
while ($row = $query->fetch_array($reset))
{
$row['dtime'] = date('Y-m-d G:i:s',$row['dtime']);
$list[] = $row;
}
return $list;
}
?>
<?php
$cats = array(1 => '艺术', 2 => '人文', 3 => '科学'); // 分类
// 假设分类的参数是 classid
unset($_GET['classid']); // 去掉 classid
// 余下的所有参数,附加到链接后面
if($_GET){
$gets = '&'.implode('&', $_GET);
}
// 动态输出分类链接
foreach($cats as $tid => $name){
// 其它参数附加在后面,比如城市、pr之类的
echo '<a href="user.php?classid='.$tid.$gets '">'.$name.'</a>';
}
?>