Skip to content

Commit

Permalink
feature 1502: Add $themeconf['load_parent_css'] parameter
Browse files Browse the repository at this point in the history
git-svn-id: http://piwigo.org/svn/trunk@5991 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
patdenice committed Apr 29, 2010
1 parent e748708 commit a2ccb9a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion admin/themes/default/template/header.tpl
Expand Up @@ -14,8 +14,10 @@
<link rel="shortcut icon" type="image/x-icon" href="{$ROOT_URL}{$themeconf.icon_dir}/favicon.ico">

{foreach from=$themes item=theme}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if}
{if $theme.load_css}
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}admin/themes/{$theme.id}/theme.css">
{/if}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if}
{/foreach}

{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} {*jQuery is always available by default*}
Expand Down
13 changes: 10 additions & 3 deletions include/template.class.php
Expand Up @@ -102,18 +102,25 @@ function Template($root = ".", $theme= "", $path = "template")
/**
* Load theme's parameters.
*/
function set_theme($root, $theme, $path)
function set_theme($root, $theme, $path, $load_css=true)
{
$this->set_template_dir($root.'/'.$theme.'/'.$path);

$themeconf = $this->load_themeconf($root.'/'.$theme);

if (isset($themeconf['parent']) and $themeconf['parent'] != $theme)
{
$this->set_theme($root, $themeconf['parent'], $path);
if (!isset($themeconf['load_parent_css']))
{
$themeconf['load_parent_css'] = true;
}
$this->set_theme($root, $themeconf['parent'], $path, $themeconf['load_parent_css']);
}

$tpl_var = array('id' => $theme);
$tpl_var = array(
'id' => $theme,
'load_css' => $load_css,
);
if (!empty($themeconf['local_head']) )
{
$tpl_var['local_head'] = realpath($root.'/'.$theme.'/'.$themeconf['local_head'] );
Expand Down
2 changes: 2 additions & 0 deletions themes/default/template/header.tpl
Expand Up @@ -31,7 +31,9 @@
{if isset($U_UP) }<link rel="up" title="{'Thumbnails'|@translate}" href="{$U_UP}" >{/if}

{foreach from=$themes item=theme}
{if $theme.load_css}
<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/{$theme.id}/theme.css">
{/if}
{if isset($theme.local_head)}{include file=$theme.local_head}{/if}
{/foreach}
{* the next css is used to fix khtml (Konqueror/Safari) issue the "text/nonsense" prevents gecko based browsers to load it *}
Expand Down

0 comments on commit a2ccb9a

Please sign in to comment.