Experimental: Switch to custom templates if present

Add: error.tpl
This commit is contained in:
Regis Houssin 2009-07-30 14:41:54 +00:00
parent 97e9c8fb2b
commit 2571bc130f
2 changed files with 31 additions and 7 deletions

View File

@ -209,23 +209,23 @@ if ($resql)
// Check if a custom template is present // Check if a custom template is present
if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/liste.tpl')) if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/'.$_GET["canvas"].'/liste.tpl'))
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates'; $smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/templates/product/';
$template = '/product/'.$_GET["canvas"].'/liste.tpl'; $template = $_GET["canvas"].'/liste.tpl';
} }
// Check if a default template is present // Check if a default template is present
else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/liste.tpl')) else if (file_exists(DOL_DOCUMENT_ROOT . '/product/canvas/'.$_GET["canvas"].'/liste.tpl'))
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/canvas'; $smarty->template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/';
$template = '/'.$_GET["canvas"].'/liste.tpl'; $template = $_GET["canvas"].'/liste.tpl';
} }
// Error template // Error template
else else
{ {
$smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/common/templates'; $smarty->template_dir = DOL_DOCUMENT_ROOT . '/theme/common/templates/';
$template = '/error.tpl'; $template = 'error.tpl';
} }
$smarty->display($smarty->template_dir.$template); $smarty->display($template);
} }
else else
{ {

View File

@ -0,0 +1,24 @@
{* Copyright (C) 2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*}
<!-- BEGIN SMARTY TEMPLATE -->
<!-- END SMARTY TEMPLATE -->