I'm using the enhanced Template code
# template tags.
$temp =~ s#$begin\s*include\s*(.+?)\s*$end#
if (exists $self->{'inc'}{$1}) { $self->{'inc'}{$1}; }
else {
if (open (INC, "${$self}{'ROOT'}/$1")) {
$self->{'inc'}{$1} = join ("", <INC> );
close INC;
$self->{'inc'}{$1};
}
else {
"Can't find file: ${$self}{'ROOT'}/$1";
}
}
#goe;
This code lets me use Includes filename, where filename is located in the path defined as root (my template path). I want to modify this code so that is looks in two places. It firsts looks in the templates folder. If the template is not found, it then looks in a different folder in my html directory. If that is not found, then there is an error.
So I want to modify the above code so that I can define a variable as a second path and have the code check for the included file in each path.
The reason I want to do this is I use standard includes in my pages. They are all referenced on non-Links pages by a URL pointing to an inc folder in my html directory. I don't want to have to duplicate these includes and stick them in my templates directory (and dont want to move my regular templates outside of the templates directory)
Help anyone?
Code:
# Parse includes, do this first so that the includes can include # template tags.
$temp =~ s#$begin\s*include\s*(.+?)\s*$end#
if (exists $self->{'inc'}{$1}) { $self->{'inc'}{$1}; }
else {
if (open (INC, "${$self}{'ROOT'}/$1")) {
$self->{'inc'}{$1} = join ("", <INC> );
close INC;
$self->{'inc'}{$1};
}
else {
"Can't find file: ${$self}{'ROOT'}/$1";
}
}
#goe;
This code lets me use Includes filename, where filename is located in the path defined as root (my template path). I want to modify this code so that is looks in two places. It firsts looks in the templates folder. If the template is not found, it then looks in a different folder in my html directory. If that is not found, then there is an error.
So I want to modify the above code so that I can define a variable as a second path and have the code check for the included file in each path.
The reason I want to do this is I use standard includes in my pages. They are all referenced on non-Links pages by a URL pointing to an inc folder in my html directory. I don't want to have to duplicate these includes and stick them in my templates directory (and dont want to move my regular templates outside of the templates directory)
Help anyone?