Jump to content

Template error when I use variables in lang tags


goldmorphin

Recommended Posts

Hello! I have weird problem with this code:

{{foreach $user['general'] as $key => $array}}

<h3 class="ipsType_sectionHead ipsSpacer_bottom ipsSpacer_half">{lang="api_{$key}"}</h3>

<table class="ipsTable">
  <tr>
    <th>Name</th>
    <th>Description</th>
  </tr>
  {{foreach $array as $param => $value}}
  <tr>
    <td>
      <code>{$param}</code>
    </td>
    <td>{$value}</td>
  </tr>
  {{endforeach}}
</table>
{{endforeach}}

when I'm try to use {lang="api_{$val}"} - its working for <h3> element and I see translated text, but next foreach doesn't work and all rows is empty.

But when I put something like:

<h3 class="ipsType_sectionHead ipsSpacer_bottom ipsSpacer_half">{$val}</h3>

all code in template is working fine. Why it's happening? What I'm doing wrong?

Link to comment
Share on other sites

I'd first check your data structure you're looping through. I'm doing something almost exactly the same, and it works without issue. 

{{foreach $member->bf4 as $plat => $data}}
				<li class="ipsMenu_item">
					<a href="{url='...' csrf='true'}">
						<span>{lang="bf4_{$plat}"}: {datetime="$data->last_update" short="TRUE"}</span>
					</a>
				</li>
				{{endforeach}}

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...