package Apache::Content; use strict; use Apache::Constants qw(:common); use Apache::URI(); use Apache::File(); sub handler { my $r = shift; my ($page, $adtitle, $fh); #get the document root of the #requested URL my $document_root = $r->document_root; my $uri = $r->uri; #pars url to get form name and adtitle if ($uri =~ m/\/content\/([^-]+)-([^-]+)/){ $page = $1; $adtitle = $2; } $r->content_type('text/html'); $r->send_http_header; my $path = $r->filename; $path =~ s/(.*?)[^\/]+$/$1/; #open index frameset unless ($fh = Apache::File->new($path."index.html")){ $r->log_error("Can't open index.html: $!"); return SERVER_ERROR; } while (<$fh>){ #change main window from home.html to the page #requested #if url contained vgfrom then pass to #vgform module (Vgform.pm) if ($page =~ m/vgform/io){ s/src="?\/home\.html"?/src=\/$page-$adtitle/io; }else{ s/src="?\/home\.html"?/src=\/$page/io; } $r->print($_); } return OK; } 1;