[thelist] PHP help needed

Ken Snyder kendsnyder at gmail.com
Sat Jul 28 12:59:46 CDT 2007


Brent Eades wrote:
> ...
> Its purpose is to add the number of listings for a given class of
> property ('home', farm', etc) to the main navigation. But as you'll see
> if you look at the above code, I've had to write a separate function for
> each property class.
> ...
>   
Looks pretty solid.  A few points to consider:

1. What Brady said is true--you'll want to create a general function 
that takes a $class_id parameter.  If you need to preserve the names of 
the functions, you can do something like

function showcount_display_farm() {
  return showcount_display_class(3);
}

2. The code $config[table_prefix_no_lang] should probably be 
$config['table_prefix_no_lang'].  The former looks for a constant named 
table_prefix_no_lang, and, if not found, accesses the key of that name 
in the $config array.

- Ken Snyder



More information about the thelist mailing list