Changeset 960 for trunk/include


Ignore:
Timestamp:
Dec 3, 2005, 6:33:38 PM (18 years ago)
Author:
chrisaga
Message:

improve template : split theme from template itself

rest of the job : template (yoga), themes (clear dark), and php to handle them

Location:
trunk/include
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include

    • Property svn:ignore
      •  

        old new  
        11mysql.inc.php
         2config_local.inc.php
  • trunk/include/common.inc.php

    r953 r960  
    221221}
    222222
     223// include template/theme configuration
     224list($user['template'], $user['theme']) = explode('/', $user['template']);
     225// TODO : replace initial $user['template'] by $user['layout']
     226
     227include(PHPWG_ROOT_PATH.'template/'.$user['template'].'/theme/'.$user['theme'].'/themeconf.inc.php');
     228
    223229// template instance
    224230$template = new Template(PHPWG_ROOT_PATH.'template/'.$user['template']);
  • trunk/include/functions.inc.php

    r894 r960  
    534534
    535535/**
    536  * returns available templates
     536 * returns available templates/themes
    537537 */
    538538function get_templates()
    539539{
    540   return get_dirs(PHPWG_ROOT_PATH.'template');
     540  return get_dirs(PHPWG_ROOT_PATH.'theme');
     541}
     542function get_themes()
     543{
     544  $themes = array();
     545
     546  foreach (get_dirs(PHPWG_ROOT_PATH.'template') as $template)
     547  {
     548    foreach (get_dirs(PHPWG_ROOT_PATH.'template/'.$template.'/theme') as $theme)
     549    {
     550      array_push($themes, $template.'/'.$theme);
     551    }
     552  }
     553
     554  return $themes;
    541555}
    542556
     
    566580  else
    567581  {
    568     $src = PHPWG_ROOT_PATH;
    569     $src.= 'template/'.$user['template'].'/mimetypes/';
     582    $src = get_themeconf('mime_icon_dir');
    570583    $src.= strtolower(get_extension($path)).'.png';
    571584  }
     
    727740  return isset($lang[$key]) ? $lang[$key] : $key;
    728741}
     742
     743/**
     744 * returns the corresponding value from $themeconf if existing. Else, the key is
     745 * returned
     746 *
     747 * @param string key
     748 * @return string
     749 */
     750function get_themeconf($key)
     751{
     752  global $themeconf;
     753
     754  return $themeconf[$key];
     755}
    729756?>
  • trunk/include/functions_html.inc.php

    r948 r960  
    4444  if ( $diff < $user['recent_period'] * $day_in_seconds )
    4545  {
    46     $icon_url = './template/'.$user['template'].'/theme/';
    47     $icon_url.= 'recent.png';
     46    $icon_url = get_themeconf('icon_dir').'/recent.png';
    4847    $title .= $user['recent_period'];
    4948    $title .=  '&nbsp;'.$lang['days'];
  • trunk/include/template.php

    r858 r960  
    331331      // PWG specific : communication between template and $lang
    332332      $code = preg_replace('/\{lang:([^}]+)\}/e', "l10n('$1')", $code);
     333      // PWG specific : expand themeconf.inc.php variables
     334      $code = preg_replace('/\{themeconf:([^}]+)\}/e', "get_themeconf('$1')", $code);
    333335           
    334336      // replace \ with \\ and then ' with \'.
Note: See TracChangeset for help on using the changeset viewer.