Bazen şablonunuzda bir metnin yalnızca ilk karakter sayısını göstermek isteyebilirsiniz, örneğin bir 'önizleme' için. Bu, bir CoTemplate geri çağrısı ile kolayca gerçekleştirilebilir:
{PAGE_TEXT|cot_string_truncate('$this', 200)}
2. parametre son metnin maksimum uzunluğudur, bu durumda 200 karakterdir. cot_string_truncate varsayılan olarak html etiketlerini veya kelimeleri kesmeyecektir.
Metin kesilmişse dinamik olarak bir 'Devamını oku' bağlantısı göstermenin ilginç bir yolu burada:
{PAGE_TEXT|cot_string_truncate('$this', 200)}
<!-- IF {PAGE_TEXT} != {PAGE_TEXT|cot_string_truncate('$this', 200)} -->...
<a href="{PAGE_URL}">{PHP.L.ReadMore|mb_strtolower}</a><!-- ENDIF -->
Bu öneri için esclkm'ye teşekkürler.
Thanked: 12 kez
Thank you for this!
I was wondering though, because I am using the html parser for the news pages, it adds the closing paragraph tag to the end of the PAGE_ROW_TEXT and therfore pushing the "..." and the read more link under the text. Is there anyway of stopping this without removing the < p >< /p > tags from the news article itself?