Exemple #1
0
//Assigns left menu
$arrNews = $hldGlobal->fnFetchNews(REC_PER_PAGE);
if (is_array($arrNews) && count($arrNews) > 0) {
    foreach ($arrNews as $key => $value) {
        $hdlTpl->setVariable("date", $value["dcreated"]);
        //Assigns date
        $hdlTpl->setVariable("title", substr($value["newstitle"], 0, 20) . "...");
        //Assigns title
        $hdlTpl->setVariable("news_desc", substr(strip_tags($value["content"]), 0, 100) . "...");
        //Assigns description
        $hdlTpl->setVariable("id", $value["id"]);
        //Assigns id
        //$strurl = ereg_replace(" ","_",$value["newstitle"]);
        $strurl = preg_replace('/[^a-z0-9]/i', '_', $value["newstitle"]);
        $hdlTpl->setVariable("site_name", SITE_NAME);
        $hdlTpl->setVariable("news_url", $strurl);
        //Assigns url
        $hdlTpl->parse("NEWS_LEFT");
    }
}
$arrRecordSet = $hldGlobal->fnFetchNewsDetails($_GET["id"]);
if (is_array($arrRecordSet) && count($arrRecordSet) > 0) {
    $hdlTpl->setVariable("date", $arrRecordSet[0]["datecreated"]);
    $hdlTpl->setVariable("title", $arrRecordSet[0]["newstitle"]);
    $hdlTpl->setVariable("news_desc", $arrRecordSet[0]["content"]);
    $hdlTpl->parse("NEWS");
}
$hdlTpl->setVariable("site_name", SITE_NAME);
$hdlTpl->parse("INNER_PAGE");
$hdlTpl->parse("INDEX_PAGE");
echo $hdlTpl->get();