Skip to content

Instantly share code, notes, and snippets.

@fabriziomachado
Created August 5, 2011 17:31
Show Gist options
  • Save fabriziomachado/1128050 to your computer and use it in GitHub Desktop.
Save fabriziomachado/1128050 to your computer and use it in GitHub Desktop.
application/views/peoples/index.php
## conteúdo da view index.php
<h2>application::views::welcome::show</h2>
<h1>Rendering a partials with locals</h1>
<!-- inclui uma partial sem loop, apenas passando variaveis locais -->
<?= render_partial('people/_list_people.php', $locals_vars ); ?>
<h1>Rendering a collection of partials</h1>
<!-- passando uma collection o conteúdo da partial é inserida a cada linha do loop -->
<?= render_partial('people/_people.php',
$locals_vars,
$people ); ?>
## conteúdo da partial _peoples.php
<? if($say_hello) ?> Hello, <?= $people->name ?> (<?= $people_counter ?>) <br/>
## conteúdo da partial _list_people.php
<? foreach($people as $person): ?>
<?= $say_hello ?>, <?= $person->name ?> <br />
<? endforeach; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment