/** * 线路套餐调用标签 * * @version $Id: getlinesuit.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2014, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getlinesuit(&$ctag, &$refObj) { global $dsql; $attlist = "row|10,lineid|0"; $webid = 0; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $lineid = $lineid ? $lineid : $refObj->Fields['id']; //线路id $sql = "select a.* from #@__line_suit a where a.lineid='{$lineid}' order by a.displayorder asc"; $innertext = trim($ctag->GetInnertext()); $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $revalue = ''; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $row['title'] = $row['suitname']; //价格名称. foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
/** * 调用最新评论 * * @param int row 12 * int infolen 10 * @param int titlelen 100 * @return unknown */ function lib_feedback(&$ctag, &$refObj) { global $dsql; $attlist = "row|12,titlelen|24,infolen|100"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $totalrow = $row; $revalue = ''; if (empty($innertext)) { $innertext = GetSysTemplets('tag_feedback.htm'); } $wsql = " where ischeck=1 "; $equery = "SELECT * FROM `#@__feedback` {$wsql} ORDER BY id DESC LIMIT 0 , {$totalrow}"; $ctp = new DedeTagParse(); $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innertext); $dsql->Execute('fb', $equery); while ($arr = $dsql->GetArray('fb')) { $arr['title'] = cn_substr($arr['arctitle'], $titlelen); $arr['msg'] = jstrim($arr['msg'], $infolen); foreach ($ctp->CTags as $tagid => $ctag) { if (!empty($arr[$ctag->GetName()])) { $ctp->Assign($tagid, $arr[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_getslidenavbyid(&$ctag, &$refObj) { global $dsql, $outlist; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,kindid|0,"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $sql = "select id,kindname as categoryname,linkurl as url,color from #@__plugin_leftnav where pid='{$kindid}' and isopen=1 order by displayorder asc limit 0,{$row}"; $arr = $dsql->getAll($sql); for ($i = 0; isset($arr[$i]); $i++) { $row = $arr[$i]; $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $outlist = ''; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
/** * * @version $Id: arcpagelist.lib.php 1 9:29 2010年7月6日Z tianya $ * @package DedeCMS.Taglib * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ function lib_arcpagelist(&$ctag, &$refObj) { global $dsql; $attlist = "tagid|,style|1"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $row = $dsql->GetOne("SELECT * FROM #@__arcmulti WHERE tagid='{$tagid}'"); if (is_array($row)) { $ids = explode(',', $row['arcids']); $totalnum = count($ids); $pagestr = '<div id="page_' . $tagid . '">'; if ($row['pagesize'] < $totalnum) { $pagestr .= multipage($totalnum, 1, $row['pagesize'], $tagid); } else { $pagestr .= '共1页'; } $pagestr .= '</div>'; return $pagestr; } else { $pagestr = '<div id="page_' . $tagid . '">'; $pagestr .= '没有检索到对应分页'; $pagestr .= '</div>'; return $pagestr; } }
function lib_cattree(&$ctag, &$refObj) { global $dsql; //属性处理 //属性 showall 在空或不存在时,强制用产品模型id;如果是 yes 刚显示整个语言区栏目树;为其它数字则是这个数字的模型的id //typeid 指定顶级树 id ,指定后,前一个属性将无效 $attlist = "showall|,catid|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; if (empty($typeid)) { if (isset($refObj->TypeLink->TypeInfos['id'])) { $typeid = $refObj->TypeLink->TypeInfos['id']; $reid = $refObj->TypeLink->TypeInfos['reid']; $topid = $refObj->TypeLink->TypeInfos['topid']; $channeltype = $refObj->TypeLink->TypeInfos['channeltype']; $ispart = $refObj->TypeLink->TypeInfos['ispart']; if ($reid == 0) { $topid = $typeid; } } else { $typeid = $reid = $topid = $channeltype = $ispart = 0; } } else { $row = $dsql->GetOne("Select reid,topid,channeltype,ispart From `#@__arctype` where id='{$typeid}' "); if (!is_array($row)) { $typeid = $reid = $topid = $channeltype = $ispart = 0; } else { $reid = $row['reid']; $topid = $row['topid']; $channeltype = $row['channeltype']; $ispart = $row['ispart']; } } if (!empty($catid)) { $topQuery = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `#@__arctype` where reid='{$catid}' And ishidden<>1 "; } else { if ($showall == "yes") { $topQuery = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `#@__arctype` where reid='{$topid}' "; } else { if ($showall == '') { if ($ispart < 2 && !empty($channeltype)) { $showall = $channeltype; } else { $showall = 6; } } $topQuery = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `#@__arctype` where reid='{$topid}' And channeltype='{$showall}' And ispart<2 And ishidden<>1 "; } } $dsql->Execute('t', $topQuery); while ($row = $dsql->GetArray('t')) { $row['typelink'] = GetOneTypeUrlA($row); $revalue .= "<dl class='cattree'>\n"; $revalue .= "<dt><a href='{$row['typelink']}'>{$row['typename']}</a></dt>\n"; cattreeListSon($row['id'], $revalue); $revalue .= "</dl>\n"; } return $revalue; }
/** * 通用模块产品调用标签 * * @version $Id: gettongyongsuit.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2015, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_gettongyonglist(&$ctag, &$refObj) { global $dsql; $attlist = "row|10,pinyin|0,limit|0,type|byorder"; $webid = 0; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if (empty($pinyin)) { return ''; } $sql = "select id as typeid,addtable from sline_model where pinyin='{$pinyin}'"; $ar = $dsql->GetOne($sql); $sql = ''; if (!empty($ar['typeid'])) { $addtable = 'sline_' . $ar['addtable']; $typeid = $ar['typeid']; if ($type == 'byorder') { $sql = "select a.id as realid,a.*,b.* from sline_model_archive a left join {$addtable} b on(a.id=b.productid) left join sline_allorderlist c on(a.id=c.id and c.typeid={$typeid}) where a.typeid={$typeid} order by ifnull(c.displayorder,9999) asc,a.addtime desc limit {$limit},{$row} "; } else { if ($type == 'mdd') { $sonid = isset($definekind) ? $definekind : $refObj->Fields['kindid']; //这里增加子站的判断 if ($GLOBALS['sys_child_webid'] != 0) { $dest_id = $GLOBALS['sys_child_webid']; } $sonid = $sonid ? $sonid : $dest_id; $sql = "select a.id as realid,a.*,b.* from sline_model_archive a left join {$addtable} b on(a.id=b.productid) left join sline_allorderlist c on(a.id=c.id and c.typeid={$typeid}) where a.typeid={$typeid} and FIND_IN_SET({$sonid},a.kindlist) order by ifnull(c.displayorder,9999) asc,a.addtime desc limit {$limit},{$row} "; } } } if (empty($sql)) { return ''; } $innertext = trim($ctag->GetInnertext()); $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $revalue = ''; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $row['url'] = $GLOBALS['cfg_basehost'] . '/' . $pinyin . '/' . 'show_' . $row['aid'] . '.html'; $row['price'] = TagTongYong::getProductMinPrice($row['realid']); foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_leftnav(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|20,"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $table = "#@__destinations"; $sql = "select id,kindname,pinyin from {$table} where pid= 0 and isopen=1 order by displayorder asc"; $kindnames = array(); $ids = $pinyin = array(); $arr = $dsql->getAll($sql); for ($i = 0; isset($arr[$i]['id']); $i++) { $ids[] = $arr[$i]['id']; $kindname[] = $arr[$i]['kindname']; $pinyin[] = $arr[$i]['pinyin']; } $GLOBALS['autoindex'] = 0; for ($k = 0; isset($ids[$k]); $k++) { $GLOBALS['autoindex']++; $pv = new View(0); $pv->Fields['kindname'] = $kindnames[$k]; $pv->Fields['kindid'] = $ids[$k]; $pv->Fields['pinyin'] = $pinyin[$k]; $pv->SetTemplet($innertext, 'string'); $revalue .= $pv->GetResult(); } return $revalue; }
/** * 单独广告调用 * * @version $Id: singlead.lib.php 1 9:29 2013.05.03 netman $ * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2010, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_singlead(&$ctag, &$refObj) { global $dsql, $sys_webid; $attlist = "typeid|0,name|,row|3"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if ($name == '') { return ''; } $innertext = trim($ctag->GetInnertext()); $revalue = ''; $webid = $GLOBALS['sys_child_webid']; //webid赋值 $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $sql = "SELECT * FROM sline_advertise WHERE tagname = '{$name}' and webid='{$webid}' limit 1 "; $row = $dsql->GetOne($sql); //$row['picurl']=getUploadFileUrl($row['picurl']); if (is_array($row)) { foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
/** * 访问历史标签代码 * * @version $Id: gethistory.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2014, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_gethistory(&$ctag, &$refObj) { global $dsql; $attlist = "row|6"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; if (isset($_COOKIE['St']['line'])) { $list = unserialize($_COOKIE['St']['line']); $arr = getLineList($list); } else { return; } $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; foreach ($arr as $row) { $GLOBALS['autoindex']++; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_memberlist(&$ctag, &$refObj) { global $dsql, $sqlCt; $attlist = "row|6,iscommend|0,orderby|logintime,signlen|50"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; $innerText = trim($ctag->GetInnerText()); if (empty($innerText)) { $innerText = GetSysTemplets('memberlist.htm'); } $wheresql = ' WHERE mb.spacesta>-1 AND mb.matt<10 '; if ($iscommend > 0) { $wheresql .= " AND mb.matt='{$iscommend}' "; } $sql = "SELECT mb.*,ms.spacename,ms.sign FROM `#@__member` mb\r\n LEFT JOIN `#@__member_space` ms ON ms.mid = mb.mid\r\n {$wheresql} order by mb.{$orderby} DESC LIMIT 0,{$row} "; $ctp = new DedeTagParse(); $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); $dsql->Execute('mb', $sql); while ($row = $dsql->GetArray('mb')) { $row['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $row['userid']; if (empty($row['face'])) { $row['face'] = $row['sex'] == '女' ? $GLOBALS['cfg_memberurl'] . '/templets/images/dfgirl.png' : $GLOBALS['cfg_memberurl'] . '/templets/images/dfboy.png'; } foreach ($ctp->CTags as $tagid => $ctag) { if (isset($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_likesgpage(&$ctag, &$refObj) { global $dsql; //把属性转为变量,如果不想进行此步骤,也可以直接从 $ctag->CAttribute->Items 获得,这样也可以支持中文名 $attlist = "row|8"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $aid = isset($refObj->Fields['aid']) ? $refObj->Fields['aid'] : 0; $revalue = ''; if ($innertext == '') { $innertext = GetSysTemplets("part_likesgpage.htm"); } $likeid = empty($refObj->Fields['likeid']) ? 'all' : $refObj->Fields['likeid']; $dsql->SetQuery("SELECT aid,title,filename FROM `#@__sgpage` WHERE likeid LIKE '{$likeid}' LIMIT 0,{$row}"); $dsql->Execute(); $ctp = new DedeTagParse(); $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innertext); while ($row = $dsql->GetArray()) { if ($aid != $row['aid']) { $row['url'] = $GLOBALS['cfg_cmsurl'] . '/' . $row['filename']; foreach ($ctp->CTags as $tagid => $ctag) { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } else { $revalue .= '<dd class="cur"><span>' . $row['title'] . '</span></dd>'; } } return $revalue; }
function lib_hotwords(&$ctag, &$refObj) { global $cfg_phpurl, $dsql; $attlist = "num|6,subday|365,maxlength|16"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $nowtime = time(); if (empty($subday)) { $subday = 365; } if (empty($num)) { $num = 6; } if (empty($maxlength)) { $maxlength = 20; } $maxlength = $maxlength + 1; $mintime = $nowtime - $subday * 24 * 3600; $dsql->SetQuery("Select keyword From `#@__search_keywords` where lasttime>{$mintime} And length(keyword)<{$maxlength} order by count desc limit 0,{$num}"); $dsql->Execute('hw'); $hotword = ''; while ($row = $dsql->GetArray('hw')) { $hotword .= " <a href='" . $cfg_phpurl . "/search.php?keyword=" . urlencode($row['keyword']) . "'>" . $row['keyword'] . "</a> "; } return $hotword; }
/** * 调用分类标签(景点首页调用) * * @version $Id: getcategory.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getdestbypid(&$ctag, &$refObj) { global $dsql, $outlist; include SLINEDATA . "/webinfo.php"; $attlist = "row|8,pid|,limit|0,flag|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $kindid = $refObj->Fields['kindid']; $innertext = trim($ctag->GetInnertext()); $revalue = ''; $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); if ($flag == 'spot') { $sql = "select a.kindname,a.id,b.displayorder,a.jieshao,a.pinyin from #@__destinations a inner join #@__spot_kindlist as b on a.id=b.kindid and a.pid={$kindid} order by b.displayorder limit {$limit},{$row}"; } else { $sql = "select id,kindname,pinyin from #@__destinations where pid={$kindid} and isopen=1 order by displayorder limit {$limit},{$row}"; } $rows = $dsql->getAll($sql); foreach ($rows as $row) { $row['kindid'] = $row['id']; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_hotwords(&$ctag, &$refObj) { global $cfg_phpurl, $dsql; $attlist = "num|6,subday|365,maxlength|16"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $nowtime = time(); if (empty($subday)) { $subday = 365; } if (empty($num)) { $num = 6; } if (empty($maxlength)) { $maxlength = 20; } $maxlength = $maxlength + 1; $mintime = $nowtime - $subday * 24 * 3600; // 2011-6-28 根据论坛反馈(http://bbs.dedecms.com/371416.html),修正SQL大小写问题(by:织梦的鱼) $dsql->SetQuery("SELECT keyword FROM `#@__search_keywords` WHERE lasttime>{$mintime} AND length(keyword)<{$maxlength} ORDER BY count DESC LIMIT 0,{$num}"); $dsql->Execute('hw'); $hotword = ''; while ($row = $dsql->GetArray('hw')) { $hotword .= " <a href='" . $cfg_phpurl . "/search.php?keyword=" . urlencode($row['keyword']) . "'>" . $row['keyword'] . "</a> "; } return $hotword; }
function lib_mynews(&$ctag, &$refObj) { global $dsql, $envs; //属性处理 $attlist = "row|1,titlelen|24"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); if (empty($row)) { $row = 1; } if (empty($titlelen)) { $titlelen = 30; } if (empty($innertext)) { $innertext = GetSysTemplets('mynews.htm'); } $idsql = ''; if ($envs['typeid'] > 0) { $idsql = " where typeid='" . GetTopid($this->TypeID) . "' "; } $dsql->SetQuery("Select * from #@__mynews {$idsql} order by senddate desc limit 0,{$row}"); $dsql->Execute(); $ctp = new DedeTagParse(); $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innertext); $revalue = ''; while ($row = $dsql->GetArray()) { foreach ($ctp->CTags as $tagid => $ctag) { @$ctp->Assign($tagid, $row[$ctag->GetName()]); } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_changyan(&$ctag, &$refObj) { global $dsql, $envs; //属性处理 $attlist = "type|code,config|,class|_DEDECY,style|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $reval = ""; if (!$dsql->IsTable("#@__plus_changyan_setting")) { return '没安装畅言模块'; } $client_id = changyan_get_setting('appid'); if (empty($client_id)) { return '尚未注册畅言帐号,请到后台注册'; } if ($type == 'code' or $type == 'code2') { $reval .= "<div class='{$class}' style='{$style}'>"; $prefix = 'changyan'; $key = 'code'; $row = GetCache($prefix, $key); if (!is_array($row)) { $appid = changyan_get_setting('appid'); $user = changyan_get_setting('user'); $sign = changyan_gen_sign($user); $result = changyan_getcode(CHANGYAN_CLIENT_ID, $user, false, $sign, $appid); $row['reval'] = htmlspecialchars($result['code']); SetCache($prefix, $key, $row, 60 * 60 * 1); } if (!empty($config)) { $config_arr = array(); $configs = explode(',', $config); if (count($configs) > 0) { foreach ($configs as $c) { $item = explode(':', $c); $config_arr[$item[0]] = $item[1]; } } $config_str = json_encode($config_arr); $reval .= <<<EOT <script> var_config={$config_str}; </script> EOT; } $reval .= htmlspecialchars_decode($row['reval']); $reval = str_replace("id='SOHUCS'", "id='SOHUCS' sid='{$refObj->ArcID}'", $reval); if ($type == 'code2') { $reval = preg_replace("#window.SCS_NO_IFRAME[ ]?=[ ]?true;#i", "", $reval); } $reval = str_replace("<script>", "</div><script>", $reval); } elseif ($type == 'count') { if (!$GLOBALS['changyan_count_js']) { $reval .= "<script type=\"text/javascript\" src=\"http://assets.changyan.sohu.com/upload/plugins/plugins.count.js\"></script>"; } $reval .= "<a href=\"#SOHUCS\" id=\"changyan_count_unit\"></a>"; $GLOBALS['changyan_count_js'] = TRUE; } return $reval; }
/** * 内容详细页调用标签 * * @version $Id: detailcontent.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2015, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_detailcontent(&$ctag, &$refObj) { global $dsql; $attlist = "row|10,typeid|"; $webid = 0; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $tables = array('1' => 'sline_line_content', '2' => 'sline_hotel_content', '3' => 'sline_car_content', '5' => 'sline_spot_content', '8' => 'sline_visa_content', '13' => 'sline_tuan_content'); $extend_tables = array('1' => 'sline_line_extend_field', '2' => 'sline_hotel_extend_field', '3' => 'sline_car_extend_field', '5' => 'sline_spot_extend_field', '8' => 'sline_visa_extend_field', '13' => 'sline_tuan_extend_field'); $table = $tables[$typeid]; $extend_tables = $extend_tables[$typeid]; if (empty($table)) { return ''; } $sql = "select columnname,chinesename,isrealfield from {$table} where webid=0 and isopen=1 order by displayorder asc"; $innertext = trim($ctag->GetInnertext()); $arr = $dsql->getAll($sql); //扩展表数据 $productid = $refObj->Fields['id']; $sql = "select * from {$extend_tables} where productid='{$productid}'"; $extend_row = $dsql->GetOne($sql); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $revalue = ''; foreach ($arr as $row) { $GLOBALS['autoindex']++; $row['productid'] = $refObj->Fields['id']; //产品id $content = ''; if (isset($refObj->Fields[$row['columnname']])) { $content = $refObj->Fields[$row['columnname']]; } else { if (isset($extend_row[$row['columnname']])) { $content = $extend_row[$row['columnname']]; } } $row['content'] = $row['isrealfield'] == 0 && empty($content) ? $row['productid'] : $content; // if(empty($row['content'])) continue; $row['content'] = detailcontent_filter($typeid, $row['columnname'], $row['content']); if ($row['content'] === false) { continue; } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_helplist(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "row|5,helpkindid|,flag|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $artlist = ''; $helpkindid = isset($refObj->Fields['helpkindid']) ? $refObj->Fields['helpkindid'] : ''; //针对指定kindid只查询一个分类的信息. $typeid = isset($refObj->Fields['typeid']) ? $refObj->Fields['typeid'] : '0'; if ($innertext == '') { return ''; } //获得类别ID总数的信息 $ids = array(); $kindnames = array(); if ($flag == 'all') { $sql = "select id,kindname,litpic from #@__help_kind where webid=0 and isopen=1 order by displayorder asc"; } else { if ($helpkindid == '') { $sql = "select id,kindname,litpic from #@__help_kind where webid=0 and isopen=1 order by displayorder asc limit 0,{$row}"; } else { $sql = "select id,kindname,litpic from #@__help_kind where webid=0 and isopen=1 and id={$helpkindid} order by displayorder asc limit 0,{$row}"; } } $dsql->SetQuery($sql); $dsql->Execute(); while ($row = $dsql->GetArray()) { $ids[] = $row['id']; $kindnames[] = $row['kindname']; //获取帮助分类名称 $imgsrc[] = $row['litpic']; } if (!isset($ids[0])) { return ''; } //如里分类不存在则退出 for ($i = 0; isset($ids[$i]); $i++) { $pv = new View($typeid); if ($imgsrc[$i] != '') { $kindname = "<img src=\"{$imgsrc[$i]}\" alt=\"{$kindnames[$i]}\">"; } else { $kindname = $kindnames[$i]; } $url = $GLOBALS['cfg_base_url'] . "/help/index_{$ids[$i]}.html"; $pv->Fields['kindname'] = $kindname; $pv->Fields['helpkindname'] = $kindnames[$i]; $pv->Fields['ids'] = $ids[$i]; $pv->Fields['id'] = $ids[$i]; $pv->Fields['sonid'] = $ids[$i]; $pv->Fields['url'] = $url; $pv->Fields['litpic'] = $imgsrc[$i]; $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); } return $artlist; }
/** * 广告调用 * * @version $Id: myad.lib.php 1 9:29 2011.05.03 netman $ * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2010, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_myad(&$ctag, &$refObj) { $attlist = "typeid|0,name|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $body = lib_GetMyad($refObj, $typeid, $name, '#@__advertise'); return $body; }
/** * 获取签证分类标签 * * @version $Id: visatype.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_visatype(&$ctag, &$refObj) { global $dsql; include SLINEDATA . "/webinfo.php"; $attlist = "typeid|0,row|5,flag|kind,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; //签证类型 if ($flag == 'kind') { $sql = "select * from #@__visa_kind where isopen=1 order by displayorder asc"; } else { if ($flag == 'city') { $sql = "select * from #@__visa_city order by displayorder asc"; } else { if ($flag == 'country') { $sql = "select * from #@__visa_area where isopen = 1 and pid!=0 order by displayorder asc limit {$limit},{$row}"; } else { if ($flag == 'hotcountry') { $sql = "select * from #@__visa_area where isopen = 1 and pid!=0 and ishot=1 order by displayorder asc limit {$limit},{$row}"; } else { if ($flag == 'getcountrybypid') { $pid = $refObj->Fields['areaid'] ? $refObj->Fields['areaid'] : 0; if (empty($pid)) { exit; } $sql = "select * from #@__visa_area where isopen = 1 and pid='{$pid}' order by displayorder,pinyin asc limit {$limit},{$row}"; } } } } } $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $row['title'] = $row['kindname']; $row['litpic'] = isset($row['litpic']) ? $row['litpic'] : getDefaultImage(); foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
/** * 线路分类详细页调用标签 * * @version $Id: getlinecontent.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getlinecontent(&$ctag, &$refObj) { global $dsql; $attlist = "row|10,flag|"; $webid = 0; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $sql = "select columnname,chinesename from #@__line_content where webid=0 and isopen=1 and columnname!='booking' and columnname!='linespot' and columnname!='pinglun' and columnname !='zuche' order by displayorder asc"; $innertext = trim($ctag->GetInnertext()); $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; $revalue = ''; while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; $row['lineid'] = $refObj->Fields['id']; //线路 $row['content'] = isset($refObj->Fields[$row['columnname']]) ? $refObj->Fields[$row['columnname']] : ''; if ($row['columnname'] == "payment") { if (empty($refObj->Fields[$row['columnname']])) { $row['content'] = $GLOBALS['cfg_payment']; } } else { if ($row['columnname'] == 'jieshao') { /* if($refObj->Fields['isstyle']==1) { $row['content'] = isset($refObj->Fields['jieshao']) ? $refObj->Fields['jieshao'] : ''; } else { $row['content'] = isset($refObj->Fields['id']) ? $refObj->Fields['id'] : ''; }*/ $row['content'] = $refObj->Fields['id']; } } /* else if($row['columnname']=="jieshao") { $row['content']= $style == 1 ? $refObj->Fields['jieshao'] : $refObj->Fields['txtjieshao']; }*/ if (empty($row['content'])) { continue; } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_getcarbygroup(&$ctag, &$refObj) { global $dsql, $sys_webid; $attlist = "row|8,flag|0,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText(); $dtp2 = new STTagParse(); $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); //加目的地页面显示条件 if ($flag == 'bystyle') { $styleid = $refObj->Fields['styleid']; $sqlstr = "select * from sline_car where carkindid='{$styleid}' limit {$limit},{$row}"; } if (empty($sqlstr)) { return ''; } $dsql->SetQuery($sqlstr); $dsql->Execute(); $totalRow = $dsql->GetTotalRow(); $likeType = ''; $GLOBALS['autoindex'] = 0; //?? for ($i = 0; $i < $totalRow; $i++) { $GLOBALS['autoindex']++; if ($tablerow = $dsql->GetArray()) { $url = GetWebURLByWebid($tablerow['webid']); $tablerow['url'] = $url . "/cars/show_{$tablerow['aid']}.html"; $tablerow['title'] = $tablerow['title']; $tablerow['lit240'] = getUploadFileUrl(str_replace('litimg', 'lit240', $tablerow['litpic'])); $tablerow['lit160'] = getUploadFileUrl(str_replace('litimg', 'lit160', $tablerow['litpic'])); $tablerow['litpic'] = getUploadFileUrl($tablerow['litpic']); $real = getCarNewRealPrice($tablerow['aid'], $tablerow['webid']); $tablerow['minprice'] = $real ? $real : $tablerow['minprice']; $tablerow['sellprice'] = $real ? $real : 0; $tablerow['price'] = empty($tablerow['minprice']) ? '电询' : $tablerow['minprice']; $tablerow['price2'] = empty($tablerow['minprice']) ? '电询' : '<span>¥</span><strong>' . $tablerow['minprice'] . '</strong><i>起</i>'; //目的地页面用 if (is_array($dtp2->CTags)) { foreach ($dtp2->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $dtp2->Assign($tagid, $tablerow); } else { $value = empty($tablerow[$ctag->GetName()]) ? '' : $tablerow[$ctag->GetName()]; $dtp2->Assign($tagid, $value); } } } $likeType .= $dtp2->GetResult(); } } //Loop for $i $dsql->FreeResult(); //print_r($likeType); return $likeType; }
/** * 获取结伴标签代码 * * @version $Id: getjieban.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2015, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getjieban(&$ctag, &$refObj) { global $dsql; $attlist = "row|6,flag|new,limit|0"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; if ($flag == 'new') { $sql = "select * from sline_jieban where status=1 order by addtime desc limit {$limit},{$row}"; } else { if ($flag == 'finish') { $sql = "select * from sline_jieban where status=2 order by addtime desc limit {$limit},{$row}"; } else { if ($flag == 'join') { $jiebanid = $refObj->Fields['id']; $sql = "select * from sline_jieban_join where jiebanid='{$jiebanid}' group by memberid order by addtime desc"; } } } $arr = $dsql->getAll($sql); foreach ($arr as $row) { $GLOBALS['autoindex']++; if ($flag != 'join') { $row['title'] = TagJB::getJiebanTitle($row); $row['kindnamelist'] = TagJB::getKindnameList($row, '-'); $row['posttime'] = TagJB::formatViewTime($row['addtime']); $row['membername'] = TagJB::getMemberName($row['memberid']); $row['url'] = $GLOBALS['cfg_cmsurl'] . '/jieban/show_' . $row['id'] . '.html'; $row['attrlist'] = TagJB::getAttrList($row['attrid']); $row['joinnum'] = TagJB::getJoinNumber($row['id']); } else { $memberinfo = Helper_Archive::getMemberInfo($row['memberid']); $row['membername'] = $memberinfo['nickname']; $row['litpic'] = $memberinfo['litpic'] ? $memberinfo['litpic'] : '/templets/smore/images/member_default.gif'; $row['joinnum'] = TagJB::getSingleJoinNumber($row['jiebanid'], $row['memberid']); } foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } else { $ctp->Assign($tagid, ''); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_getarctaglist(&$ctag, &$refObj) { global $dsql, $sys_webid; $attlist = "row|8"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $tagword = isset($refObj->Fields['tagword']) ? $refObj->Fields['tagword'] : ''; if ($tagword == '') { return ''; } $tagword = RemoveEmpty(explode(",", $tagword)); $i = 1; $where = ''; foreach ($tagword as $key => $value) { if ($i == 1) { $where .= "tagword like '%{$value}%'"; } else { $where .= " or tagword like '%{$value}%'"; } $i++; } $innertext = trim($ctag->GetInnertext()); $revalue = ''; $sql = "select aid,title,shownum,attrid,webid from #@__article where {$where} limit 0,{$row}"; $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { $weburl = GetWebURLByWebid($row['webid']); if ($row['webid'] == 0) { $row['url'] = $GLOBALS['cfg_cmsurl'] . "/raiders/show_{$row['aid']}.html"; $row['litpic'] = !empty($row['litpic']) ? $GLOBALS['cfg_cmsurl'] . $row['litpic'] : $GLOBALS['cfg_cmsurl'] . "/templets/default/images/pic_tem.gif"; } else { $row['url'] = GetWebURLByWebid($row['webid']) . "/raider/show_{$row['aid']}.html"; $row['litpic'] = !empty($row['litpic']) ? $weburl . $row['litpic'] : $GLOBALS['cfg_cmsurl'] . "/templets/default/images/pic_tem.gif"; } $row['title'] = $row['title']; $row['attrname'] = Getarctype($row['attrid']); foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++; } return $revalue; }
function lib_sonchannel(&$ctag, &$refObj) { global $_sys_globals, $dsql; $attlist = "row|100,nosonmsg|,col|1"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText(); $typeid = $_sys_globals['typeid']; if (empty($typeid)) { return $ctag->GetAtt('nosonmsg'); } $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\r\n FROM `#@__arctype` WHERE reid='{$typeid}' AND ishidden<>1 ORDER BY sortrank ASC LIMIT 0,{$row}"; //And id<>'$typeid' $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace("field", "[", "]"); $dtp2->LoadSource($innertext); $dsql->SetQuery($sql); $dsql->Execute(); $line = $row; $GLOBALS['autoindex'] = 0; $likeType = ''; for ($i = 0; $i < $line; $i++) { if ($col > 1) { $likeType .= "<dl>\r\n"; } for ($j = 0; $j < $col; $j++) { if ($col > 1) { $likeType .= "<dd>\r\n"; } if ($row = $dsql->GetArray()) { $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row); if (is_array($dtp2->CTags)) { foreach ($dtp2->CTags as $tagid => $ctag) { if (isset($row[$ctag->GetName()])) { $dtp2->Assign($tagid, $row[$ctag->GetName()]); } } } $likeType .= $dtp2->GetResult(); } if ($col > 1) { $likeType .= "</dd>\r\n"; } $GLOBALS['autoindex']++; } //Loop Col if ($col > 1) { $i += $col - 1; $likeType .= " </dl>\r\n"; } } //Loop for $i $dsql->FreeResult(); return $likeType; }
function lib_bookcontentlist(&$ctag, &$refObj) { global $dsql, $envs, $cfg_dbprefix, $cfg_cmsurl; $attlist = "row|12,booktype|-1,titlelen|30,orderby|lastpost,author|,keyword|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); if (!$dsql->IsTable("{$cfg_dbprefix}story_books")) { return '没安装连载模块'; } return lib_booklist($ctag, $refObj, 1); }
/** * 属性分类调用标签与attrgrouplist配合使用. * * @version $Id: getattrbygroup.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2011, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getattrbygroup(&$ctag, &$refObj) { global $dsql; $attlist = "row|80,typeid|,groupname|,groupid|,filterid|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $attrtable = array('1' => '#@__line_attr', '2' => '#@__hotel_attr', '3' => '#@__car_attr', '4' => '#@__article_attr', '5' => '#@__spot_attr', '6' => '#@__photo_attr', '11' => '#@__jieban_attr', '13' => '#@__tuan_attr'); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $typeid = empty($typeid) ? $refObj->Fields['typeid'] : $typeid; $tablename = isset($attrtable[$typeid]) ? $attrtable[$typeid] : '#@__model_attr'; $w = !empty($filterid) ? " and id not in({$filterid})" : ''; //排除不要的项 $w .= $typeid > 13 ? " and typeid={$typeid}" : ''; //如果是扩展模块,则增加typeid判断 if (!empty($groupname)) { $sql = "select id from {$tablename} where attrname='{$groupname}' {$w}"; $ar = $dsql->GetOne($sql); if (is_array($ar)) { $pid = $ar['id']; } } else { $pid = empty($groupid) ? $refObj->Fields['attrid'] : $groupid; } if (empty($pid)) { return; } //$sql="select id,attrname from {$tablename} where pid='$pid' and isopen=1 {$w} order by id asc limit 0,{$row}"; // 增加了属性判断是否开启 $sql = "select id,attrname,isopen from {$tablename} where pid='{$pid}' {$w} and isopen=1 order by id asc limit 0,{$row}"; $dsql->SetQuery($sql); $dsql->Execute(); $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; while ($row = $dsql->GetArray()) { $row['title'] = $row['attrname']; $row['attrid'] = $row['id']; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); $GLOBALS['autoindex']++; } return $revalue; }
/** * 线路左侧滑动导航标签(与leftnav配合使用) * * @version $Id: getleftnav.lib.php netman * @package Stourweb.Taglib * @copyright Copyright (c) 2007 - 2014, Stourweb, Inc. * @link http://www.stourweb.com */ function lib_getleftnav(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $pid = $refObj->Fields['kindid']; //上级导航 $innertext = trim($ctag->GetInnertext()); $table = "#@__destinations"; $revalue = ''; $sql = "select id,kindname,pinyin from {$table} where pid='{$pid}' and isopen=1 order by displayorder asc"; $arr = $dsql->getAll($sql); $GLOBALS['autoindex'] = 0; for ($i = 0; isset($arr[$i]); $i++) { $GLOBALS['autoindex']++; $row = $arr[$i]; $hotdest = getHotDest($row['id']); $row['categoryname'] = $arr[$i]['kindname']; $row['categorychild4'] = getCategoryChild($row['id']); //左侧显示的内容 $row['childleft'] = getHoverHtml($row['id']); //指向弹出的内容 $row['childpre'] = $hotdest[0]; $row['childnextall'] = $hotdest[1]; $row['childall'] = getCategoryChildAll($row['id']); //全部子级,右侧模块用 $row['youwanshijian'] = getYwTime($row['id']); //获取游玩时间 $row['shuxin'] = getShuXin($row['id']); //获取属性. $row['jiage'] = getJiaGe($row['id']); //获取价格 $row['tjxianlu'] = getTjXianlu($row['id']); //获取推荐线路 $row['pinyin'] = !empty($row['pinyin']) ? $row['pinyin'] : $row['id']; $ctp = new STTagParse(); $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $outlist = ''; foreach ($ctp->CTags as $tagid => $ctag) { if ($ctag->GetName() == 'array') { $ctp->Assign($tagid, $row); } else { if (!empty($row[$ctag->GetName()])) { $ctp->Assign($tagid, $row[$ctag->GetName()]); } } } $revalue .= $ctp->GetResult(); } return $revalue; }
function lib_attrgrouplist(&$ctag, &$refObj) { global $dsql; $attlist = "row|8,flag|,filterid|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $artlist = ''; $typeid = $typeid ? $typeid : $refObj->Fields['typeid']; if (empty($typeid)) { return ''; } $tablearr = array('1' => '#@__line_attr', '2' => '#@__hotel_attr', '3' => '#@__car_attr', '4' => '#@__article_attr', '5' => '#@__spot_attr', '6' => '#@__photo_attr', '11' => '#@__jieban_attr', '13' => '#@__tuan_attr'); $tablename = isset($tablearr[$typeid]) ? $tablearr[$typeid] : '#@__model_attr'; if ($innertext == '') { return ''; } //获得类别ID总数的信息 $groupids = array(); $groupnames = array(); $w = !empty($filterid) ? " and id not in({$filterid})" : ''; //排除不要的项 $w .= $typeid > 13 ? " and typeid={$typeid}" : ''; //如果是扩展模块,则增加typeid判断 $dest_id = $GLOBALS['dest_id'] ? $GLOBALS['dest_id'] : 0; if ($flag == 'bydestid') { $w .= !empty($dest_id) ? " and FIND_IN_SET({$dest_id},destid)" : ''; } $sql = "select id,attrname as groupname from {$tablename} where pid=0 and isopen=1 {$w} order by displayorder asc limit 0,{$row}"; $dsql->SetQuery($sql); $dsql->Execute(); while ($row = $dsql->GetArray()) { $groupids[] = $row['id']; $groupnames[] = $row['groupname']; //获取组名 } if (!isset($groupids[0])) { return ''; } //如里不存在则退出 $GLOBALS['itemindex'] = 0; for ($i = 0; isset($groupids[$i]); $i++) { $GLOBALS['itemindex']++; $pv = new View(0); $pv->Fields['groupname'] = $groupnames[$i]; $pv->Fields['groupid'] = $groupids[$i]; $pv->Fields['attrid'] = $groupids[$i]; $pv->Fields['typeid'] = $typeid; $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); } return $artlist; }
function lib_getattrbygroupid(&$ctag, &$refObj) { global $dsql; $attlist = "row|80,typeid|,groupname|,groupid|,filterid|"; FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $attrtable = array('1' => '#@__line_attr', '2' => '#@__hotel_attr', '3' => '#@__car_attr', '4' => '#@__article_attr', '5' => '#@__spot_attr', '6' => '#@__photo_attr', '11' => '#@__jieban_attr', '13' => '#@__tuan_attr'); $innertext = trim($ctag->GetInnertext()); $revalue = ''; $typeid = empty($typeid) ? $refObj->Fields['typeid'] : $typeid; $tablename = isset($attrtable[$typeid]) ? $attrtable[$typeid] : '#@__model_attr'; $w = !empty($filterid) ? " and id not in({$filterid})" : ''; //排除不要的项 $w .= $typeid > 13 ? " and typeid={$typeid}" : ''; //如果是扩展模块,则增加typeid判断 if (!empty($groupname)) { $sql = "select id from {$tablename} where attrname='{$groupname}' {$w}"; $row = $dsql->GetOne($sql); if (is_array($row)) { $pid = $row['id']; } } else { $pid = empty($groupid) ? $refObj->Fields['attrid'] : $groupid; } if (empty($pid)) { return; } $sql = "select id,attrname from {$tablename} where pid='{$pid}' {$w} order by displayorder asc limit 0,{$row}"; $dsql->SetQuery($sql); $dsql->Execute(); while ($row = $dsql->GetArray()) { $groupids[] = $row['id']; $groupnames[] = $row['attrname']; //获取组名 } if (!isset($groupids[0])) { return ''; } //如里不存在则退出 $GLOBALS['itemindex'] = 0; for ($i = 0; isset($groupids[$i]); $i++) { $GLOBALS['itemindex']++; $pv = new View(0); $pv->Fields['groupname'] = $groupnames[$i]; $pv->Fields['groupid'] = $groupids[$i]; $pv->Fields['attrid'] = $groupids[$i]; $pv->Fields['typeid'] = $typeid; $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); } return $artlist; }