Skip to content

Instantly share code, notes, and snippets.

@danscotton
Created May 10, 2013 15:18
Show Gist options
  • Save danscotton/5555093 to your computer and use it in GitHub Desktop.
Save danscotton/5555093 to your computer and use it in GitHub Desktop.
<div class="correspondent__stories" <?= $this->hasNext ? 'data-next="'.$this->nextLink.'"' : '' ?>>
<? foreach($this->stories as $story): ?>
<h2><?= $story['headline'] ?></h2>
<? endforeach; ?>
</div>
<? if($this->hasNext): ?>
<div class="correspondent__stories" data-next="<?= $this->nextLink ?>">
<? else: ?>
<div class="correspondent__stories">
<? endif; ?>
<? foreach($this->stories as $story): ?>
<h2><?= $story['headline'] ?></h2>
<? endforeach; ?>
</div>
<div class="correspondent__stories" <?= $this->extraAttributes ?>>
<? foreach($this->stories as $story): ?>
<h2><?= $story['headline'] ?></h2>
<? endforeach; ?>
</div>
@jcleveley-zz
Copy link

I like #1 - it's more explicit than #3. #2 repeats too much

@jaikdean
Copy link

My vote's for #1 too.
#2 has confusing indentation, repeated content and will end up very messy if other attributes are needed.
#3 doesn't make it obvious what the output will be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment