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

Products: Gossamer Links: Development, Plugins and Globals: Re: [sooke] Editor tag replacement: Edit Log

Here is the list of edits for this post
Re: [sooke] Editor tag replacement
I can see this would work if:

my @editors = $editor_db->select (['Username'], { CategoryID => $category_id })->fetchall_list;

actually said "if CategoryID => $category_id OR CategoryID is a subcategory of $category_id";

eeek... here we go again.

I have this:




Code:


sub issubcategory {

my $cat_db = $DB->table('Category');
my $currentcat = shift; #category to test
my $parentcat = shift; #parent category for test
my $tempcat1 = $currentcat; #temporary placeholder for category ID
my $tempcat2 = $parentcat;
my $count = 0;
my $outcome = 0; # 0-false 1-true
if ($currentcat == $parentcat) {
$outcome=0; #if they are the same then return false
}
else {
for ($count = 0; $count<1000 || $outcome=1 || $tempcat2 < 1; $count++) { #prevent endless looping with 1000
$tempcat2 = $cat_db->select(['FatherID'], { ID => $tempcat1 })->fetchrow_array;
if ($tempcat2 == $parentcat) { $outcome = 1; } #YES it is a subcategory
$tempcat1 = $tempcat2; #move up a level
}
}

return $outcome;

}



But can I have nested subs in a global? How can I integrate this into my SQL statement above, even if it worked?


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

Last edited by:

sooke: May 20, 2002, 1:58 PM

Edit Log: