Dotclear

Changeset 574:6430df826043 for themes


Ignore:
Timestamp:
07/11/11 18:29:40 (14 years ago)
Author:
Franck <carnet.franck.paul@…>
Branch:
themes
Message:

Nouvelle balise de test du contenu coupé. Permet de ne pas afficher "lire la suite…" lorsque le billet est complètement affiché.

Location:
themes/ductile
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • themes/ductile/_public.php

    r563 r574  
    1919# Templates 
    2020$core->tpl->addValue('ductileEntriesList',array('tplDuctileTheme','ductileEntriesList')); 
     21$core->tpl->addBlock('EntryIfContentIsCut',array('tplDuctileTheme','EntryIfContentIsCut')); 
    2122 
    2223class tplDuctileTheme 
    2324{ 
     25     public static function EntryIfContentIsCut($attr,$content) 
     26     { 
     27          global $core; 
     28           
     29          if (empty($attr['cut_string']) || empty($attr['cut_string'])) { 
     30               return ''; 
     31          } 
     32           
     33          $urls = '0'; 
     34          if (!empty($attr['absolute_urls'])) { 
     35               $urls = '1'; 
     36          } 
     37           
     38          $short = $core->tpl->getFilters($attr); 
     39          $attr['cut_string'] = 0; 
     40          $full = $core->tpl->getFilters($attr); 
     41 
     42          return '<?php if (strlen('.sprintf($full,'$_ctx->posts->getContent('.$urls.')').') > '. 
     43               'strlen('.sprintf($short,'$_ctx->posts->getContent('.$urls.')').')) : ?>'. 
     44               $content. 
     45               '<?php endif; ?>'; 
     46     }     
     47      
    2448     public static function ductileEntriesList($attr) 
    2549     { 
  • themes/ductile/tpl/_entry-short.html

    r535 r574  
    3939    <tpl:EntryIf extended="0"> 
    4040      <div class="post-content">{{tpl:EntryContent encode_html="1" remove_html="1" cut_string="300"}}</div> 
    41       <p class="read-it"><a href="{{tpl:EntryURL}}" 
    42       title="{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="1"}}">{{tpl:lang Continue 
    43       reading}}</a></p> 
     41      <tpl:EntryIfContentIsCut encode_html="1" remove_html="1" cut_string="300"> 
     42        <p class="read-it"><a href="{{tpl:EntryURL}}" 
     43        title="{{tpl:lang Continue reading}} {{tpl:EntryTitle encode_html="1"}}">{{tpl:lang Continue reading}}</a></p> 
     44      </tpl:EntryIfContentIsCut> 
    4445    </tpl:EntryIf> 
    4546     
Note: See TracChangeset for help on using the changeset viewer.

Sites map