Some interesting findings from web-dev land…
Came across this very handy Smarty Ternary modifier today:
http://www.ninjacipher.com/2007/11/24/smarty-ternary-modifier/
Thanks to NinjaCipher for that ;]
I agree they should bung this operator in the core of Smarty.
Might be useful for someone, I wrote it to handle dynamic select menus. Particularity when listing URLs.
1234567891011121314151617181920212223242526272829<?php
/**
* Smarty truncate_left modifier plugin
*
* Type: modifier<br />
* Name: truncate_left<br />
* Purpose: truncates left hand side of a string
* @link: none
* @param string
* @param integer
* @param string
* @return string
*/
function smarty_modifier_truncate_left($string, $threshold=80, $replacement=’&hellip;’) {
if(strlen($string) >= $threshold){
$amount_over = count($string) – $threshold;
$output [...]