From 6673dddab62c94cf2108a928e4b756b950726836 Mon Sep 17 00:00:00 2001 From: Frank Doepper Date: Fri, 6 May 2011 11:26:29 +0200 Subject: [PATCH] generate $prefix and substitute it in template --- index.pl | 17 +++++++---------- template.html | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/index.pl b/index.pl index e740da5..e500e10 100755 --- a/index.pl +++ b/index.pl @@ -4,7 +4,7 @@ # http://woffs.de/WCM # # -# 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 () { - 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; } diff --git a/template.html b/template.html index 542c556..1deb6e8 100644 --- a/template.html +++ b/template.html @@ -4,7 +4,7 @@ - + WCM __title__ -- 2.45.2