Blog

We creëren een smarty modifier genaamd age (function.zodiac.php), en plaatsen deze in de map smarty_plugins :

function smarty_function_zodiac($params, &$smarty)
{
  $dob = arr::get($params, 'dob');

list ($year, $month, $day) = explode("-", $dob);

if ( ($month == 1 && $day >= 20) || ($month == 2 && $day <= 18) ) return __('Waterman');

elseif ( ($month == 2 && $day >= 19) || ($month == 3 && $day <= 20) ) return __('Vissen');

elseif ( ($month == 3 && $day >= 21) || ($month == 4 && $day <= 19) ) return __('Ram');

elseif ( ($month == 4 && $day >= 20) || ($month == 5 && $day <= 20) ) return __('Stier');

elseif ( ($month == 5 && $day >= 21) || ($month == 6 && $day <= 21) ) return __('Tweelingen');

elseif ( ($month == 6 && $day >= 22) || ($month == 7 && $day <= 22) ) return __('Kreeft');

elseif ( ($month == 7 && $day >= 23) || ($month == 8 && $day <= 22) ) return __('Leeuw');

elseif ( ($month == 8 && $day >= 23) || ($month == 9 && $day <= 22) ) return __('Maagd');

elseif ( ($month == 9 && $day >= 23) || ($month == 10 && $day <= 22) ) return __('Weegschaal');

elseif ( ($month == 10 && $day >= 23) || ($month == 11 && $day <= 21) ) return __('Schorpioen');

elseif ( ($month == 11 && $day >= 22) || ($month == 12 && $day <= 21) ) return __('Boogschutter');

elseif ( ($month == 12 && $day >= 22) || ($month == 1 && $day <= 19) ) return __('Steenbok'); }

In de Smarty view :

{zodiac dob=$model_user->info->dateofbirth}
Zoeken