register_block('nocache', 'smarty_block_nocache', false); //zone management if(!Util::getParam('zone')){ switch($_SERVER["SERVER_NAME"]){ //case "cthotelpackages.com": case "packages.waterfordhotelgroup.com": $zone = "1"; break; case "mystichotelpackages.com": $zone = "2"; break; case "hartfordhotelpackages.com": $zone = "3"; break; default: $zone = "1"; } } // params and sorting $passed_sort = Util::getParam('sort'); $passed_category = Util::getParam('category'); $passed_property = Util::getParam('property'); $category="$passed_category"; $property="$passed_property"; $page = Util::getParam('page'); // default page number if (empty($page)) { $page = "1"; } // default sort $sort="$passed_sort"; if (empty($sort)) { $sort = "cd"; } // total number of listings available based on params $numberoflistings = WebItem::getTotalListingCount($zone,$category,$property); $smarty->assign('totalnumlistings',$numberoflistings); // categories $categories = Category::getCategoryList(); $smarty->assign('Categories',$categories); if($category){ $currentcatinfo = Category::getCategoryInfo($category); foreach($currentcatinfo as $cat){ $catname = $cat->catname; $catslug = $cat->catslug; $smarty->assign('thecategoryid',$category); $smarty->assign('thecategoryname',$catname); $smarty->assign('thecategoryslug',$catslug); } } //properties $properties = Property::getPropertyList(); $smarty->assign('Properties',$properties); if($property){ $smarty->assign('proplisting',1); $propertyinfo = Property::getPropertyInfo($property); foreach($propertyinfo as $p){ $propname = $p->name; $propaddress - $p->address1; $propcity = $p->city; $propstate = $p->state; $propzipcode = $p->zipcode; $propphone = $p->phone; $propweburl = $p->weburl; $propslug = $p->slug; $smarty->assign('thepropname',$propname); $smarty->assign('thepropaddress',$propaddress); $smarty->assign('thepropcity',$propcity); $smarty->assign('thepropstate',$propstate); $smarty->assign('thepropzip',$propzipcod); $smarty->assign('thepropphone',$propphone); $smarty->assign('thepropweburl',$propweburl); $smarty->assign('thepropslug',$propslug); } } // list data $indexcacheid = zone.$zone.$sort.$category.$property.index.$page; if(!$smarty->is_cached('index.tpl',$indexcacheid)) { // No cache available, do variable assignments here. /* pagination */ require('util/pagination.php'); $smarty->assign('Pagination',$pagination); if($page){ $offset = ($page - 1) * $limit; //first item to display on this page }else{ $offset = 0; //if no page var is given, set start to 0 } /* get the data for the webid provided */ $listingdata = WebItem::getListings($zone,$sort,$category,$property,$limit,$offset); //zone,sort,category $smarty->assign('Listings',$listingdata); // get other zone data for 'you may also be interested in' feature if($zone == "2"){ $altlistingdata = WebItem::getAltListings(3,$sort,$category); //zone,sort,category $smarty->assign('AltListings',$altlistingdata); } if($zone == "3"){ $altlistingdata = WebItem::getAltListings(2,$sort,$category); //zone,sort,category $smarty->assign('AltListings',$altlistingdata); } } $smarty->assign('currentsort',$sort); $smarty->assign('zone',$zone); $smarty->display('index.tpl',$indexcacheid); ?>