Gossamer Forum
Quote Reply
Directory Depth Global
This is in reference to http://www.gossamer-threads.com/...orum.cgi?post=195612, but since this about a global I am posting here.

I just wrote my first global!!!Smile

This one prints out the number of categories with a directory depth of X.

Code:


sub {
#print number of categories by directory depth - depth stats

my $max_depth;
my $num_cats;
my $count;

my ($max_depth) = $DB->table('Category')->select(['MAX(Depth)'])->fetchrow_array;

for ($count=0; $count<=$max_depth; $count++)
{
my ($num_cats) = $DB->table('Category')->select(['COUNT(Depth)'],{ 'Depth' => $count})->fetchrow_array;
print "Directory Depth: $count Number of Categories: $num_cats<br>";
}
}




The next step (which is way beyond me still) is to turn this and the perl module from the thread mentioned at the top of this page into a plugin which:
  • Assigns a category its directory depth when it is added or moved.
  • Creates a stats display under the Globals menu in admin which shows what my Global does
  • Has a function which does recalculates all directory depths, exactly as the above mentioned perl module does - for repair purposes, or after an import.


Most of this is already done, just how do I make this into a plug in?

Any help would be great, maybe I can move onto understand plugins a little more now!Smile
Subject Author Views Date
Thread; hot thread Directory Depth Global Ian 12401 May 12, 2002, 9:59 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12278 May 13, 2002, 12:32 AM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 12318 May 13, 2002, 12:36 AM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12227 May 13, 2002, 6:36 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12278 May 13, 2002, 9:28 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12199 May 13, 2002, 9:41 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12238 May 13, 2002, 9:44 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12262 May 13, 2002, 9:49 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12326 May 13, 2002, 9:58 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12175 May 13, 2002, 10:03 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12196 May 13, 2002, 10:11 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12174 May 13, 2002, 10:22 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12274 May 13, 2002, 10:24 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12190 May 13, 2002, 10:35 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12295 May 13, 2002, 10:41 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12182 May 13, 2002, 10:42 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12228 May 13, 2002, 10:44 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12179 May 13, 2002, 10:53 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12273 May 13, 2002, 11:01 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12278 May 13, 2002, 11:06 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12196 May 13, 2002, 11:08 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12286 May 13, 2002, 11:13 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12197 May 13, 2002, 11:18 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12207 May 13, 2002, 11:18 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12239 May 13, 2002, 11:21 PM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 2555 May 13, 2002, 11:23 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 2602 May 14, 2002, 8:59 AM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 2699 May 14, 2002, 9:08 AM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 2579 May 14, 2002, 1:05 PM