I'm planning on coding a Business Directory - along the lines of
Yahoo's Yellow Pages at http://yp.yahoo.com (and ones at many other
sites.)
After some searching on the web using various combinations of "yellow
pages" + "business directory" + mysql + "data structure" I wasn't able
to come up with much.
The Yahoo YP have some interesting features (a few I detail below),
which makes their data tree do things such as jump back to an earlier
level, and I'm starting to think how such things can be implemented
in a data structure.
Before I start to code such an application - although not an overly
complex task, to avoid reinventing the wheel, and to save a few hours -
I'm wondering if anyone knows of any existing articles discussing the
implementation of such a system, taking into account the features I'm
just about to mention?
With the Yahoo YP, there are top-level categories such as "Automotive",
"Home and Garden", "Real Estate" etc. and then sub-categories, such as
"Automotive Repair". Further down, just before you are shown the
businesses, you have final categories, which I will call
container-categories, such as "Bars", "Video Rental Stores" etc. that
hold the actual businesses. Extending the Automotive category started
above, a full category path might be Automotive -> Repair ->
Transmissions.
So, a couple of features I noted (which I would like to implement):
(1) One feature with Yahoo YP, is that a business can sometimes be
found in more than one final container-category. For example, the
business "BJ's Chicago Style Brewpub" can be found in BOTH the
container-categories "Bars" and also in "Restaurants."
(2) Another feature - categories themselves can belong to multiple
higher level categories. For example, the category "Bars, Pubs, and
Clubs" can be found within both the higher level categories of
"Entertainment/Arts" AND "Food & Dining."
And another example, "Bakeries" is both located at:
Top -> Food and Dining -> Restaurants -> Bakeries
AND ALSO
Top -> Food and Dining -> Bakeries
(Interestingly, in the final example - the "page locator" text in both
instances displays as "Top > Food and Dining > Restaurants > Bakeries"
in both cases.)
FYI, I will be coding up in PHP 4.3.8 and MySQL 4.0.20.
Any advice, and/or pointers to articles would be most appreciated.
Thanks in advance for any replies.
Miner2049er.
John - 27 Apr 2005 13:06 GMT
> I'm planning on coding a Business Directory - along the lines of
> Yahoo's Yellow Pages at http://yp.yahoo.com (and ones at many other
[quoted text clipped - 55 lines]
>
> Miner2049er.
I would design your DB schema from scratch. Read Celko's stuff on
hierarchical data which should get you on the right track. The sort of
relationships you describe are bread and butter problems in modelling
hierarchical data. Post back once you have a design and people will be
happy to give you constructive criticism or help you through
difficulties you may be having.
John