PDA

View Full Version : Important! Document update to Multi-Categories


mark
02-24-2005, 07:35 PM
Seems I forgot one additional change to your index.php file.....this little bug was spotted by "tseneadza"...thanks man!

To build your browse archive screen properly (per category), you'll have to make some changes....This part is semi-tricky, because i really dont know what you may have or have not done to your "browse" section...This seems like an area that everyone has customized...

For consistency, i'll show what you'll need to change if you were using the original "browse" section of pixelpost 1.3 with no mods...

Change:

if($_GET['x'] == "browse") {
$thumb_output = "";
$where = "";
if($_GET['category'] != "") { $where = "and (category='".$_GET['category']."')"; }
$query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') $where order by datetime desc");
while(list($id,$title,$name) = mysql_fetch_row($query)) {
$title = pullout($title);
$thumbnail = "thumbnails/thumb_$name";
$thumb_output .= "<a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
}
$tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
}

// build browse menu

To:

if($_GET['x'] == "browse") {
$thumb_output = "";
$where = "";
if($_GET['category'] != "") {
$query = mysql_query("select t2.id,headline,image,datetime from ".$pixelpost_db_prefix."catassoc as t1 inner join ".$pixelpost_db_prefix."pixelpost t2 on t2.id = t1.image_id where t1.cat_id = '".$_GET['category']."' order by datetime desc");

} ELSE IF ($_GET['archivedate'] != "") {
$where = "and (DATE_FORMAT(datetime, '%Y-%m')='".$_GET['archivedate']."')"; //DATE_FORMAT(foo, '%Y-%m-%d')
$query = mysql_query("select id,headline,image, datetime from ".$pixelpost_db_prefix."pixelpost where (datetime<='$adjusted_datetime') $where order by datetime desc");
} ELSE {

$query = mysql_query("select id,headline,image from ".$pixelpost_db_prefix."pixelpost where (datetime<='$cdate') order by datetime desc");
}
while(list($id,$title,$name) = mysql_fetch_row($query)) {
$title = pullout($title);
$thumbnail = "thumbnails/thumb_$name";
$thumb_output .= "<a href='$PHP_SELF?showimage=$id'><img src='$thumbnail' alt='$title' title='$title' class='thumbnails' /></a>";
}
$tpl = ereg_replace("<THUMBNAILS>",$thumb_output,$tpl);
}

// build browse menu

Thats it....I also update the download zip file to include these directions...

Sorry everyone... :!:

shana
02-25-2005, 11:25 AM
I installed this mod and made sure to edit the code as per the instructions but I'm not seeing a category list. Any suggestions?
When I ran the install assoc.php, it ran and looked ok. Told me to delete the file so I did. Then I stuck the mult cat file in addons and it shows up, but no dice.
I wanted to add: I assume the file I am supposed to be editing is the one in www, because it's the only index.php that has "browse". Pls. correct me if I've done something wrong--I just found pixelpost tonight and am just getting familiar with it.

mark
02-25-2005, 01:33 PM
Sounds like you have done everything right except for modifying the index.php that is in your "admin" directory...

The "browse" stuff was just something i forgot initially...

The main piece is the index.php in admin....the doc that i supplied outlines all the changes.....

btw, what did you mean by "nested categories". Im not sure i understand the difference...

shana
02-25-2005, 10:24 PM
Yeah, I would be that guy, wouldn't I? Apologies!

RE: the nested categories--I'll answer inside that thread to keep this one on topic.
Thanks! (sorry again...)