commit 801260aa17227c028b90eee1a69ae0c71ceaec35 parent ed4252a592221e61e31ed45dd013947fd5ef2736 Author: uriel@suckless.org <unknown> Date: Fri, 5 Sep 2008 01:11:14 +0200 New get_inc_file function to be used in templates and other places to get includes/templates that can be overriden on a per-site (and group of sites) basis. Diffstat:
M | bin/controller.rc | | | 14 | +++++++++++--- |
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/bin/controller.rc b/bin/controller.rc @@ -33,6 +33,16 @@ Location: '^$1^' exit } +fn get_inc_file { + wantedfile = $1 + if (test -f $sitedir/_inc/$wantedfile) + echo -n $sitedir/_inc/$wantedfile + if not if(test -f sites/$masterSite/_inc/$wantedfile) + echo -n sites/$masterSite/_inc/$wantedfile + if not if (test -f inc/$wantedfile) + echo -n inc/$wantedfile +} + # Title fn gentitle { @@ -147,7 +157,7 @@ fn dir_listing_handler { } fn 404_handler { - template.awk inc/404.tpl | rc $rcargs + template.awk `{get_inc_file 404.tpl } | rc $rcargs } fn blog_dir_handler { @@ -287,8 +297,6 @@ if not if (~ $#redirectPermanent 2 && {echo $SERVER_NAME^$REQUEST_URI|grep -s $r # Template/body selection template=$sitedir/$template.tpl -if (! ~ $#sidebar 0) - sidebar=tpl/_inc/$sidebar.tpl body=$sitedir/$body rssuri=$uri