/[webpac]/trunk/WebPac.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/WebPac.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 301 by dpavlin, Sun Jan 18 16:23:03 2004 UTC revision 302 by dpavlin, Sun Apr 4 22:09:57 2004 UTC
# Line 43  my $from_utf8 = Text::Iconv->new('UTF8', Line 43  my $from_utf8 = Text::Iconv->new('UTF8',
43  sub url_ex {  sub url_ex {
44          my $q = shift || die "suff2file needs CGI object!";          my $q = shift || die "suff2file needs CGI object!";
45          my $tpl = shift || die "url_ex needs template name!";          my $tpl = shift || die "url_ex needs template name!";
46          return suff2file($BASE_PATH, $q->url(-path => 1),$TEMPLATE_PATH,$tpl);          return suff2file($BASE_PATH, $q->url(-absolute => 1,-path => 1),$TEMPLATE_PATH,$tpl);
47  }  }
48    
49  sub suff2file($$$$) {  sub suff2file($$$$) {
# Line 53  sub suff2file($$$$) { Line 53  sub suff2file($$$$) {
53    
54          # strip everything to and including base path, leaving only          # strip everything to and including base path, leaving only
55          # additional (virtual) path          # additional (virtual) path
56          if ($p =~ s,^.*?$base_path,,) {          if ($base_path eq "/") {
57                    $p =~ s,/*,,g;
58                    my ($name,$ext) = split(/\./,$tpl);
59                    $p = $name . "-" . $p . "." . $ext;
60            } elsif ($p =~ s,^.*?$base_path,,) {
61                  $p =~ s,/*,,g;                  $p =~ s,/*,,g;
62                  my ($name,$ext) = split(/\./,$tpl);                  my ($name,$ext) = split(/\./,$tpl);
63                  $p = $name . $p . "." . $ext;                  $p = $name . $p . "." . $ext;
# Line 97  sub in_template { Line 101  sub in_template {
101                  die "can't parse TEMPLATE path";                  die "can't parse TEMPLATE path";
102          }          }
103    
104          my $master_tpl = suff2file($BASE_PATH, $q->url(-path => 1),$dir,$tpl);          my $master_tpl = suff2file($BASE_PATH, $q->url(-absolute => 1, -path => 1),$dir,$tpl);
105          if (open(T, $master_tpl)) {          if (open(T, $master_tpl)) {
106                  my $template_html = join("\n",<T>);                  my $template_html = join("\n",<T>);
107                  close(T);                  close(T);

Legend:
Removed from v.301  
changed lines
  Added in v.302

  ViewVC Help
Powered by ViewVC 1.1.26