require_once('common/page_ini.php');
require(dirname(__FILE__) . '/libraries/functions/mysubstr.function.php');
$pear = new PEAR();
$tpl->loadTemplatefile('index.tpl', true, true);
//============================PAGE HEADER==============================
$page_title = 'Reduceri | Promotii | Discounturi | Vouchere | Coduri Promotionale | Discount Voucher';
$meta_keywords = 'reduceri, oferte, discounturi, oferte promotionale, coduri de reducere, super oferte, discount voucher';
$meta_description = 'Comunitate de reduceri, discounturi, oferte, vouchere si coduri promotionale din piata de retail. Reduceri la o gama larga de branduri. Abonament gratuit la newsletter - de ce sa platesti pretul intreg?';
$options = array('page_title' => $page_title,
'meta_keywords' => $meta_keywords,
'meta_description' => $meta_description,
'css_array' => serialize(array(
//$cfg_array['site_url'].'design/css/style.css',
$cfg_array['site_url'] . 'design/css/vc.css'
)),
);
$header = new SV_Header($tpl, '__global__', 'header999', $options); // header is not included in a separate template block so i'm using
// '__global__' block and a fake div id (header999)
$header->parsemainClass();
//====================GET CATEGORIES BOX================================
$categories = new SV_getCategories($tpl, 'CATEGORIES', '', array('db' => $db_read, 'cfg_array' => $cfg_array));
$categories->parsemainClass();
//====================GET POPULAR RETAILERS BOX================================
$popularRetailers = new SV_getPopularRetailers($tpl, 'POPULAR-RETAILERS', '', array('db' => $db_read, 'cfg_array' => $cfg_array));
$popularRetailers->parsemainClass();
//====================GET LATEST DISCOUNTS BOX================================
$vouchers = new SV_Discounts($tpl, 'LATEST-DISCOUNTS', '', array('db' => $db_read, 'cfg_array' => $cfg_array));
$latestDiscountsArray = $vouchers->getLatestDiscounts('10');
foreach ($latestDiscountsArray as $discount) {
$tpl->setCurrentBlock('LATEST-DISCOUNTS');
if ($pear->isError($i)) {
die("1st " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
$tpl->setVariable("LATEST-DISCOUNT-TITLE", stripslashes(mysubstr($discount["vc_title"], 45)));
$tpl->setVariable("LATEST-DISCOUNT-BRAND", stripslashes(ucfirst($discount["brand_name"])));
$tpl->setVariable("LATEST-DISCOUNT-URL", $cfg_array['site_url'] . $discount["url_identifier"] . '/' . strtolower($discount["brand_url_identifier"]) . '.html');
$tpl->setVariable("LATEST-DISCOUNT-LOGO", $cfg_array['site_url'] . 'assets/brands/logo/60x15/' . $discount["brand_logo"]);
$tpl->parseCurrentBlock();
if ($pear->isError($i)) {
die("2nd " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
}
//====================GET JUST ADDED DISCOUNTS BOX================================
$justAddedVouchersArray = $vouchers->getJustAddedDiscounts('10');
foreach ($justAddedVouchersArray as $discount) {
$tpl->setCurrentBlock('JUST-ADDED');
if ($pear->isError($i)) {
die("1st " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
$tpl->setVariable("JUST-ADDED-TITLE", stripslashes(mysubstr($discount["vc_title"], 45)));
$tpl->setVariable("JUST-ADDED-BRAND", stripslashes(ucfirst($discount["brand_name"])));
$tpl->setVariable("JUST-ADDED-URL", $cfg_array['site_url'] . $discount["url_identifier"] . '/' . strtolower($discount["brand_url_identifier"]) . '.html');
$tpl->setVariable("JUST-ADDED-LOGO", $cfg_array['site_url'] . 'assets/brands/logo/60x15/' . $discount["brand_logo"]);
$tpl->parseCurrentBlock();
if ($pear->isError($i)) {
die("2nd " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
}
//====================GET EXCLUSIVE DISCOUNTS BOX================================
$exclusiveVouchersArray = $vouchers->getExclusiveDiscounts('10');
foreach ($exclusiveVouchersArray as $discount) {
$tpl->setCurrentBlock('EXCLUSIVE-DISCOUNTS');
if ($pear->isError($i)) {
die("1st " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
$tpl->setVariable("EXCLUSIVE-TITLE", stripslashes(mysubstr($discount["vc_title"], 45)));
$tpl->setVariable("EXCLUSIVE-BRAND", stripslashes(ucfirst($discount["brand_name"])));
$tpl->setVariable("EXCLUSIVE-URL", $cfg_array['site_url'] . $discount["url_identifier"] . '/' . strtolower($discount["brand_url_identifier"]) . '.html');
$tpl->setVariable("EXCLUSIVE-LOGO", $cfg_array['site_url'] . 'assets/brands/logo/60x15/' . $discount["brand_logo"]);
$tpl->parseCurrentBlock();
if ($pear->isError($i)) {
die("2nd " . $i->getMessage() . '
' . $i->getCode() . '
' . $i->getUserInfo() . '
' . $i->getDebugInfo());
}
}
//====================GET LATEST NEWS BOX================================
$news = new SV_getNews($tpl, 'LATEST-NEWS', '', array('db' => $db_read, 'cfg_array' => $cfg_array, 'limit' => '10'));
$news->parsemainClass();
//====================GET PAGE TEXT BOX================================
$tpl->setCurrentBlock('__global__');
$pageText = new SV_staticPages($tpl, '', '', array('db' => $db_read, 'cfg_array' => $cfg_array, 'page_id' => $cfg_array['prima_pagina_id']));
$pageText->parsemainClass();
//====================FOOTER SECTION==================================================
$tpl->setVariable('site_url', $cfg_array['site_url']);
$tpl->setVariable('site_design_url', SITE_DESIGN_DIR);
$footer = new SV_Footer($tpl, '__global__', 'footer9999',
array('assets_site_url' => $cfg_array['assets_site_url'],
'cfg_array' => $cfg_array,
'js_file' => $js_file,
'js_array' => array(SITE_URL . $cfg_array['js_assets_url'] . $js_file)));
$footer->parsemainClass();
require_once('common/page_out.php');
?>