[Templates] Possible problem w/ Stash

Drew Taylor drew@drewtaylor.com
Thu, 28 Mar 2002 13:58:03 -0500


Well, I've fixed the problem and narrowed it down to this bit of code 
causing nothing after it to be evaluated. Once I take out the second 
FOREACH loop, everything is OK. So I just replaced the second loop w/ 
static lines. But I'm still perplexed about what is going on. FYI, I 
thought that perhaps the "data=somestring" was replacing my data which is 
passed in under the "data" key of the template params, but changing it and 
all other variable names did not make any difference.

Drew

       <tr>
         <td colspan="2"><font size="2" face="Arial, Helvetica, 
sans-serif"><br>
           <b>7. Which of the following services does your company 
provide:</b><br>

           <table cellspacing="0">
           [% FOREACH type = provide_types.keys %]
           <tr>
              <td width="491" colspan="2"><font face="Arial, Helvetica, 
sans-serif" size="2">
              <input type="checkbox" name="[% type %]" value="1" [% 
data.${type} ? 'checked' : '' %]>[% provide_types.${type} %]</font></td>
               </tr>
           [% END %]
           [% FOREACH srvc = [1,2] %]
           [% data = "provide_other${srvc}";
              desc = "provide_other${srvc}_desc"; %]
           <tr>
              <td width="136"><font face="Arial, Helvetica, sans-serif" 
size="2">
              <input type="checkbox" name="provide_other[% x %]" value="1" 
[% data.${data} ? 'checked' : '' %]>Other [% x %] (describe):&nbsp;</font></td>
              <td width="355"><font face="Arial, Helvetica, sans-serif" 
size="2">
              <input type="text" name="provide_other[% x %]_desc" value="[% 
data.${desc} %]" size="20"></font></td>
           </tr>
           [% END %]
           </table>
           </font></td>
         </tr>

At 08:39 AM 3/28/02 +0000, Andy Wardley wrote:
>On Wed, Mar 27, 2002 at 03:12:04PM -0500, Drew Taylor wrote:
> > I'm finishing up an application here at work and I'm running into a 
> problem
> > getting data to print.
>
>Hmmm looks strange.  Just to make sure there wasn't anything obvious
>going on, I created this template:
>
>[% rate_types => {
>      'rate_therapy' => 'Therapy',
>      'rate_hh_aid' => 'Home Health Aide',
>      'rate_homemaking' => 'Homemaking',
>      'rate_rn' => 'Nursing (RN)',
>      'rate_cna' => 'Certified Nursing Assistant',
>      'rate_lpn' => 'Nursing (LPN)',
>      'rate_personal' => 'Personal Care Attendant'
>    }
>    data => {
>      'rate_personal' => '16.0000',
>      'rate_therapy' => '10.0000',
>      'rate_hh_aid' => '11.0000',
>      'provide_meds' => 1,
>      'num_clients' => 400,
>      'pay_medicare' => 1,
>      'zip1' => '02420',
>
>      ...etc...
>
>      'submission_date' => '0000-00-00',
>      'refer_phy_per' => 54,
>      'network' => 1,
>    }
>-%]
>
>[% FOREACH type = rate_types.keys %]
>* [% rate_types.${type} %] : [% data.${type} %] : [% type %]
>[% END %]
>
>and the output is, as I would expect:
>
>* Personal Care Attendant : 16.0000 : rate_personal
>* Nursing (LPN) :  : rate_lpn
>* Homemaking :  : rate_homemaking
>* Therapy : 10.0000 : rate_therapy
>* Nursing (RN) :  : rate_rn
>* Certified Nursing Assistant :  : rate_cna
>* Home Health Aide : 11.0000 : rate_hh_aid
>
>But that probably doesn't help very much...

Nope. :-)