~woffs/wcm

6673dddab62c94cf2108a928e4b756b950726836 — Frank Doepper 13 years ago 3ef2d5c 20110505
generate $prefix and substitute it in template
2 files changed, 8 insertions(+), 11 deletions(-)

M index.pl
M template.html
M index.pl => index.pl +7 -10
@@ 4,7 4,7 @@
# http://woffs.de/WCM
# <wcm@woffs.de>
#
# Version 20110503
# Version 20110505
# 
# © WofFS 2010
# License: CC-BY-SA 3.0


@@ 151,6 151,7 @@ if (my $ru=$ENV{REQUEST_URI}) {
} else {
  $abs.=$ENV{'SCRIPT_NAME'} || '/index.pl';
}
(my $prefix=$abs)=~s,[^/]*$,,;
$abs.='?page=' if $abs =~ /index\.pl$/;
$abs.='page=' if $abs =~ /index\.pl\?$/;



@@ 178,15 179,11 @@ if ($redir) {

  open T,"< $template" or die $!;
  while (<T>) {
    if (/__navi__/) {
      print "$navi\n";
    } elsif (/__title__/) {
      print "$pagetitle\n";
    } elsif (/__content__/) {
      print "$content\n";
    } else {
      print;
    }
    s/__navi__/$navi/g;
    s/__title__/$pagetitle/g;
    s/__content__/$content/g;
    s/__prefix__/$prefix/g;
    print;
  }
  close T;
}

M template.html => template.html +1 -1
@@ 4,7 4,7 @@
<head>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  <meta http-equiv='Content-Style-Type' content='text/css' />
  <link rel='stylesheet' type='text/css' href='template.css' />
  <link rel='stylesheet' type='text/css' href='__prefix__template.css' />
  <title>
  WCM
  __title__