Skip to content

Instantly share code, notes, and snippets.

@timohausmann
Created July 23, 2013 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timohausmann/6061546 to your computer and use it in GitHub Desktop.
Save timohausmann/6061546 to your computer and use it in GitHub Desktop.
Algorithm: li article article li
<?php
$length = count( $items );
foreach( $items as $i => $item ) {
if( $i % 2 == 0 ) echo '<li>';
echo '<article> ... </article>';
if( $length-1 == $i || ($i+1) % 2 == 0 ) echo '</li>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment