全是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%\">»";
if($articleRow["Type"] != 2)
{
$output .= sprintf("
<A target='%s' href='%s'>
%s
</A>
", $target, AL_HELPER::ArticleLink($articleRow["ArticleID"], $articleRow["Title"]), $articleRow["Title"]);
}
else
{
$output .= sprintf("
<span>%s</span>
", $articleRow["Title"]);
}
$output .= sprintf("
</span>
<div class=\"Details\">%s <a href='%s'>%s</a>
| %s %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> %s</a>
", $target, AL_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> %s</a>
", 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> %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;
}