[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] TT fun!



(1) Oops! In Template Toolkit this fails:

[%  lang_para1   = "Thank you $guest_name for booking ...snip... you at
$prop_name."  %]

Because TT sees $prop_name. as an attempt to envoke a method on the
prop_name object. What method? The undef method perhaps? Dunno, but I
had to change it to this:

[%  lang_para1   = "Thank you $guest_name for booking ...snip... you at
${prop_name}."  %]

I hadn't seen that pattern before.



(2) TT + Date::Class + our custom OO business layer (Res) + our
multi-language hackery = FUN!!

HTML-mode snippet from a TT template:

  <font class=small>$lang_text1
${Res.get_arrival_date('obj').format('%m-%b-%Y (%a)')}<br>
                    $lang_text2 ${Res.get_depart_date(
'obj').format('%m-%b-%Y (%a)')}<br>

Output:

  <font class=small>Arrival: 09-Sep-2005 (Thu)<br>
                    Depart: 09-Sep-2005 (Fri)<br>



Mwoo ha ha ha ha hah ah ahaha,

j