[htmltmpl] Re: Templates with template loops within templates
Brought to you by:
samtregar
From: Eric F. <er...@dm...> - 2004-12-18 00:27:42
|
Hi, I just thought this might be worth posting. This is the template that is in the DB that is loaded as a template var in the main page. The line: <img src="<TMPL_VAR NAME=URL_BASE>images/shipping/<TMPL_VAR NAME=S_ICON> is where the problem comes up. Every other URL_BASE in here is replaced correctly and of course all of the loop vars are fine as well. Thanks, Eric <!-- H::T BUG: <TMPL_VAR URL_BASE> --> <!--Start of Shipping type Section --> <TABLE WIDTH=700 class="bord" BORDER=0 CELLPADDING=2 CELLSPACING=0 align="center"> <TR> <TD class="bord" align="center"><span class="title">Shipping Method</span></TD> </TR> <TR> <TD> <!--second color table--> <TABLE WIDTH=700 class="main" BORDER=0 CELLPADDING=10 CELLSPACING=0 align="center"> <TR> <TD class="main" align="center"> <!--pieces table--> <TABLE WIDTH=95% BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center"> <tr> <td><IMG SRC="<TMPL_VAR NAME=URL_BASE>images/spacer.gif" WIDTH=10 HEIGHT=5></TD> </tr> <tr> <td> <table align="center"> <tr> <!--start loop--> <TMPL_LOOP NAME=SHIP_LOOP> <label for="ship<TMPL_VAR NAME=S_METHOD_ID>"> <TD width=15 align="right"><input type=radio id="ship<TMPL_VAR NAME=S_METHOD_ID>" name="ship_option" value="<TMPL_VAR NAME=S_METHOD_ID>" <TMPL_VAR NAME=DEFAULT>></TD> <TD width=65 class="boxfields" align="center" valign="top"> <img src="<TMPL_VAR NAME=URL_BASE>images/shipping/<TMPL_VAR NAME=S_ICON>" alt="<TMPL_VAR NAME=S_COURIER> <TMPL_VAR NAME=S_METHOD>"><br><b>$<TMPL_VAR NAME=S_COST></b></TD> </label> </TMPL_LOOP> <!--end loop--> </tr> </table> </td> </tr> <tr> <td><IMG SRC="<TMPL_VAR NAME=URL_BASE>images/spacer.gif" WIDTH=10 HEIGHT=5></TD> </tr> </table> <!--end of pieces table--> </td> </tr> </table> <!--end of second color table--> </TD> </TR> </table> <!--end of Shipping type Section--> >Hi, > >I think I understand what you are saying, but that was part of the >confusion. The URL_BASE is used before the loop in the top level >template.(Sorry I didn't show the entire thing) At least I think I >understood what you said, that there is a bug where if the first time a >var is referenced is in a loop it won't be replaced. If that is so, then >that bug can't be the reason I am sorry to say :) > >Thanks very much for the reply, > >Eric > > > > >> >>It sounds like you have hit the dreaded "top level param, not referenced >>before use in >>template loop, so I"ll just do nothing" bug... try this somewhere before >>your first >>TMPL_LOOP (say at the top of the file), in your first template: >> >> <!-- H::T BUG: <TMPL_VAR URL_BASE> --> >> >> which _should_ do absolutely nothing useful/harmful to the html >> output. However, it will >>result in H:T actually getting a reference to the URL_BASE variable. > |