CONFIG <--- */ require_once("{$_SERVER['DOCUMENT_ROOT']}/conf/global.conf"); $CFG->debug = false; $DOC->title = "Home"; $DOC->columns = 3; $DOC->left_sidebar = "default_left_sidebar.inc"; $DOC->right_sidebar = "right_sidebar_1.inc"; // build a breadcrumb trail; add as many as nodes as needed $DOC->breadcrumbs[] = 'Home'; $featured_qid = get_featured_plans(); $popular_qid = get_popular_plans(); $top_rated_qid = get_top_rated_plans(); /* -------------------------------------------------------> MAIN <--- */ require("$CFG->includedir/default_header.inc"); require("$CFG->includedir/home.inc"); require("$CFG->includedir/default_footer.inc"); /* --------------------------------------------------> FUNCTIONS <--- * Name Description * ------------------------------------------------------------------ * get_featured_plans() Randomly retrieve featured plan listings. * ------------------------------------------------------------------ */ function get_featured_plans($limit = 1) { global $CFG; $qid = db_query(" SELECT plan_id, title, living_feet, stories FROM plans WHERE status = 'Active' AND featured = '1' ORDER BY RAND() LIMIT " . intval($limit), $CFG->debug); if($qid && db_num_rows($qid)) { return $qid; } else { return false; } } /* ------------------------------------------------------------------ * get_popular_plans() Retrieve popular plan listings. * ------------------------------------------------------------------ */ function get_popular_plans($limit = 3) { global $CFG; $qid = db_query(" SELECT plan_id, title FROM plans WHERE status = 'Active' AND popularity > '0' ORDER BY popularity, title LIMIT " . intval($limit), $CFG->debug); if($qid && db_num_rows($qid)) { return $qid; } else { return false; } } /* ------------------------------------------------------------------ * get_top_rated_plans() Retrieve top rated plan listings. * ------------------------------------------------------------------ */ function get_top_rated_plans($limit = 3) { global $CFG; $qid = db_query(" SELECT plan_id, title FROM plans WHERE status = 'Active' AND vanity_rank = 'Superstar' ORDER BY RAND() LIMIT " . intval($limit), $CFG->debug); if($qid && db_num_rows($qid)) { return $qid; } else { return false; } } ?>