Re: Reserverd words in Smarty 1.3.0??
| From: | Serge Sozonoff | Date: | Mon, 26 Feb 2001 11:54:25 +0000 |
| Subject: | Re: Reserverd words in Smarty 1.3.0?? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-226@lists.php.net to get a copy of this message | ||
Hi Monte,
I am running PHP 4.0.4pl1 on RH Linux 6.2 (kernel 2.2.16) with Apache 1.3.14
and the Zend Optimzer.
register_globals is set to on in php.ini
Serge
-----Original Message-----
From: Monte Ohrt [mailto:monte@ispi.net]
Sent: Sunday, February 25, 2001 22:36
To: Serge Sozonoff
Cc: Smarty (E-mail)
Subject: [smarty] Re: Reserverd words in Smarty 1.3.0??
This doesn't happen for me. ? What version of php are you using? and on
what OS?
Serge Sozonoff wrote:
>
> Hi Monte,
>
> Your example gives me this output:
>
> for ($results}
> Array
>
> and for the section
> {section name=mystuff loop=$results}
> {$mystuff/results}<br>
> {/section}
>
> the output is:
>
> a
> b
> c
>
> Array
>
> Still prints the word array??
>
> Serge
> -----Original Message-----
> From: Monte Ohrt [mailto:monte@ispi.net]
> Sent: Saturday, February 24, 2001 17:27
> To: Serge Sozonoff
> Cc: Smarty (E-mail)
> Subject: [smarty] Re: Reserverd words in Smarty 1.3.0??
>
> Try this:
>
> in your application, assign:
> $smarty->assign("results",array("a","b","c"));
>
> Then in your template, try this:
> {$results}
>
> You should see "Array", correct? Then try looping
>
> {section name=mystuff loop=$results}
> {$mystuff/results}<br>
> {/section}
>
> That should print
> a
> b
> c
>
> Is that what you get, or something else?
>
> Serge Sozonoff wrote:
> >
> > Hi Monte,
> >
> > The only thing that bothers me with this is if I change the word
"results"
> > to something else
> > it works fine with no Array being printed.
> >
> > I also noticed that you have a variable called $results in the Smarty
> class.
> >
> > I have not had a chance to run things through the debugger to see what
> > really happens,
> > but you might like to have a quick check through your code anyway. Try a
> > code snippet for
> > yourself using "results" like:
> >
> > > while ($row_array = $db->FetchNext()) { // fetch rows
> > > $smarty->append("results", $row_array);
> > > }
> >
> > and run it though a {section}
> >
> > Thanks,
> > Serge
> >
> > -----Original Message-----
> > From: Monte Ohrt [mailto:monte@ispi.net]
> > Sent: Friday, February 23, 2001 15:19
> > To: Serge Sozonoff
> > Cc: Smarty (E-mail)
> > Subject: [smarty] Re: Reserverd words in Smarty 1.3.0??
> >
> > There shouldn't be any "reserved" variables that you can't assign. You
> > might write over a previously assigned variable, but that's about it.
> >
> > Try to var_dump($results) to see the data structure are assigning to
> > Smarty. I know that if you assign an array to Smarty and then try to
> > print the array like {$results}, then Smarty will output the word
> > "Array", just like PHP does.
> >
> > Serge Sozonoff wrote:
> > >
> > > Hi Monte and Andrei,
> > >
> > > Is "results" some sort of reserved word in a {section} section?
> > >
> > > I tried doing this in the php file
> > >
> > > while ($row_array = $db->FetchNext()) { // fetch rows
> > > $smarty->append("results", $row_array);
> > > }
> > >
> > > and
> > >
> > > {section name=firsttable loop=$results}
> > > <TR>
> > >
>
<TDWIDTH="150"ALIGN="CENTER">{#TableDetailsFont#}{$firsttable/results.FIL_FI
> LEN
> > AME}</FONT>
> > > </TD>
> > >
>
<TDWIDTH="150"ALIGN="CENTER">{#TableDetailsFont#}{$firsttable/results.FIL_FI
> LEM
> > ODIFIED}</FONT></TD>
> > >
>
<TDWIDTH="150"ALIGN="CENTER">{#TableDetailsFont#}{$firsttable/results.FIL_FI
> LEM
> > ODIFIED}</FONT></TD>
> > > </TR>
> > > {sectionelse}
> > >
> > > in the template and it outputs fine, but amends the word "Array" at
the
> > end
> > > of the page??
> > >
> > > If I change it to "qresults" instead of "results" then the
> > > "Array"
word
> > > dispears in the
> > > output.
> > >
> > > Are there any other "reserved" words like this?
> > >
> > > Thanks, Serge
> > >
> > > ---
> > > You are currently subscribed to smarty as: monte@ispi.net
> > > To unsubscribe send a blank email to
$subst('Email.Unsub')
> > > Visit Smarty's homepage at
> > > http://www.phpinsider.com/php/code/Smarty/
> >
> > --
> > Monte Ohrt <monte@ispi.net>
> > http://www.ispi.net/
> >
> > ---
> > You are currently subscribed to smarty as:
serge.sozonoff@globalbeach.com
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at
> > http://www.phpinsider.com/php/code/Smarty/
> >
> > ---
> > You are currently subscribed to smarty as: monte@ispi.net
> > To unsubscribe send a blank email to $subst('Email.Unsub')
> > Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/
> >
>
> --
> Monte Ohrt <monte@ispi.net>
> http://www.ispi.net/
>
> ---
> You are currently subscribed to smarty as: serge.sozonoff@globalbeach.com
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
>
> ---
> You are currently subscribed to smarty as: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/
---
You are currently subscribed to smarty as: serge.sozonoff@globalbeach.com
To unsubscribe send a blank email to $subst('Email.Unsub')
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/