Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

[Download] Directory Depth Plugin

(Page 1 of 2)
> >
Quote Reply
[Download] Directory Depth Plugin
Ok, I am not sure if this a good idea, so please read warning below.... but I just want to share this with anyone who wants it.

WARNING


***************************************************

Many bits of this were written by experts (Paul, Ivan (Yogi), webmaster and more), but edited and put together by a total amateur!! So, be very careful using on your system!!

The way it is now, it will install the column "Depth" into your category table, but will not remove this when you uninstall it. If you want it to do this, simply put the uninstall code in install.pm or delete the column from SQL.

Since I use this just for myself, I did not put this in. (I suppose I could have put the option in).

***************************************************

What it does:

Adds Directory Depth functionality to your Category table.

It has two functions:
  • Repair (repairs the depths for every category - you will need to run this after install)
  • Stats (this shows you a table of Directory Depths with the corresponding number of categories.


Uses:

I use it to:
  • see how burried my categories are becoming
  • calculate advertising costs
  • determine category complexity, and corresponding editor responsibility
  • complex category clean up functions (deletion)


Note:

I have added a modify_category hook, to prevent editors from messing about with the 'Depth' field, in case you are wondering why you cannot change it by editing a category. Just unselect this in "edit" if you want to be able to do this.

If you find or fix any errors in it, please tell me about it.

Smile

Last edited by:

sooke: May 15, 2002, 5:27 PM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Congratulations.

I was trying to save it and have a look at it, but somehow the file does not look like a tar archive. Any ideas?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] [Download] Directory Depth Plugin In reply to
oops!

Not sure I have any progs to Tar a file!Blush

I tried an evaluation version of winrar. I don't have shell access on my server, so command line zipping won't do. Here are the two files anyways...
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Why not let Links SQL Plugins stuff do the job for ya Wink Thats how I tar up my ones.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Hi Andy.... so here comes the obvious question, how? Is this done from the plugin manager?


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Plugin Wizard. Then once you have the tar made, you should be able to find it in admin/Plugins/Uninstalled/. At least thats how I do it :p

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Great. Thanks for that Andy.

It was installed in this case so I pulled this file from the admin/plugins/installed.

It extracts(seems to) here. See attachement further down for file!


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

sooke: May 16, 2002, 10:51 AM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
LOL..you seem to be doing better with Plugins than me Tongue All I've managed to do is add a few admin options, install some exteral PHP stuff, and add a global. You're already using lots of the SQL features that I havn't even explored yet. Oh well, all in good time Smile

BTW: You may want to contact Alex...he could put it on the public download area (from where you download plugins in the Links SQL admin area)

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy.: May 16, 2002, 10:18 AM
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Ha ha, thanks for the vote of confidence Andy. I am pretty sure you could whip this together yourself. I had an awful lot of help! I shouldnt use the word awful... I had great help.

Did it intall and work on your Links?


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
The actual stats part of it went ok, but repair gave me an error;

A fatal error has occured:

Failed to execute query: 'UPDATE Category SET WHERE ID = ?' Reason: You have an error in your SQL syntax near 'WHERE ID = '1'' at line 1 at c:/PROGRA~1/NUSPHERE/APACHE/NSCGI-~1/LINKS_~1/admin/Plugins/DirectoryDepth.pm line 163.

Please enable debugging in setup for more details.

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Mmm..just had a look at your code. I see just above "sub update_cat {" you have a 'return' call. Should the 'repair' sub not get closed off before the update_Cat sub is defined? Or have you closed it later on?

Another little typo is line 165. You have;

Code:
print $category->{Name} . ' has level ' . $level . "<br />";

I'm assuming you wanted;

Code:
print $category->{Name} . ' has level ' . $level . "<br>";

Or is that some kind of weird format for XML?

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy.: May 16, 2002, 10:30 AM
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Yes. I am thinking for some reason that is an older version. Weird. Let me have a look.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
No, <br /> is for XHTML, this new standard. Still looking through all these brackets... because my version seems to be the same, and is working Crazy


Ok, I found the errors, and there were two with the brackets.... I'll update the tar file.

There was an extra bracket at the end of update_cat() sub, and a missing (as you correctly pointed out) at the end of repair()

Thanks Andy. Hopefully it works this time.


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

sooke: May 16, 2002, 11:21 AM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Internal server error for both of the functions now :(

I've managed to collect the error. It was;

Quote:
Unable to load plugin: DirectoryDepth (Unmatched right curly bracket at c:/PROGRA~1/NUSPHERE/APACHE/NSCGI-~1/LINKS_~1/admin/Plugins/DirectoryDepth.pm line 172, at end of line
syntax error at c:/PROGRA~1/NUSPHERE/APACHE/NSCGI-~1/LINKS_~1/admin/Plugins/DirectoryDepth.pm line 172, near "}"
Compilation failed in require at c:\PROGRA~1\NUSPHERE\APACHE\NSCGI-~1\LINKS_~1\ADMIN\ADMIN.CGI line 198.
) at c:\PROGRA~1\NUSPHERE\APACHE\NSCGI-~1\LINKS_~1\ADMIN\ADMIN.CGI line 200.

Also, why do you not remove the Depth column from the database? Its annoying having to keep manually delete it every time Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!

Last edited by:

Andy.: May 16, 2002, 10:59 AM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
I found the error. You added 1 to many curly brackets ;) The one just above 'sub stats' shouldn't be there (notice there are 2, both touchinmg the left margin).

I'm still getting the MySQL error though when running the re-build option, but the other one doesnt give a 500 IS error now Smile

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
This:

@categories[$level] = \@category_level;

should be:

$categories[$level] = \@category_level;
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Yes, got that one, thanks. Still checking through.

The funny thing is, when I perl check , it does not come up with any brack errors for me.

Did you try the tar file again? Or just amend the old one?


Edit: Thanks Paul... correct those now. I am getting no errors from the perl check now.


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

sooke: May 16, 2002, 11:14 AM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Uh hu,...found the problem ;)

This line;

$table->update ( { Depth => $level}, { ID => $category->{ID} }) or die $GT::SQL::error;

Needs to be;

$table->update ( { depth => $level}, { ID => $category->{ID} }) or die $GT::SQL::error;

Note the lower case 'd' in Depth Wink

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
Good one andy. Though, I think this stems from the install.pm creating the column incorrectly in the first place as "depth". The rest of the references to this column are with a capital D. So it may be easier just to change the one reference in the install.pm.

I will do thhis and update the tar file.

ThanksSmile

I'll also beat out a 1.0.2 which removes the table upon uninstall.


Edit: Ok, 1.0.2 attached, which now removes 'Depth' column on uninstall as well. Please check. It works fine on my system, but may not on yours of course!


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

sooke: May 16, 2002, 11:46 AM
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Ok, this is version 1.0.3.

The only change is it shows the average depth as well in the stats.


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Congratulations again. It works fine as far as I can see.

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] [Download] Directory Depth Plugin In reply to
Thanks for the support (and help)! Glad to hear it worksCool


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Did you email Alex the plugin? It gonna be much easier for people to find via the Admin panel, than having to find this thread again Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy.] [Download] Directory Depth Plugin In reply to
just alex@gossamer-threads.com??

OkSmile


http://www.iuni.com/...tware/web/index.html
Links Plugins
Quote Reply
Re: [sooke] [Download] Directory Depth Plugin In reply to
Well you could email his family too I guess if you wanted :)
> >