Пример #1
0
function getList($list, $keyword)
{
    global $cfg_cmsurl;
    $key = urlencode($keyword);
    $str = "<h3>您可能感兴趣的内容<span><a href=\"{$cfg_cmsurl}/cloudsearch_{$key}_0_1.html\" target=\"_blank\">+更多&raquo;</a></span></h3>";
    $out = '';
    for ($i = 0; isset($list[$i]); $i++) {
        $row = $list[$i];
        $channelname = getChannelName($row['tablename']);
        $title = setColor($keyword, cn_substr($row['title'], 36));
        $litpic = getLitpic($row['imgurl'], $row['webid'], $row);
        $url = getUrl($row['aid'], $row['webid'], $row['tablename'], $row['tag']);
        if (!empty($row['title'])) {
            $out .= "<li><span class=\"fl\">[{$channelname}]</span><a href=\"{$url}\" target=\"_blank\" title=\"{$row['title']}\">{$title}</a></li>";
        }
    }
    if (!empty($out)) {
        $out = $str . "<ul>" . $out . "</ul>";
    }
    return $out;
}
Пример #2
0
/**
 * 云搜索调用标签(废弃)
 *
 * @version        $Id: cloudsearch.lib.php netman
 * @package        Stourweb.Taglib
 * @copyright      Copyright (c) 2007 - 2011, Stourweb, Inc.
 * @link           http://www.stourweb.com
 */
function lib_cloudsearch(&$ctag, &$refObj)
{
    global $dsql;
    $attlist = "row|20,";
    FillAttsDefault($ctag->CAttribute->Items, $attlist);
    extract($ctag->CAttribute->Items, EXTR_SKIP);
    $innertext = trim($ctag->GetInnertext());
    $ResultList = isset($refObj->Fields['ResultList']) ? $refObj->Fields['ResultList'] : '';
    $keyword = $refObj->Fields['keyword'];
    //print_r($ResultList);
    $ctp = new STTagParse();
    $ctp->SetNameSpace("field", "[", "]");
    $ctp->LoadSource($innertext);
    $GLOBALS['autoindex'] = 0;
    for ($i = 0; isset($ResultList[$i]); $i++) {
        $GLOBALS['autoindex']++;
        $row = $ResultList[$i];
        $row['description'] = setColor($keyword, cutstr_html($row['content'], 90));
        $row['channelname'] = getChannelName($row['tablename']);
        $row['title'] = setColor($keyword, $row['title']);
        $row['litpic'] = getLitpic($row['imgurl'], $row['webid'], $row);
        $row['website'] = GetWebURLByWebid($row['webid']);
        $row['weburl'] = $row['website'];
        $row['url'] = getUrl($row['aid'], $row['webid'], $row['tablename'], $row['tag']);
        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;
}