Dotclear


Ignore:
Timestamp:
05/21/12 18:42:13 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Cope with all entry-xxx.html (other than full, short and title)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_public.php

    r828 r830  
    9292          global $core; 
    9393           
     94          $tpl_path = dirname(__FILE__).'/tpl/'; 
     95          $list_types = array('title','short','full'); 
     96 
     97          // Get all _entry-*.html in tpl folder of theme 
     98          $list_types_templates = files::scandir($tpl_path); 
     99          if (is_array($list_types_templates)) { 
     100               foreach ($list_types_templates as $v) { 
     101                    if (preg_match('/^_entry\-(.*)\.html$/',$v,$m)) { 
     102                         if (isset($m[1])) { 
     103                              if (!in_array($m[1],$list_types)) { 
     104                                   // template not already in full list 
     105                                   $list_types[] = $m[1]; 
     106                              } 
     107                         } 
     108                    } 
     109               } 
     110          } 
     111 
    94112          $default = isset($attr['default']) ? trim($attr['default']) : 'short'; 
    95           return '<?php '."\n". 
    96                'switch (tplDuctileTheme::ductileEntriesListHelper(\''.$default.'\')) {'."\n". 
    97                '    case \'title\':'."\n". 
    98                ' ?>'."\n". 
    99                          $core->tpl->includeFile(array('src' => '_entry-title.html'))."\n". 
    100                '<?php '."\n". 
    101                '         break;'."\n". 
    102                '    case \'short\':'."\n". 
    103                ' ?>'."\n". 
    104                          $core->tpl->includeFile(array('src' => '_entry-short.html'))."\n". 
    105                '<?php '."\n". 
    106                '         break;'."\n". 
    107                '    case \'full\':'."\n". 
    108                ' ?>'."\n". 
    109                          $core->tpl->includeFile(array('src' => '_entry-full.html'))."\n". 
    110                '<?php '."\n". 
    111                '         break;'."\n". 
    112                '}'."\n". 
    113                ' ?>'; 
     113          $ret = '<?php '."\n". 
     114               'switch (tplDuctileTheme::ductileEntriesListHelper(\''.$default.'\')) {'."\n"; 
     115 
     116          foreach ($list_types as $v) { 
     117               $ret .= ' case \''.$v.'\':'."\n". 
     118                    '?>'."\n". 
     119                              $core->tpl->includeFile(array('src' => '_entry-'.$v.'.html'))."\n". 
     120                    '<?php '."\n". 
     121                    '         break;'."\n"; 
     122          } 
     123 
     124          $ret .= '}'."\n". 
     125               '?>'; 
     126           
     127          return $ret; 
    114128     } 
    115129      
Note: See TracChangeset for help on using the changeset viewer.

Sites map