{"field":"details","caption":"Details","inputTVtype":"richtext"}
<div class="accordion" data-accordion> <div data-control class="data-control"> <h2>[[+name]]</h2> <span class="location">[[+location]]</span> - <span class="date">[[+date:strtotime:date=`%m.%d.%Y`]]</span> </div> <div data-content> <div class="poster"> <img src="uploads/[[+image]]" alt="[[+name:htmlentities]]" /> </div> <div class="details"> [[+details:ellipsis=`800`]] <a class="more-info-link" data-remodal-target="[[+name:stripString=`,`:replace=` ==-`]]">More Info</a> </div> <div class="more-info"> <div class="remodal" data-remodal-id="[[+name:stripString=`,`:replace=` ==-`]]"> <button data-remodal-action="close" class="remodal-close"></button> [[+details]] </div> </div> </div> </div>
<?php $full = "[[+details]]"; $ellipsis = "[[+details:ellipsis=`800`]]"; $more = "[[$readmore]]"; if (strlen($full) <= 800){ return $full; } else { return $ellipsis.= $more; }
This question has been answered by Bruno17. See the first response.
<?php $text = $modx->getOption('text',$scriptProperties,''); $len = $modx->getOption('len',$scriptProperties,500); $fullTpl = $modx->getOption('fullTpl',$scriptProperties,''); $shortTpl = $modx->getOption('shortTpl',$scriptProperties,''); if (strlen($text) <= $len){ $output = $modx->getChunk($fullTpl,$scriptProperties); } else { $output = $modx->getChunk($shortTpl,$scriptProperties); } return $output;
[[switchChunkAtLen? &text = `[[+details]]` &name = `[[+name]]` &fullTpl = `myFullTpl` &shortTpl = `myShortTpl` &len=`800` ]]
<div class="details"> [[+text]] </div>
<div class="details"> [[+text:ellipsis=`[[+len]]`]] <a class="more-info-link" data-remodal-target="[[+name:stripString=`,`:replace=` ==-`]]">More Info</a> </div> <div class="more-info"> <div class="remodal" data-remodal-id="[[+name:stripString=`,`:replace=` ==-`]]"> <button data-remodal-action="close" class="remodal-close"></button> [[+text]] </div> </div>
&fullTpl = ´myFullTpl´
&fullTpl = `myFullTpl`