Re: Smarty problem
| From: | Rob Adams | Date: | Wed, 08 Oct 2003 14:54:40 +0000 |
| Subject: | Re: Smarty problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165450@lists.php.net to get a copy of this message | ||
"Webmaster" <webmaster@dentona.de> wrote in message
news:20031008135716.6675.qmail@pb1.pair.com...
> Hi,
>
> I already posted this question in the Smarty group, without success.
>
> I have a problem with Smarty. I wrote the following function that gets
data
> from a mysql database:
>
> function showHeadlines()
> {
> global $db;
> $entry_events = array();
>
> if ($this->showold == "true")
> {
> $db->select("*", "news", "(d_kategorie =
> 'de_termin')", "d_datum
> ASC", "", "", "");
>
> $entry_events = $db->fetch_array();
>
> $this->assignVars('termineAus', $this->aTrans['termineAus']);
> $this->assignVars('entry_events', $entry_events);
> }
>
> The template part looks like this:
>
> <table width="100%" border="0" cellspacing="0"
> cellpadding="5"
> align="center">
> <tr>
> <td><h2>{$events}</h2></td>
> </tr>
> <tr>
> <td><a
>
> href="{$filenpath}?showold={$showold}"><i>{$termineAus}</i></a></td>
> </tr>
> {section name=i loop=$entry_events}
{foreach} seems to be a better choice to use here. Whenenver I've had
problems with sections, changing them to foreachs usually fixes it.
> <tr>
> <td bgcolor="#e2e2e2"><b>{$entry_events[i].d_datum}
> {$entry_events[i].d_zeit}</b></td>
> </tr>
> <tr>
> <td><b>{$entry_events[i].d_ueberschrift}</b></td>
> </tr>
> <tr>
> <td><b>{$place}:</b> {$entry_events[i].d_ort}</td>
> </tr>
> {/section}
> </table>
>
>
> The problem is that the output in only garbage?
> Is there a logical problem ?
>
> Thank you very much
Welcome.
-- Rob