Dotclear


Ignore:
Timestamp:
03/29/12 13:34:24 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Ductile theme 1.1 : Add optional logo URL in configuration. A media selector should be nice but I don't know how to implement it, until now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_public.php

    r776 r810  
    2222$core->tpl->addBlock('EntryIfContentIsCut',array('tplDuctileTheme','EntryIfContentIsCut')); 
    2323$core->tpl->addValue('ductileNbEntryPerPage',array('tplDuctileTheme','ductileNbEntryPerPage')); 
     24$core->tpl->addValue('ductileLogoSrc',array('tplDuctileTheme','ductileLogoSrc')); 
    2425 
    2526class tplDuctileTheme 
     
    100101          $local_attr = array('src' => '_entry-'.($model ? $model : $default).'.html'); 
    101102          return $core->tpl->includeFile($local_attr); 
     103     } 
     104 
     105     public static function ductileLogoSrc($attr) 
     106     { 
     107          global $core; 
     108 
     109          $s = $GLOBALS['core']->blog->settings->themes->get($GLOBALS['core']->blog->settings->system->theme.'_style'); 
     110          if ($s === null) { 
     111               return; 
     112          } 
     113          $s = @unserialize($s); 
     114          if (!is_array($s)) { 
     115               return; 
     116          } 
     117           
     118          $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/logo.png'; 
     119          if (isset($s['logo_src'])) { 
     120               if ($s['logo_src'] !== null) { 
     121                    if ($s['logo_src'] != '') { 
     122                         if ((substr($s['logo_src'],0,1) == '/') || (parse_url($s['logo_src'],PHP_URL_SCHEME) != '')) { 
     123                              // absolute URL 
     124                              $img_url = $s['logo_src']; 
     125                         } else { 
     126                              // relative URL (base = img folder of ductile theme) 
     127                              $img_url = $core->blog->settings->system->themes_url.'/'.$core->blog->settings->system->theme.'/img/'.$s['logo_src']; 
     128                         } 
     129                    } 
     130               } 
     131          } 
     132           
     133          return $img_url; 
    102134     } 
    103135 
Note: See TracChangeset for help on using the changeset viewer.

Sites map