Re: Warning: Illegal offset type in
| From: | Joe Rice | Date: | Mon, 25 Mar 2002 16:32:16 +0000 |
| Subject: | Re: Warning: Illegal offset type in | ||
| References: | 1 2 3 4 5 6 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3333@lists.php.net to get a copy of this message | ||
Hi,
I have just tried chasing down the array.
with no luck, i just redefined the array:
$search_results = array("0" => "joe rice");
$t->assign("RESULTS",$search_results);
echo "<pre>";print_r($search_results);echo "</pre>";
$t->display("searchresults.tpl");
searchresults.tpl now only contains 3 lines:
{section loop=r name=$RESULTS}
{$RESULTS[r]}
{/section}
any help would be greatly appreciated.
the errors now look like (only the line numbers changed):
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 3
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 4
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 5
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 6
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 7
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 7
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 8
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 9
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 9
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 9
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 10
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 15
Warning: Illegal offset type in
/www/love3k.com/dev/templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php
on line 16
and d41d8cd98f00b204e9800998ecf8427e.php looks like:
<?php /* Smarty version 1.5.2, created on 2002-03-25 10:26:03
compiled from searchresults.tpl */ ?>
<?php if (isset($this->_sections[$this->_tpl_vars['RESULTS']]))
unset($this->_sections[$this->_tpl_vars['RESULTS']]);
$this->_sections[$this->_tpl_vars['RESULTS']]['loop'] =
is_array("r") ? count("r") : max(0, (int)"r");
$this->_sections[$this->_tpl_vars['RESULTS']]['name'] =
$this->_tpl_vars['RESULTS'];
$this->_sections[$this->_tpl_vars['RESULTS']]['show'] = true;
$this->_sections[$this->_tpl_vars['RESULTS']]['max'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['loop'];
$this->_sections[$this->_tpl_vars['RESULTS']]['step'] = 1;
$this->_sections[$this->_tpl_vars['RESULTS']]['start'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['step'] > 0 ? 0 : $t
his->_sections[$this->_tpl_vars['RESULTS']]['loop']-1;
if ($this->_sections[$this->_tpl_vars['RESULTS']]['show']) {
$this->_sections[$this->_tpl_vars['RESULTS']]['total'] =
min(ceil(($this->_sections[$this->_tpl_vars['RESULTS']]['step'] > 0 ?
$this->_sections[$this->_tpl_vars['RESULTS']]['loop'] -
$this->_sections[$this->_tpl_vars['RESULTS']]['start'] :
$this->_sections[$this->_tpl_vars['RESULTS']]['start']+1)/abs($this->_sections[$this->_tpl_vars['RESULTS']]['step'])),
$this->_sections[$this->_tpl_vars['RESULTS']]['max']);
if ($this->_sections[$this->_tpl_vars['RESULTS']]['total'] == 0)
$this->_sections[$this->_tpl_vars['RESULTS']]['show'] = false;
} else
$this->_sections[$this->_tpl_vars['RESULTS']]['total'] = 0;
if ($this->_sections[$this->_tpl_vars['RESULTS']]['show']):
for ($this->_sections[$this->_tpl_vars['RESULTS']]['index'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['start'],
$this->_sections[$this->_tpl_vars['RESULTS']]['iteration'] = 1;
$this->_sections[$this->_tpl_vars['RESULTS']]['iteration'] <=
$this->_sections[$this->_tpl_vars['RESULTS']]['total'];
$this->_sections[$this->_tpl_vars['RESULTS']]['index'] +=
$this->_sections[$this->_tpl_vars['RESULTS']]['step'],
$this->_sections[$this->_tpl_vars['RESULTS']]['iteration']++):
$this->_sections[$this->_tpl_vars['RESULTS']]['rownum'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['iteration'];
$this->_sections[$this->_tpl_vars['RESULTS']]['index_prev'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['index'] -
$this->_sections[$this->_tpl_vars['RESULTS']]['step'];
$this->_sections[$this->_tpl_vars['RESULTS']]['index_next'] =
$this->_sections[$this->_tpl_vars['RESULTS']]['index'] +
$this->_sections[$this->_tpl_vars['RESULTS']]['step'];
$this->_sections[$this->_tpl_vars['RESULTS']]['first'] =
($this->_sections[$this->_tpl_vars['RESULTS']]['iteration'] == 1);
$this->_sections[$this->_tpl_vars['RESULTS']]['last'] =
($this->_sections[$this->_tpl_vars['RESULTS']]['iteration'] ==
$this->_sections[$this->_tpl_vars['RESULTS']]['total']);
?>
<?php echo
$this->_tpl_vars['RESULTS'][$this->_sections['r']['index']];
?>
<?php endfor; endif; ?>
thanks again,
joe
Andrei Zmievski(andrei@ispi.net)@Mon, Mar 25, 2002 at 10:05:55AM -0600:
> Not from the template and array you posted...
>
> On Mon, 25 Mar 2002, Joe Rice wrote:
> >
> > okay, drop-in upgrade to 1.5.2, not problems. everything still
> > works but this new template. here is the new error:
> >
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 34
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 35
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 36
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 37
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 38
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 38
> > Warning: Illegal offset type in
> > templates_c/aa/aaefd0306e855334e7c7eb8115934a6f/d41d8cd98f00b204e9800998ecf8427e.php on line 39
> >
> >
> > any ideas?
> >
> > thanks,
> > joe
> >
> > Andrei Zmievski(andrei@ispi.net)@Mon, Mar 25, 2002 at 08:58:53AM -0600:
> > > Is there any way you can upgrade to at least 1.5.2 version?
> > >
> > > On Mon, 25 Mar 2002, Joe Rice wrote:
> > > >
> > > > I think i'm using 1.4.4.
> > > > which has been (and still does) working fine for the rest
> > > > of my site. I just tried to add a new template and a new
> > > > array to loop over and i'm getting this error.
> > > >
> > > > the array looks like:
> > > >
> > > > Array
> > > > (
> > > > [0] => Array
> > > > (
> > > > [uID] => 29
> > > > [userName] => xjicex
> > > > [age] => 78
> > > > [state] => Alabama
> > > > [city] => State of Alabama
> > > > )
> > > >
> > > > [1] => Array
> > > > (
> > > > [uID] => 31
> > > > [userName] => joerice
> > > > [age] => 78
> > > > [state] => Alabama
> > > > [city] => State of Alabama
> > > > )
> > > >
> > > > )
> > > >
> > > > my {section} looks like:
> > > >
> > > > {section loop=r name=$RESULTS}
> > > > {$RESULTS[r].userName}
> > > > {/section}
> > > >
> > > >
> > > >
> > > > thank you for the help.
> > > > joe
> > > >
> > > > Andrei Zmievski(andrei@ispi.net)@Mon, Mar 25, 2002 at 08:26:40AM -0600:
> > > > > What version of Smarty are you using? Seems to be an old one.
> > > > >
> > > > > On Sat, 23 Mar 2002, Joe Rice wrote:
> > > > > >
> > > > > > hi,
> > > > > > I'm getting this warning while trying to
> > > > > > use {section} to loop over an array.
> > > > > >
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 34
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 35
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 36
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 37
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 38
> > > > > > Warning: Illegal offset type in templates_c/searchresults.tpl.php on
> > > > > > line 39
> > > > > > .
> > > > > > .
> > > > > > .
> > > > > > .
> > > > > >
> > > > > > those lines look like:
> > > > > > <?php if
> > > > > > (isset($this->_sections[$this->_tpl_vars['RESULTS']]))
> > > > > > unset($this->_sections[$this->_tpl_vars['RESULTS']]);
> > > > > >
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['loop']
> > > > > > = is_array("r") ? count("r") : max(0, (int)"r");
> > > > > >
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['name']
> > > > > > = $this->_tpl_vars['RESULTS'];
> > > > > >
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['show']
> > > > > > = true;
> > > > > >
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['max']
> > > > > > =
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['loop'];
> > > > > >
> > > > > > $this->_sections[$this->_tpl_vars['RESULTS']]['properties']['step']
> > > > > > = 1;
> > > > > >
> > > > > >
> > > > > > any help would be appreciated.
> > > > > > thanks,
> > > > > > joe
> > > > > >
> > > > > > ---
> > > > > > You are currently subscribed to smarty as: andrei@ispi.net
> > > > > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > > > > Visit Smarty's homepage at
> > > > > > http://www.phpinsider.com/php/code/Smarty/
> > > > >
> > > > >
> > > > >
> > > > > -Andrei
> > > > > * If it ain't broken, it doesn't have enough features yet. *
> > > > >
> > > > > ---
> > > > > You are currently subscribed to smarty as: riceja@water-melon.net
> > > > > To unsubscribe send a blank email to $subst('Email.Unsub')
> > > > > Visit Smarty's homepage at
> > > > > http://www.phpinsider.com/php/code/Smarty/
> > > >
> > > > --
> > > > How do i get rid of those words in my screen that are coming from you?
> > >
> > >
> > >
> > > -Andrei
> > >
> > > Hacker: Any person who derives joy from
> > > discovering ways to circumvent limitations.
> >
> > --
> > How do i get rid of those words in my screen that are coming from you?
>
>
>
> -Andrei
>
> Computer, if you don't open that exit hatch this moment I shall zap straight
> off to your major data banks and reprogram you with a very large axe.
> -- Douglas Adams / The Hitchhiker's Guide to the Galaxy
--
How do i get rid of those words in my screen that are coming from you?