PDA

View Full Version : DMOZ / ODP addon


dabean
02-06-2002, 10:00 PM
This hack allows you to add dmoz.org / Open Directory Project live data to your site.

Requirements:
- PHP4.0.0+
- vBulletin 2.2.x (the hack has not been tested on vBulletin 2.0.x)

Recommended
- PHP 4.0.5+

For a demo go and look @dmoz.org you get a customised version of that :)

The included readme.html outlines installation instructions.
The hack features high level customisation, no database changes are required.

Updated 08/02/2002 08:23PM GMT
- Version 1.2
- Added PHP 4.0.0+ support
- Better documentation
- "Entrypoint" support. Entrypoint allows you to open the ODP at any particullar category by default.
- Experimental Category blocking. (read php-odp.include.php to discover how to enable this feature)

Updated 08/02/2002 4:47AM GMT.
- fixed Typo

Updated 08/02/2002 4:13AM GMT.
- Improved documentation
- Corrected url bug
- Improved caching

Updated 07/02/2002 9:56PM GMT.
- Added caching support
- By default the main page is cached however it is possible to cache categories and to cache descriptions.
- Cache time can be set

Dade
02-07-2002, 05:09 AM
Awesome hack, thanks! :)

Ninth Dimension
02-07-2002, 06:50 AM
This is cool, i'll be installing it later today.

Lesane
02-07-2002, 07:19 AM
Great, gonna install this one later. Thanks

Ninth Dimension
02-07-2002, 11:44 AM
OK, i've just installed this hack http://bbs.ofdan.net/php-odp.php it was nice and easy to install, and run, the only problem I find with it is that it takes a while for the front page to load up, which is a shame because I should image that it's going to be the most used page...

If you can find a way of speeding this up (even if you just use static html for the front page) I would apprechate it.

dabean
02-07-2002, 08:02 PM
Hack has been updated to include caching.

To upgrade just replace the new versions of php-odp.php and php-odp.include.php

To configure the caching support please study the new vars contained inside php-odp.include.php, by default only the main page will be cached for 1 day this maybe altered however.

DarkReaper
02-07-2002, 10:01 PM
Warning: stat failed for ./default (errno=2 - No such file or directory) in /home/serioussam/cgi-bin/odp/php-odp.php on line 144

Warning: fopen("./default", "w") - Permission denied in /home/serioussam/cgi-bin/odp/php-odp.php on line 318

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 319

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 320

http://dynamic3.gamespy.com/~serioussam/odp/php-odp.php

dabean
02-07-2002, 10:09 PM
Originally posted by DarkReaper
Warning: stat failed for ./default (errno=2 - No such file or directory) in /home/serioussam/cgi-bin/odp/php-odp.php on line 144

Warning: fopen("./default", "w") - Permission denied in /home/serioussam/cgi-bin/odp/php-odp.php on line 318

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 319

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 320

http://dynamic3.gamespy.com/~serioussam/odp/php-odp.php

Change
$odp['cache']['base_dir'] = "./";
to contain the path to the directory you want to use to hold the cached files
eg
$odp['cache']['base_dir'] = "/home/<blah>/cache";

fonzerelli_79
02-07-2002, 10:37 PM
im getting this error

Warning: ChDir: No such file or directory (errno 2) in /home/sites/site193/web/forums/odp/php-odp.include.php on line 11

what could this be

fonzerelli_79
02-07-2002, 10:38 PM
oh and great hack
i requested this hack last week on phpportals
good timing

dabean
02-07-2002, 10:51 PM
Originally posted by fonzerelli_79
im getting this error

Warning: ChDir: No such file or directory (errno 2) in /home/sites/site193/web/forums/odp/php-odp.include.php on line 11

what could this be

open php-odp.include.php

change
chdir("../forums/"); to contain the path to your forums directory
then change chdir("../odp/"); to the path you installed the hack to.

DarkReaper
02-08-2002, 12:07 AM
Still doesn't work...

Warning: stat failed for /home/serioussam/cgi-bin/odp/cache/default (errno=2 - No such file or directory) in /home/serioussam/cgi-bin/odp/php-odp.php on line 144

Warning: fopen("/home/serioussam/cgi-bin/odp/cache/default", "w") - Permission denied in /home/serioussam/cgi-bin/odp/php-odp.php on line 318

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 319

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 320

dabean
02-08-2002, 12:19 AM
Originally posted by DarkReaper
Still doesn't work...

Warning: stat failed for /home/serioussam/cgi-bin/odp/cache/default (errno=2 - No such file or directory) in /home/serioussam/cgi-bin/odp/php-odp.php on line 144

Warning: fopen("/home/serioussam/cgi-bin/odp/cache/default", "w") - Permission denied in /home/serioussam/cgi-bin/odp/php-odp.php on line 318

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 319

Warning: Supplied argument is not a valid File-Handle resource in /home/serioussam/cgi-bin/odp/php-odp.php on line 320

"cache" has been chmod(755)'d?

fonzerelli_79
02-08-2002, 01:18 AM
thanx dabean

the page appears but i am now getting the same error as DarkReaper

i get

Warning: fopen("./default","w") - Permission denied in /home/sites/site193/web/forums/odp/php-odp.php on line 318

Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site193/web/forums/odp/php-odp.php on line 319

Warning: Supplied argument is not a valid File-Handle resource in /home/sites/site193/web/forums/odp/php-odp.php on line 320

the page does appear though

dabean
02-08-2002, 01:29 AM
fonzerelli the answer to the finnal problem is in post 8.

fonzerelli_79
02-08-2002, 01:30 AM
also dabean(seeing as your online - ha ha) , i think im being a bit david dimple but the links dont work ie. they try and link to my server instead of opening up the page from dmoz

have i missed a step

fonzerelli_79
02-08-2002, 01:36 AM
i got it now, i chmoded the cache to 777 instead of 755

thats what it must have been

dabean
02-08-2002, 01:44 AM
Originally posted by fonzerelli_79
also dabean(seeing as your online - ha ha) , i think im being a bit david dimple but the links dont work ie. they try and link to my server instead of opening up the page from dmoz

have i missed a step

Not sure what you mean by this, but the hack is designed to rebrand the whole odp in the style of your site so links should point back in the form of php-odp.php?/some odp page/.

This is inaccordance with the ODP data license for "live data" sites.

fonzerelli_79
02-08-2002, 01:49 AM
i mean
when you click on for example shopping it goes to www.manutdchat.com/shopping instead of where ever

check out http://www.manutdchat.com/forums/odp/php-odp.php to see what i mean

p.s. cheers for the support

DarkReaper
02-08-2002, 02:11 AM
CHMOD 777 fixed the problem. I've got one other one though: In my header I use the "go" button. This appears as a nice red X...

dabean
02-08-2002, 02:23 AM
Originally posted by fonzerelli_79
i mean
when you click on for example shopping it goes to www.manutdchat.com/shopping instead of where ever

check out http://www.manutdchat.com/forums/odp/php-odp.php to see what i mean

p.s. cheers for the support

ack, download the new fixed version.

DarkReaper you may want to move the .php files into your forums directory or make a new custom template to act a header for the hack with the links pointing to the correct places...

A custom header can be loaded by changing
$odp['header'] = $header;
to
$odp['header'] = gettemplate("my_template");

fonzerelli_79
02-08-2002, 02:34 AM
now it isnt working at all

got these errors

Parse error: parse error in /home/sites/site193/web/forums/odp/php-odp.include.php on line 65

Warning: fopen("","r") - No such file or directory in /home/sites/site193/web/forums/odp/php-odp.php on line 161

Fatal error: Call to undefined function: gettemplate() in /home/sites/site193/web/forums/odp/php-odp.php on line 72

dabean
02-08-2002, 02:45 AM
In php-odp.include.php find
if ($HTTP_SERVER_VARS['PHP_SELF']!="")

change it to
if ($HTTP_SERVER_VARS['PHP_SELF']!="") {

The zip file contains this change.

fonzerelli_79
02-08-2002, 02:49 AM
the page has no errors now and is displaying ok but it still doesnt link correctly

i think this is just something ive done because no one else seems to have this problem

check it out at http://www.manutdchat.com/forums/odp/php-odp.php to see what i mean

thanx

dabean
02-08-2002, 02:57 AM
Originally posted by fonzerelli_79
the page has no errors now and is displaying ok but it still doesnt link correctly

i think this is just something ive done because no one else seems to have this problem

check it out at http://www.manutdchat.com/forums/odp/php-odp.php to see what i mean

thanx

Can I have a look at your phpinfo.php output.. the script is included with vBulletin or you can make one by uploading a .php file containing just

<?php

phpinfo();

?>


oh and clean out the contents of your cache directory particularly the file called "default".

fonzerelli_79
02-08-2002, 03:08 AM
ive pmed you the info
thanx

dabean
02-08-2002, 03:18 AM
Originally posted by fonzerelli_79
ive pmed you the info
thanx

thank you but your version of php is only 4.0.3pl1 which is not compatible php4.0.5+ is required for the hack currently.

I will try and add support for your version of php in the next release of the hack (v1.2) due whenever I finish it.

Zkast
02-08-2002, 03:26 AM
I keep getting this no matter where I put the files. I've tried to go over the include file over and over but I'm obviously missing something :(

Parse error: parse error in /home/zkast/public_html/forums/odp/php-odp.include.php on line 65

Warning: fopen("","r") - Success in /home/zkast/public_html/forums/odp/php-odp.php on line 161

Fatal error: Call to undefined function: gettemplate() in /home/zkast/public_html/forums/odp/php-odp.php on line 72

dabean
02-08-2002, 03:30 AM
Originally posted by Zkast
I keep getting this no matter where I put the files. I've tried to go over the include file over and over but I'm obviously missing something :(

Parse error: parse error in /home/zkast/public_html/forums/odp/php-odp.include.php on line 65

Warning: fopen("","r") - Success in /home/zkast/public_html/forums/odp/php-odp.php on line 161

Fatal error: Call to undefined function: gettemplate() in /home/zkast/public_html/forums/odp/php-odp.php on line 72

Your using the latest zip? "php_odp_vb1-1c.zip" as "php_odp_vb1-1b.zip" contains a typo :( which would give you that result see post 23 for the fix.

fonzerelli_79
02-08-2002, 03:31 AM
why didnt i notice this
im an idiot - ha ha

its weird cos apart from the link thing, i got the hack working ok

Zkast
02-08-2002, 03:36 AM
Yep, that was the latest download. I just grabbed it maybe 10 minutes ago.

File changed, chmod cache - 777 and all is well :)

Great hack btw!

dabean
02-08-2002, 06:33 PM
Updated the hack a few new features mainly just improved documentation.

Version 1.2
- Added PHP 4.0.0+ support
- Better documentation
- "Entrypoint" support. Entrypoint allows you to open the ODP at any particullar category by default.
- Experimental Category blocking. (read php-odp.include.php to discover how to enable this feature)

To upgrade copy the new files over and make the nessesary configuration changes.
Also you will need to delete the cached copy of "default" held on your server.

fonzerelli_79
02-08-2002, 09:55 PM
dabean, i still have that link problem, even with the new files

dabean
02-08-2002, 11:25 PM
Originally posted by fonzerelli_79
dabean, i still have that link problem, even with the new files

Attached is a fixed file for the problem (this file is only for php4.0.4 or earlier)

fonzerelli_79
02-09-2002, 01:55 AM
it still doesnt work
i wonder what im doing wrong
theres no where that i couldve went wrong really

dabean
02-09-2002, 02:04 AM
Originally posted by fonzerelli_79
it still doesnt work
i wonder what im doing wrong
theres no where that i couldve went wrong really

Okay now all you need to do is remove the "default" file from the cache directory.

fonzerelli_79
02-09-2002, 02:08 AM
its working
thanks for all your help dabean and great hack

JJR512
02-09-2002, 03:03 AM
Originally posted by fonzerelli_79
i got it now, i chmoded the cache to 777 instead of 755

thats what it must have been
I, too, was getting the no-permission errors until I changed the chmod to 777 rather than 755. Yes, I had the full absolute path correctly specified in the include file (and the other paths, too), but as 755, it just would not work.

Are the instructions wrong to say 755, or is it supposed to work that way, and if so, why isn't it for some of us?

fonzerelli_79
02-09-2002, 03:19 AM
dabean (yes its me again)

im trying to change the entry path to the shopping section but for some reason it isnt working

have you got an idea of how this works

MarkB
02-09-2002, 10:59 AM
Is it possible to specify a particular directory of ODP to be displayed (ie, a category that matches my site) instead of just the general directory structure?

dabean
02-09-2002, 12:48 PM
fonzerelli, controling entrypoints is easy
just set
$odp['entrypoint'] = "";
to
$odp['entrypoint'] = "Computers/Internet/";
if you want to open the computers/internet section.

When specifying entrypoints leading slashes should be removed.

MarkB, yes :) read the entrypoint description I've provided above, a slightly shorter version is included in the readme too.

JJR512 755 should work depending on how your apache configuration is set, but 777 should also work.

After the feedback it seems 777 is more successful for the bulk of people so I'll alter the instructions acordingly, 755 was selected based on the assumption that the cache directory would be "owned" by the same user as apache/php. I had forgotten that this is not typical on shared/semi dedicated/multisite servers.

In fact 666 would be even better as it doesn't give execution permission.

fonzerelli_79
02-09-2002, 01:17 PM
i changed it to shopping/ and still nothing

before i had /shopping/ and that didnt work either

centris
02-11-2002, 08:51 PM
Well it works fine, thanks a lot. Two questions though, in the template;

<!-- breadcrumb -->
<table border="0" width="100%" cellpadding="0" cellspacing="0"><tr>
<td width="100%"><img src="dmoz.gif" align="middle"> <normalfont><b><a href="php_dmoz.php? s=$session[sessionhash]">$odp[bbtitle]</a> &gt; Open Directory Project</b></normalfont></td></tr></table>
<!-- /breadcrumb -->

I set it up for my Board name like this;
$odp['title'] = "$bbtitle - Open Directory";

That link looks for the file above in red, which does not seem to exist? I changed this in the template to read the correct path to odp/php-odp.php and it links back to the OD main page - I am a bit confused on this issue.

2. Any way that I can stop non-registered members using the Open Directory on my site?

dabean
02-13-2002, 12:50 AM
centris yes the default template contains errors that was accidental, as for point 2 not currently.

fonzerelli not sure why it doesn't work for you on the three different php installation's i've tested $odp['entrypoint'] = "shopping/"; will open shopping as the defualt unless a session hash is appended to the url.

fonzerelli_79
02-13-2002, 12:56 PM
dont know why dabean
its ok
thanks for all your help anyways

mood
03-02-2002, 06:31 AM
Great Addon! Works like a charm only thing which si strange is that its not showing my buttons.

I'm sort of a newbie on VB- seems its not recognizing my "theme"

Would somebody point me where to look into to solve this?

Thanks!

Mood

JWB
06-09-2002, 06:49 PM
Is this usuable without vbulletin? OR is there something similar(dmoz interpreter??) Im working on a site that doesnt use vbulletin...

dabean
06-09-2002, 07:36 PM
Originally posted by JWB
Is this usuable without vbulletin? OR is there something similar(dmoz interpreter??) Im working on a site that doesnt use vbulletin...

No but I suppose you can always modify it. Hotscripts lists a number of dmoz scripts. http://www.hotscripts.com/PHP/Scripts_and_Programs/Open_Directory_Project/

veedee
07-18-2006, 04:46 PM
Would this work with the latest version of vB?

hollosch
06-27-2007, 08:49 PM
Is there a similar mod for vB 3.6.x ???