Hi
I've just written my fist site using Smarty, and for the most part this has been excellent, but i've just come across a wierd little glitch that i just can't figure. The problem seems to be that Smarty is sending a non-printable character to the browser, and when you view this on Netscape 7.0 this is rendered as a little box (which i want rid of!!). The pages in question are displaying quite a lot of data from a database and this is passed to the templates in arrays. Here is a chunk of code as an example:
{section name=cli loop=$nhs_clinic_times step=1}
{if $smarty.section.cli.first}
<tr>
<td colspan="3" width="100%" class="{$site_section}subheading">
NHS Practice
</td>
</tr>
<tr>
</tr>
{/if}
<tr>
<td colspan="1" width="50%" class="{$site_section}">
Clinic Times:
<div class="data">
{$nhs_clinic_times[cli.index]}
</div>
etc......
This problem seems to arise when the arrays that are passed (in this case $nhs_clinic_times(n)) contain zero length strings, and it seems that smarty is converting these into some kind of non-printable. At first i thought this was being caused by my code passing null values that were retrieved from the databse, but this is not the case as i have changed to sql to, eg.:
SELECT COALESCE(thsc.secretary_tel,'') AS secretary_tel
etc...
(many thanks to vincente for that top tip!!!)
Does anyone recognise this situation? One option is for me to have a look at the Smarty source, but i'm simply not that clever, and i'd probably end up making a mess of it!
Thanks again....
Robin