PDA

View Full Version : Display collapsable sections


Alex
06-03-2006, 11:35 AM
This is a hack to allow displaying collapsable sections. It applies to phpWordPress v3.2

1. class/Category.class.php

At line 417. add the new function baseParentCat()

function baseParentCat($id){
$id = (int) $id;
$SQL = "SELECT parent_cat FROM tblCategories WHERE id=$id";
$result = mysql_query($SQL) or sql_error($SQL, 'getImage');
$row = mysql_fetch_assoc($result);
if (!empty($row['parent_cat'])){
$parent_cat = $this->baseParentCat($row['parent_cat']);
} else {
$parent_cat = $id;
}
return $parent_cat;
}
2. HTML_Function.php

In HTML_Category_Menu() function (line 115), add this code snippent at the very top, just below global variables definition (global $url, $tpl_folder, $lang, $classified_path, $connection, $category, $title;)

$ccid = 0;
if (isset($_GET['category'])) {
$ccid = (int) $_GET['category'];
} else if (isset($_GET['category_name'])) {
$cat_array = explode('/',secure_sql($_GET['category_name']));
$ccid = FindCategoryId($cat_array[0], 0);
} else if (isset($_GET['news'])) {
if (!is_numeric($_GET['news'])){
$SEfriendly = secure_sql($_GET['news']);
$aid = FindId($SEfriendly);
} else {
$aid = intval($_GET['news']);
}
$article = new Article();
$article->LoadFromDatebase($connection,$aid);
$ccid = $article->Category_id;
}
$category = new Category();
$ccid = $category->baseParentCat($ccid);

At line 130 (note: prior to pasting this code, after copy/paste line numbers will change!) just after the line:
$sub_category_menu="";

add this line of code:

if($cid==$ccid) $category->View_Subcat = 2;

Frankc
06-03-2006, 12:12 PM
Excellent. Thank you very much

I will implement it right away.

Ernest
08-15-2006, 06:09 PM
Thanks, and what about DHTML menu for categories? Can we get in in feature?

Elton
08-17-2006, 10:09 AM
I've added this code, uploaded it and nothing seems to have changed.

How do you make the sections collapsible?

Elton
08-17-2006, 10:11 AM
Ah, think I may have done it.