Hi,
I'm trying to edit a script that I got, but don't have much php knowledge. The part of the part of the script that i'm trying to change is a top rated feature of a web portal. It takes all the top rated links and displayes them by their category, all on one page. I want it to just display all the top rated links in just one category. I believe it should be a simple fix. I've included snips of code that i think are relevant.
in top_rated.php:
function ShowTopRatedSection() {
// vars global configuration
global $conn, $dbServer, $dbHostname, $dbUsername, $dbPassword, $dbName,
$theme_path, $category_separator, $cache_time, $use_cache_status, $theme_name;
// vars url & form
// vars messages
global $msg;
// vars template
global $category, $link;
// show links
$links_obj = new clsLink;
$links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName);
$links_obj->table_name = "idx_link";
$links_obj->max_rows = 10;
$links_obj->template_file = $theme_path."top_rated_link_rows.html";
$links_obj->date_format = $msg["10051"];
$links_obj->paging = false;
$links_obj->rating_image_path = "themes/".$theme_name."/images/rating/";
$links_obj->rev_rating_image_path = "themes/".$theme_name."/images/review/";
$links_obj->category_table_name = "idx_category";
$links_obj->category_separator = $category_separator;
$links_obj->top_rated_link_category_path_template = $msg["10052"];
$links_obj->cache_time = $cache_time;
$links_obj->enable_cache = $use_cache_status;
$link = $links_obj->DisplayTopRatedListing();
DisplayTemplate($theme_path."top_rated.html",
"\$link");
}
in lib/link.class.php:
function DisplayTopRatedListing() {
$category_obj = new clsCategory;
$category_obj->InitDB($this->db_server,$this->db_hostname,$this->db_username,$this->db_password,$this->db_name);
$category_obj->table_name = $this->category_table_name;
$category_obj->link_table_name = $this->table_name;
$category_obj->separator = $this->category_separator;
// get all main category
$query = "select category_id from $this->category_table_name where parent_id=0";
$result = $this->db_connect->Execute($query);
if($result) $total_main_cat = $result->RecordCount();
// put them in queue
$i=0;
while($i<$total_main_cat) {
$result->Move($i);
$main_categories[] = $result->Fields("category_id");
$result->MoveNext();
$i++;
}