1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

选错程序了,模板真难改

本帖由 laogui2006-09-30 发布。版面名称:图形设计

  1. laogui

    laogui Administrator
    管理成员

    注册:
    2005-08-30
    帖子:
    15,216
    赞:
    35
    全是PHP代码

    PHP:
    function GetRecentArticleList(&$NumArticles)
            {
                
    // Get a list of featured articles to show
                
    $output "";
                
    $query sprintf("select *, unix_timestamp(StartDate) as SD from %sarticles inner join %susers on %sarticles.AuthorID = %susers.UserID where Featured=0 and Visible=1 and %sarticles.Status=1 and unix_timestamp(StartDate) <= %s and IsFinished=1 and (unix_timestamp(ExpiryDate) >= %s or EnableExpiry=0) order by StartDate DESC, ArticleID DESC limit %d"$GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], $GLOBALS["AL_CFG"]["tablePrefix"], time(), time(),$NumArticles);

                
    $articleResult mysql_query($query);
                
    $NumArticles mysql_num_rows($articleResult);

                if(
    mysql_num_rows($articleResult) > 0)
                {
                    while(
    $articleRow mysql_fetch_array($articleResult))
                    {
                        
    // If it's a summary+link open it in a new window
                        
    $target = ($articleRow["Type"] == 3) ? "_blank" "_top";

                        if(
    $articleRow["FirstName"] != "" && $articleRow["LastName"] != "")
                            
    $author sprintf("%s %s"$articleRow["FirstName"], $articleRow["LastName"]);
                        else
                            
    $author $GLOBALS["AL_LANG"]["hpNA"];

                        
    $output .= "<span class=\"Title\" style=\"width:100%\">&raquo;";
                        
                        if(
    $articleRow["Type"] != 2)
                        {
                            
    $output .= sprintf("

                                <A target='%s' href='%s'>
                                    %s
                                </A>

                            "
    $targetAL_HELPER::ArticleLink($articleRow["ArticleID"], $articleRow["Title"]), $articleRow["Title"]);
                        }
                        else
                        {
                            
    $output .= sprintf("

                                <span>%s</span>

                            "
    $articleRow["Title"]);
                        }
                            
                        
    $output .= sprintf("

                            </span>
                            <div class=\"Details\">%s&nbsp;<a href='%s'>%s</a> 
                                | %s&nbsp;%s 
                                | %s | <span class='RatingDisplay'>%s</span>
                            </div>
                            <div class=\"Content\">
                            <table cellspacing=0 cellpadding=0><tr><td valign=top>
                                %s
                                </td><td valign=top class=content>
                                %s
                            </td></tr></table>
                            </div>
                            <div class=\"SmallLinks\">
                        
                        "
    $GLOBALS["AL_LANG"]["hpBy"], AL_HELPER::AuthorLink($articleRow["AuthorID"], $author), $author$GLOBALS["AL_LANG"]["hpPublished"], AL_HELPER::GetRelativeDate($articleRow["SD"]), AL_HELPER::GetCategoryListCVS($articleRow["ArticleID"]), AL_HELPER::GetRatingBar($articleRow["ArticleID"],true,$articleRow), AL_HELPER::GetAuthorPic($articleRow["AuthorID"]), $articleRow["Summary"]);

                        if(
    $articleRow["Type"] == 1)
                        {
                            
    $output .= sprintf("

                                <a target='%s' href='%s'><img src='%s/icon_FullStory.gif' border=0 align=absmiddle>&nbsp;%s</a>&nbsp;&nbsp;
                            
                            "
    $targetAL_HELPER::ArticleLink($articleRow["ArticleID"], $articleRow["Title"]), AL_TPL_IMAGE_PATH$GLOBALS["AL_LANG"]["hpFullStory"]);
                        }
                        else if(
    $articleRow["Type"] == 3)
                        {
                            
    $output .= sprintf("

                                <a href='%s' target='_blank'><img src='%s/icon_VisitSite.gif' border=0 align=absmiddle>&nbsp;%s</a>&nbsp;&nbsp;
                            
                            "
    AL_HELPER::ArticleLink($articleRow["ArticleID"], $articleRow["Title"]), AL_TPL_IMAGE_PATH$GLOBALS["AL_LANG"]["hpVisitSite"]);
                        }

                        if(
    $GLOBALS["AL_CFG"]["EnablePrintArticle"] == 1)
                        {
                            
    $output .= sprintf("

                                <a target=_blank href='%s/%s/%d'>
                                <img src='%s/icon_Print.gif' border=0 align=absmiddle>&nbsp;%s</a>

                            "
    AL_HELPER::ArticleLink($articleRow["ArticleID"], $articleRow["Title"]),$GLOBALS["AL_LANG"]["urlPrint"], $articleRow["ArticleID"], AL_TPL_IMAGE_PATH$GLOBALS["AL_LANG"]["hpPrinterVersion"]);

                        }

                        
    $output .= "</div><br />";
                    }
                }    
    return 
    $output;
            }
     
  2. zmnet

    zmnet Well-Known Member

    注册:
    2006-05-03
    帖子:
    7,809
    赞:
    62
    不喜欢 模板中带php代码的程序