The World of ODP implemented in PHP
Latest Releases |
Project tools |
phpODPWorld is a program package that enables you to display everything or any category (or categories)
from dmoz.org / ODP using the RDF. The package contains:
- Helper scripts that parses and inserts the RDF into a(ny) database.
- A PHP script that does the actual job of displaying the categories.
The package is
Free Software licensed under
the GNU GPL.
(Copyright (c) 2005 by ODP-editor
asleo - see credits.)
The PHP-script has the following features:
- Front-end to the ODP data in the database - supporting display
- Complete i18n-support / fully translatable.
- Caching through the use of smarty.
- Can use any database through the use of Pear DB.
- Uses CSS for styling the display of categories. Also
uses a simple form for templates. (Not using the full power of Smarty
templates to reduce the dependencies on external packages.)
- Compresses the pages if PHP supports it.
- The package is
Free Software licensed under
the GNU GPL.
You can see phpODPWorld in action on odp.no - displaying
all of World: Norsk,
Kids and Teens: International: Norsk and
Regional: Europe: Norway
in Norwegian or in English.
The PHP script is fully translatable using gettext and PO-files.
The following translations exist:
- Norwegian Bokmål -
If you want to make a translation for a new language download the template, translate it and send it to the
developer. It will be available on this page and included in
the following releases of phpODPWorld.
Read more about
and translation tools
from the book Guide to localisation.
On the phpODPWorld
- A database - MySQL, Postgresql, or any other supported by Pear DB.
- A PHP-enabled web server with PHP 4.3 or better. (It may work with older
versions of PHP.) PHP must have:
- gettext support to have working translations. Without gettext
only English language is supported.
- Pear DB (and preferably PHP Smarty) installed.
- Perl with the DMOZ-ParseRDF (and DBI) module installed.
Below you'll find installation instructions, a (short)
FAQ and a todo list. Any questions should be
sent to the mailing list.
- Download the phpODPWorld package and unpack it.
Move all files/directories to the wanted directory on the web server.
- Create the following directories:
These directories must be writable by the web server.
- "logs", if you enabled logging in the config file.
- "smarty/cache" and "smarty/compiled", if you enabled
smarty in the config file.
- Set up your database:
- Create a database and a user (with or without a password).
- Create the database tables defined in "tools/db.sql".
(For Postgresql: "psql dbname < tools/db.sql" - similar for MySQL.)
- Edit "config.inc.php" and "tools/config.pl" to reflect
the database settings, your wanted categories and other preferences.
- Download the needed RDFs - either the complete
- Extract your categories from the RDFs using the Perl script
"tools/extract.pl". (At this point you need the Perl module
- Insert your categories (from the RDFs) into the database using the Perl scripts
"tools/content2db.pl" and "tools/structure2db.pl". See
"tools/update-rdf.sh" for a worked out example for multiple categories.
- Initial run to update the count (of sites) for each category. Do:
- Turn on maintenance mode in "config.inc.php".
- Open "http://yourserver/?reset=key" (where the key is set in
"config.inc.php"). When the count is updated for all categories it
will return the numbers for the root category. This may take a long time -
do not reload the page.
- Turn off maintenance mode in "config.inc.php".
- That's it - your site should be ready!
Some other common tasks:
- When you want to install a new RDF, repeat step 5-8.
- To empty the cache (after changing the templates for example)
This software is completely new, so any questions haven't been asked yet...
However, I'm guessing that someone might ask:
Can the sort order (of links and cats) be modified?
Yes, you can change the order of, add and remove letters in
"config.inc.php". (Remember that the file is UTF-8 encoded.) If you
also need to change the sorting for numbers you must edit the functions
*_compare_strings in "index.php". Currently the script
doesn't ignore numbers and will therefore sort differently from dmoz.org.
- Improve the speed of finding/updating the count for all categories
(when a new RDF is inserted) - this is currently slow. (Improved dramatically with
- Improvde the search function/speed. Currently there is no caching of searches
and there is no search index - we search directly using SQL.
The speed for inserting and finding count is OK for categories with say
200.000 sites. However, working with all of ODP (3.000.000 sites) is a pain.
On a machine with AMD Athlon 1.7 GHz CPU and 256 MB of RAM, inserting RDFs into
database took roughly 40 minutes (which is OK), but finding count took
330 minutes. (These numbers doesn't hurt that much if you use two databases.)
The default style, XHTML and CSS, is created by ODP-editor
asleo. The PHP-code and support
tools in Perl are written by ODP-editor
hansfn. He also put all of this
together as the phpODPWorld package. The original Perl scripts that are used to
insert the RDF into a database, are written by ODP-editor
srainwater and is packaged
together as odp2db - see
(The code used in phpODPWorld is based on version 1.1 of odp2db and is slightly
modified.) And of course without the DMOZ-ParseRDF Perl module this would have
been much more work...
Last updated 02.06.2009 22:44 by