V
V
viktorross2019-08-04 23:53:38
Smarty
viktorross, 2019-08-04 23:53:38

What's wrong with smarty?

hello, please tell me what the template engine wants, changed places a hundred times, it’s not clear what it needs, the whole log is in this error

[Sun Aug 04 23:45:40 2019] [warn] [client 37.9.113.142] mod_fcgid: stderr: PHP Warning:  Illegal string offset 'caption' in /var/www/site/data/www/site.ru/temp/1c82b67405f5d04eb5d60c2239c882b8f6768404_0.file.details.html.php on line 796

this is the error it shows in the temp folder
<?php $_smarty_tpl->_capture_stack[0][] = array('pb', 'pb', null); ob_start(); ?>pb_<?php echo $_smarty_tpl->tpl_vars['logo']->value['caption'];
list($_capture_buffer, $_capture_assign, $_capture_append) = array_pop($_smarty_tpl->_capture_stack[0]);
if (!empty($_capture_buffer)) {
 if (isset($_capture_assign)) $_smarty_tpl->assign($_capture_assign, ob_get_contents());
 if (isset( $_capture_append)) $_smarty_tpl->append( $_capture_append, ob_get_contents());
 Smarty::$_smarty_vars['capture'][$_capture_buffer]=ob_get_clean();
} else $_smarty_tpl->capture_error();?>
        <?php if ((isset($_smarty_tpl->tpl_vars['listing']->value['user'][$_smarty_tpl->tpl_vars['logo']->value]) && $_smarty_tpl->tpl_vars['listing']->value['user'][$_smarty_tpl->tpl_vars['logo']->value])) {?>
      <div class="mb10"><img style="object-fit:cover;width: 100px;height: 97px;border-radius: 50%;" src="<?php echo $_smarty_tpl->tpl_vars['live_site']->value;?>
/uploads/<?php echo $_smarty_tpl->tpl_vars['logo']->value;?>
/<?php echo $_smarty_tpl->tpl_vars['listing']->value['user'][$_smarty_tpl->tpl_vars['logo']->value];?>
" /></div>
      <?php }?>
      <?php
$_smarty_tpl->tpl_vars['logo'] = $foreach_logo_Sav;
}
?>

this is the template code
{* logo *}
      {foreach $special_user_fields.logo as $logo}
      {capture name=pb assign=pb}pb_{$logo.caption}{/capture}
        {if (isset($listing.user[$logo]) && $listing.user[$logo])}
      <div class="mb10"><img style="object-fit:cover;width: 100px;height: 97px;border-radius: 50%;" src="{$live_site}/uploads/{$logo}/{$listing.user[$logo]}" /></div>
      {/if}
      {/foreach}
    <a href="{if $listing.user.store>0}{if $seo_settings.enable_mod_rewrite}{seo->makeDealerLink p1=$listing.user_id p2=$listing.user[$settings.contact_name_field]}{else}{$live_site}/store.php?id={$listing.user_id}{/if}{else}{if $seo_settings.enable_mod_rewrite}{seo->makeUserListingsLink p1=$listing.user_id p2=$listing.user.url_name}{else}{$live_site}/user_listings.php?id={$listing.user_id}{/if}{/if}">
    {if $listing.user_id}
    {if isset($listing.user[$special_user_fields.contact_name]) && $listing.user[$special_user_fields.contact_name]}{$listing.user[$special_user_fields.contact_name]}{/if} 
    {else}
    {if isset($listing.user.mgm_name) && $listing.user.mgm_name}{$listing.user.mgm_name}{/if} 
    {/if}
    </a>

I don't understand where the error is, can anyone help me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AN, 2019-08-05
@viktorross

viktorross , in this case you are trying to get an array element from a field that is most likely not an array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question