Welcome Guest, Not a member yet? Register   Sign In
data and views - this is frying my brain.
#1

[eluser]ironlung[/eluser]
Hi I'm obviously missing something painfully obvious but why isn't my $langs variable appearing in my view?

The controller
Code:
$fred['langs'] = $languages;
  echo print_r($fred);

  $this->template->write_view('toolbar', 'language_bar_view', $fred, FALSE);

The View

Code:
<ul>
&lt;? echo print_r($langs); ?&gt;
&lt;?= "hello";?&gt;
&lt;? foreach $langs as $lang : ?&gt;
<li>&lt;?//=anchor($lang['uri'], $lang['language_code']) ?&gt;</li>
&lt;? endforeach ?&gt;
</ul>


The output

Code:
Array ( [langs] => Array ( [0] => Array ( [language_code] => en [uri] => en/home ) [1] => Array ( [language_code] => es [uri] => es/home ) ) ) 1
Email/Username:  
Password:  
Remember Me:  

hello


The print_r($fred) looks good to me. Am I going crazy? Where is my $langs?
#2

[eluser]ironlung[/eluser]
You will not believe it short tags were not enabled :/
#3

[eluser]InsiteFX[/eluser]
That's why they tell you to use the full php tags now.




Theme © iAndrew 2016 - Forum software by © MyBB