Changeset 2953:fdcac99dd62d
- Timestamp:
- 02/01/15 12:40:09 (9 years ago)
- Branch:
- default
- Location:
- inc/public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/public/class.dc.template.php
r2886 r2953 132 132 $this->addBlock('EntriesFooter',array($this,'EntriesFooter')); 133 133 $this->addBlock('EntriesHeader',array($this,'EntriesHeader')); 134 $this->addValue('EntryExcerpt',array($this,'EntryExcerpt'));135 134 $this->addValue('EntryAuthorCommonName',array($this,'EntryAuthorCommonName')); 136 135 $this->addValue('EntryAuthorDisplayName',array($this,'EntryAuthorDisplayName')); … … 148 147 $this->addValue('EntryContent',array($this,'EntryContent')); 149 148 $this->addValue('EntryDate',array($this,'EntryDate')); 149 $this->addValue('EntryExcerpt',array($this,'EntryExcerpt')); 150 150 $this->addValue('EntryFeedID',array($this,'EntryFeedID')); 151 151 $this->addValue('EntryFirstImage',array($this,'EntryFirstImage')); 152 152 $this->addValue('EntryID',array($this,'EntryID')); 153 153 $this->addBlock('EntryIf',array($this,'EntryIf')); 154 $this->addBlock('EntryIfContentCut',array($this,'EntryIfContentCut')); 154 155 $this->addValue('EntryIfFirst',array($this,'EntryIfFirst')); 155 156 $this->addValue('EntryIfOdd',array($this,'EntryIfOdd')); … … 1434 1435 1435 1436 /*dtd 1436 <!ELEMENT tpl:EntryContent - O-- Entry content -->1437 <!ELEMENT tpl:EntryContent - -- Entry content --> 1437 1438 <!ATTLIST tpl:EntryContent 1438 1439 absolute_urls CDATA #IMPLIED -- transforms local URLs to absolute one … … 1455 1456 return '<?php echo '.sprintf($f,'$_ctx->posts->getContent('.$urls.')').'; ?>'; 1456 1457 } 1458 } 1459 1460 /*dtd 1461 <!ELEMENT tpl:EntryIfContentCut - - -- Test if Entry content has been cut --> 1462 <!ATTLIST tpl:EntryIfContentCut 1463 absolute_urls CDATA #IMPLIED -- transforms local URLs to absolute one 1464 full (1|0) #IMPLIED -- test with full content and excerpt 1465 > 1466 */ 1467 public function EntryIfContentCut($attr,$content) 1468 { 1469 if (empty($attr['cut_string']) || !empty($attr['full'])) { 1470 return ''; 1471 } 1472 1473 $urls = '0'; 1474 if (!empty($attr['absolute_urls'])) { 1475 $urls = '1'; 1476 } 1477 1478 $short = $this->getFilters($attr); 1479 $cut = $attr['cut_string']; 1480 $attr['cut_string'] = 0; 1481 $full = $this->getFilters($attr); 1482 $attr['cut_string'] = $cut; 1483 1484 return '<?php if (strlen('.sprintf($full,'$_ctx->posts->getContent('.$urls.')').') > '. 1485 'strlen('.sprintf($short,'$_ctx->posts->getContent('.$urls.')').')) : ?>'. 1486 $content. 1487 '<?php endif; ?>'; 1457 1488 } 1458 1489 -
inc/public/default-templates/currywurst/_entry-short.html
r2625 r2953 25 25 <p> 26 26 {{tpl:EntryContent encode_html="1" remove_html="1" cut_string="300"}} 27 <tpl:EntryIfContentCut encode_html="1" remove_html="1" cut_string="300"> 28 <span class="ellipsis"> […]</span> 29 </tpl:EntryIfContentCut> 27 30 </p> 28 31 </div>
Note: See TracChangeset
for help on using the changeset viewer.