I am using php to write an online classifieds site w/ about a dozen categories. I wrote one copy of the listings page and the ad view page and the submit ad page, etc. Then I just pass the category to those scripts and include("$cat.inc"). Each categories include file includes functions for listing() and form(), etc.
This works great, except now I am writing a search script where I want to call the listing function from multiple categories in the same script. So, basically I need to include one category's include file, call the listing() function then include another category's include file and call its listing() function. Of course, when I include the second category's include file then I get a function redefine error.
I tried include()'ing the file in a function, hoping to limit its scope, but that didn't seem to work. Any ideas?
Thanks,
Jonathan