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 12336 May 12, 2002, 9:59 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12213 May 13, 2002, 12:32 AM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 12254 May 13, 2002, 12:36 AM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12164 May 13, 2002, 6:36 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12214 May 13, 2002, 9:28 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12136 May 13, 2002, 9:41 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12173 May 13, 2002, 9:44 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12199 May 13, 2002, 9:49 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12261 May 13, 2002, 9:58 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12112 May 13, 2002, 10:03 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12132 May 13, 2002, 10:11 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12111 May 13, 2002, 10:22 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12209 May 13, 2002, 10:24 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12127 May 13, 2002, 10:35 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12229 May 13, 2002, 10:41 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12118 May 13, 2002, 10:42 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12162 May 13, 2002, 10:44 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12116 May 13, 2002, 10:53 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12209 May 13, 2002, 11:01 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12214 May 13, 2002, 11:06 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12131 May 13, 2002, 11:08 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12222 May 13, 2002, 11:13 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12132 May 13, 2002, 11:18 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 12143 May 13, 2002, 11:18 PM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 12175 May 13, 2002, 11:21 PM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 2524 May 13, 2002, 11:23 PM
Thread; hot thread Re: [yogi] Directory Depth Global
Ian 2571 May 14, 2002, 8:59 AM
Thread; hot thread Re: [sooke] Directory Depth Global
yogi 2666 May 14, 2002, 9:08 AM
Post; hot thread Re: [yogi] Directory Depth Global
Ian 2547 May 14, 2002, 1:05 PM