From: Boris Z. <bo...@am...> - 2002-09-30 14:37:20
|
Hello Ben, Am Montag, 30. September 2002 15:39 schrieb Ben Ausden: > Hi, > > can anyone think of a way of handling 'virtual' URLs, e.g. > > /index -> maps to /index.tmpl (as normal) > /something -> maps to /another/place/something.tmpl > /else -> maps to /go/here.tmpl > > > I originally wrote a pkit_default sub to handle this, then realized PageKit > won't even run it, because something.tmpl doesn't exist. The reason I need > is it because I need to be able to create simple URLs which map to complex > URLs (stored in the database), so they can be displayed in advertisements, > hoardings, bus shelters etc etc. I'd rather not have to create dummy > templates to handle each URL. > > any ideas that don't involve hacking PageKit.pm ??!! > > ;-) maybe pkit_fixup_uri is enough for this. in Common.pm sub pkit_fixup_uri { my $model = shift; my $uri = shift; my %map = ( '/something'=>'/another/place/something','/else'=>'/go/here'); $map{$uri} || $uri; } -- Boris |