From 4e3a2ba8d578059dc953da8c2ffb140ecf052dbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Wed, 19 Mar 2025 17:02:00 +0100 Subject: [PATCH 1/2] Option to define a custom template dir --- conf/config.inc.php | 3 +++ htdocs/index.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/config.inc.php b/conf/config.inc.php index 53f4f27d9..96c3500e6 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -406,6 +406,9 @@ $custom_css = ""; $display_footer = true; +# Customized template directory: to ovverride some templates files +$custom_tpl_dir = ""; + # Where to log password resets - Make sure apache has write permission # By default, they are logged in Apache log #$reset_request_log = "/var/log/self-service-password"; diff --git a/htdocs/index.php b/htdocs/index.php index 060668dbb..0754d4eca 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -256,10 +256,11 @@ $compile_dir = isset($smarty_compile_dir) ? $smarty_compile_dir : "../templates_c/"; $cache_dir = isset($smarty_cache_dir) ? $smarty_cache_dir : "../cache/"; +$tpl_dir = isset($custom_tpl_dir) ? array('../'.$custom_tpl_dir, '../templates/') : '../templates/'; $smarty = new Smarty(); $smarty->escape_html = true; -$smarty->setTemplateDir('../templates/'); +$smarty->setTemplateDir($tpl_dir); $smarty->setCompileDir($compile_dir); $smarty->setCacheDir($cache_dir); $smarty->debugging = $smarty_debug; From f344040e01128eb3e52fd487dae3b1ac0ced652f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20OUDOT?= Date: Wed, 19 Mar 2025 17:08:28 +0100 Subject: [PATCH 2/2] Documentation for custom_tpl_dir option --- docs/config_general.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/config_general.rst b/docs/config_general.rst index 3468b8e93..08642e013 100644 --- a/docs/config_general.rst +++ b/docs/config_general.rst @@ -174,6 +174,17 @@ You can hide the footer bar: $display_footer = false; +Custom templates +^^^^^^^^^^^^^^^^ + +If you need to do more changes on the interface, you can create a custom templates directory +and override any of template file by copying it from ``templates/`` into the custom directory +and adapt it to your needs: + +.. code-block:: php + + $custom_tpl_dir = "templates_custom/"; + Debug -----