Support the ongoing development of Laravel.io →
posted 9 years ago
Views
Last updated 2 years ago.
0

Give us a var_dump of that $variable.

0

Example:

 $view->with('test',array('one','two','three','four','five'));
var_dump($test)

array(5) { [0]=> string(3) "one" [1]=> string(3) "two" [2]=> string(5) "three" [3]=> string(4) "four" [4]=> string(4) "five" }
<? foreach ($test as $t) {
    ?>
    <?= $t ?>
<? } ?>

only succeeds on a local environment:

one two three four five

Laravel Forge:

Undefined variable: t

Last updated 9 years ago.
0

And what is the definition of that $view?

0
$view = View::make('home/index');
0

and at the end of the controller, just:

return $view;
0

Check this: http://php.net/manual/en/language.basic-syntax.phptags.php

Check if you have the short open tags option enabled, although it's recommended that you use the normal tags for those cases when you don't have access to php configuration: <?php ?>

0

I feel ashamed that I didn't notice it myself :)

Problem solved. It is indeed a bad habit to use the short tags.

Thanks

0

Sign in to participate in this thread!

Eventy

Your banner here too?

thiver thiver Joined 11 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.