Hi,
We are now using LinksSQL 2.1.0 and the sub template_set inside Links/Category.pm has changed since we did the edit described above. Here is the new code for this sub routine...
sub template_set {
# -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
unless ($cat_info) {
my $parents = $self->parents ($id);
foreach my $parent (@$parents) {
($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
if ($cat_info) {
last;
}
}
}
$self->{_template_cache}->{$id} = $cat_info || '';
return $self->{_template_cache}->{$id};
}
I tried commenting out the following lines, but it did not work...
sub template_set {
# -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
# unless ($cat_info) {
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# ($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
# if ($cat_info) {
# last;
# }
# }
# }
# $self->{_template_cache}->{$id} = $cat_info || '';
# return $self->{_template_cache}->{$id};
}
So, which lines in this new-look sub routine do I need to comment/delete in order to stop Links from using the category template of its parent directory?
If you don't understand then please start at the top of this read and all should become clear!
Regards
JeffB.
We are now using LinksSQL 2.1.0 and the sub template_set inside Links/Category.pm has changed since we did the edit described above. Here is the new code for this sub routine...
sub template_set {
# -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
unless ($cat_info) {
my $parents = $self->parents ($id);
foreach my $parent (@$parents) {
($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
if ($cat_info) {
last;
}
}
}
$self->{_template_cache}->{$id} = $cat_info || '';
return $self->{_template_cache}->{$id};
}
I tried commenting out the following lines, but it did not work...
sub template_set {
# -------------------------------------------------------------------
# Return the value of template set to use for a given category.
#
my $self = shift;
my $id = shift or return $self->error ('BADARGS', 'FATAL', "Must pass category id to template_set");
return '' unless (exists $self->{schema}->{cols}->{Category_Template});
return $self->{_template_cache}->{$id} if (exists $self->{_template_cache}->{$id});
# If this category has a template set, use it.
my ($cat_info) = $self->select ( ['Category_Template'], { ID => $id })->fetchrow_array;
# Otherwise look at it's parents.
# unless ($cat_info) {
# my $parents = $self->parents ($id);
# foreach my $parent (@$parents) {
# ($cat_info) = $self->select ( ['Category_Template'], { ID => $parent })->fetchrow_array;
# if ($cat_info) {
# last;
# }
# }
# }
# $self->{_template_cache}->{$id} = $cat_info || '';
# return $self->{_template_cache}->{$id};
}
So, which lines in this new-look sub routine do I need to comment/delete in order to stop Links from using the category template of its parent directory?
If you don't understand then please start at the top of this read and all should become clear!
Regards
JeffB.