Thread: Age Calculation
View Single Post
  #24  
Old 05-08-2010, 02:48 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Age Calculation

Here's the code in the tpl.

Code:
{* For http://forum.x-cart.com/showthread.php?t=53578 Call extra fields via this: {$extra_fields.0.field_value} {$extra_fields.1.field_value} {$extra_fields.2.field_value} *} var day = {$extra_fields.0.field_value}; var month = {$extra_fields.1.field_value}; var year = {$extra_fields.2.field_value}; function checkCurAge($year,$month,$day='') { $day=(empty($day))?'1':$day; list($this_year, $this_month, $this_day) = explode(' ',date('Y n j')); $age = $this_year - $year; if ($month>$this_month||($this_month==$month&&$this_day<$day)) { $age--; } return $age; }

Here is the error. As you can see it's pull in the variables.

Error: Smarty error: [in modules/Age_Calculation/age.tpl line 12]: syntax error: unrecognized tag: $day=(empty($day))?'1':$day; list($this_year, $this_month, $this_day) = explode(' ',date('Y n j')); $age = $this_year - $year; if ($month>$this_month||($this_month==$month&&$this_d ay<$day)) { $age--; (Smarty_Compiler.class.php, line 446) in /home/minfinge/public_html/littlepuppiesonline.com/include/lib/smarty/Smarty.class.php on line 1093
var day = 8; var month = 17; var year = 1977; function checkCurAge($year,$month,$day='') return $age; }
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote