Created
May 10, 2013 15:18
-
-
Save danscotton/5555093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
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
I like #1 - it's more explicit than #3. #2 repeats too much