$v) $NEWSFORMATTED[$k] = htmlspecialchars($v); $NEWSFORMATTED['url'] = "{$CONFIG['domainPathToAppRoot']}news.php?id={$NEWS['id']}\""; $NEWSFORMATTED['date'] = date('M Y', $NEWS['articleDateU']); $NEWSFORMATTED['dateMonth'] = date('M', $NEWS['articleDateU']); $NEWSFORMATTED['dateYear'] = date('Y', $NEWS['articleDateU']); #### Get footer #### $TEMPLATE['newsFooter'] = $SETTINGS['newsFooterWebsite']; #### Cancel footer #### if($NEWS['id']==229) $TEMPLATE['newsFooter'] = ''; #### Build main image #### if($NEWS['imageType']){ $TEMPLATE['image'] = '
' . $NEWSFORMATTED['title'] . '
'; }else{ $TEMPLATE['image'] = ''; } #### Increment hit counter #### $query = "UPDATE {$CONFIG['dbTblPrefix']}news SET requests=requests+1 WHERE id='{$NEWS['id']}'"; $result = SDIGsendQuery($query); SDIGcheckQuery($result,$query); #### Get next/previous article #### if($src=="property") $queryPropertyId = " AND propertyId='{$NEWS['propertyId']}'"; else $queryPropertyId = " AND archived='n'"; $query = "SELECT id FROM {$CONFIG['dbTblPrefix']}news WHERE enabled='y'{$queryPropertyId} ORDER BY articleDate DESC"; $result = SDIGsendQuery($query); SDIGcheckQuery($result,$query); $foundIt = FALSE; $prevId = FALSE; $nextId = FALSE; while($row=mysql_fetch_array($result)){ $thisId = $row['id']; if($foundIt){ $prevId = $thisId; break; } if($thisId==$_REQUEST['id']) $foundIt = TRUE; else $nextId = $thisId; } #### Set back link #### if($src=="property"){ $backLink = ""; }else{ $backLink = ""; } #### Build subNav #### if($src=="property") $subNavSrc = '&src=property'; else $subNavSrc = ''; $T = ''; if($nextId) $T .= "
  • Next article
  • \n"; if($prevId) $T .= "
  • Previous article
  • \n"; $T .= "
  • {$backLink}Back to news list
  • \n"; $TEMPLATE['subNav'] = $T; #### Set content for template #### $TEMPLATE['h1'] = $NEWSFORMATTED['title']; $TEMPLATE['h2'] = $NEWSFORMATTED['title']; $TEMPLATE['date'] = $NEWSFORMATTED['date']; $TEMPLATE['content'] = $NEWS['content']; #### Set contextual meta data #### $META['titleContext'] = $NEWS['title']; $META['descriptionContext'] = $NEWS['title']; #### Set template #### $template = "template_newsDetail.php"; }else{ header("Location: {$CONFIG['domainPathToAppRoot']}news.php"); exit; } #### Build sidebar features #### if($src=="property") $queryPropertyId = " AND propertyId='{$NEWS['propertyId']}'"; else $queryPropertyId = " AND archived='n'"; $query = "SELECT * ,UNIX_TIMESTAMP(articleDate) AS articleDateU FROM {$CONFIG['dbTblPrefix']}news WHERE enabled='y' {$queryPropertyId} ORDER BY articleDate DESC LIMIT 10 "; $result = SDIGsendQuery($query); SDIGcheckQuery($result, $query); $T = ''; while($NEWS = mysql_fetch_assoc($result)){ foreach($NEWS AS $k => $v) $NEWSFORMATTED[$k] = htmlspecialchars($v); if($src=="property") $subNavSrc = '&src=property'; else $subNavSrc = ''; $NEWSFORMATTED['url'] = "{$CONFIG['domainPathToAppRoot']}news.php?id={$NEWS['id']}{$subNavSrc}\""; $NEWSFORMATTED['date'] = date('M Y', $NEWS['articleDateU']); $T .= '
  • ' . $NEWSFORMATTED['title'] . '

    ' . $NEWSFORMATTED['date'] . '

    ' . $NEWSFORMATTED['name'] . '
  • '; } if(!empty($T)) $TEMPLATE['sidebarNews'] = '

    Recent News

    '; else $TEMPLATE['sidebarNews'] = ''; } else{ #### Count items #### $query = "SELECT count(*) AS count FROM {$CONFIG['dbTblPrefix']}news WHERE enabled='y' AND archived='n' AND articleDate > DATE_SUB(CURDATE(),INTERVAL 6 MONTH) "; $result = SDIGsendQuery($query); SDIGcheckQuery($result, $query); $numItems = mysql_result($result, 0, "count"); if($numItems > 0){ $numPerPage = 10; if(!$o) $o=1; $limit_o = $o-1; // zero-based for SQL, to start at first result $dataArray = array(); $dataArray['current'] = $o; $dataArray['step'] = $numPerPage; $dataArray['total'] = $numItems; $dataArray['urlBase'] = $_SERVER['SCRIPT_NAME']; $dataArray['urlNavPrefix'] = "?o="; $dataArray['urlEnd'] = ''; $dataArray['showOffsetOnFirstLink'] = FALSE; $TEMPLATE['pagination'] = SDIGbuildSearchNavigationFront($dataArray); #### Build links #### $query = "SELECT * ,UNIX_TIMESTAMP(articleDate) AS articleDateU FROM {$CONFIG['dbTblPrefix']}news WHERE enabled='y' AND archived='n' AND articleDate > DATE_SUB(CURDATE(),INTERVAL 6 MONTH) ORDER BY articleDate DESC LIMIT {$limit_o}, {$numPerPage} "; $result = SDIGsendQuery($query); SDIGcheckQuery($result, $query); $num_rows = mysql_num_rows($result); $T = ""; while($NEWS = mysql_fetch_assoc($result)){ foreach($NEWS AS $k => $v) $NEWSFORMATTED[$k] = htmlspecialchars($v); $NEWSFORMATTED['url'] = "{$CONFIG['domainPathToAppRoot']}news.php?id={$NEWS['id']}\""; $NEWSFORMATTED['date'] = date('M Y', $NEWS['articleDateU']); $NEWSFORMATTED['dateMonth'] = date('M', $NEWS['articleDateU']); $NEWSFORMATTED['dateYear'] = date('Y', $NEWS['articleDateU']); $teaserMaxLength = 450; $teaserFull = trim(strip_tags(html_entity_decode($NEWS['content']))); $teaserLength = strlen($teaserFull); if($teaserLength > $teaserMaxLength) $teaserLength = $teaserMaxLength; if($teaserLength > 0) $teaser = '

    ' . htmlentities(SDIGtrimToWord($teaserFull, $teaserLength)) . ' More »

    '; else $teaser = ''; $T .= '
    ' . $NEWSFORMATTED['title'] . '

    ' . $NEWSFORMATTED['title'] . '

    ' . $teaser . '
    '; } $TEMPLATE['content'] = $T; }else{ $TEMPLATE['content'] = "

    No articles found.

    \n"; } $TEMPLATE['h1'] = 'Latest News'; $template = "template_news.php"; #### Set contextual meta data #### $META['titleContext'] = "Latest news"; $META['descriptionContext'] = "Index of latest news and press releases"; } require($CONFIG['incPathIncludes']."configMeta.inc.php"); #### Start HTML output #### require("header.php"); require($CONFIG['incPathTemplates'].$template); require("footer.php"); ?>