Umm... you were supposed to put the parts in the places I described, not just paste the whole thing at the end of the file - that does nothing.
The
if (!$this_is_home_page) {
goes in here:
PHP Code:
 * @version $Idcategories.php 2718 2005-12-28 06:42:39Z drbyte $
 */

  if (!
$this_is_home_page) {

    
$main_category_tree = new category_tree
and the
}
goes where you put at the end.
The comment
//the module processing code
is a placeholder for all of the code in the middle of the file, not literal.