diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-12-02 00:25:50 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-12-02 00:25:50 +0100 |
commit | 09915b726ee9bc9896654b7bc832f068b9c3b013 (patch) | |
tree | bcd92ac7858d57faaf22e53cbbebf2a4f1902e7e /index.php | |
parent | 4173577f3f5ebfdc48727cd6065b5de5ac6c4383 (diff) |
moved print out to function
Diffstat (limited to '')
-rw-r--r-- | index.php | 55 |
1 files changed, 22 insertions, 33 deletions
@@ -32,6 +32,26 @@ foreach ($storiesDirContent as $storyName) { $currentStoryName = visibleName($currentStory); +function printEntities($entities) { + foreach ($entities as $entity=>$description) { + $name = visibleName($entity); + <!-- <?=$name;?> --> + <div class="row"> + <div class="col-md-7 text-center"> + <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="stories/<?=urlencode($entity)?>/<?=urlencode($entity);?>/passphoto.png" alt="<?=$name;?>" title="<?=$name;?>"> + </div> + <div class="col-md-5"> + <h3><?=$name;?></h3> + <p class="figure-desc"><?=$description;?></p> + </div> + </div> + <!-- /.row --> + + <hr> + <?php + } +} + ?> <!DOCTYPE html> <html lang="de"> @@ -93,40 +113,9 @@ $currentStoryName = visibleName($currentStory); </div> </div> <?php - foreach ($characters as $character=>$characterDescription) { - $characterName = visibleName($character); - ?> - <!-- <?=$characterName;?> --> - <div class="row"> - <div class="col-md-7 text-center"> - <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="stories/<?=urlencode($currentStory)?>/<?=urlencode($character);?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>"> - </div> - <div class="col-md-5"> - <h3><?=$characterName;?></h3> - <p class="figure-desc"><?=$characterDescription;?></p> - </div> - </div> - <!-- /.row --> - - <hr> - <?php - } + printEntities($characters); } else { - foreach ($stories as $story=>$storyDescription) { - $storyName = visibleName($story); -?> - <div class="row"> - <div class="col-md-7 text-center"> - <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($story);?>/logo.png" alt="<?=$storyName;?>" title="<?=$storyName;?>"> - </div> - <div class="col-md-5"> - <h3><?=$storyName;?></h3> - <p class="figure-desc"><?=$storyDescription;?></p> - </div> - </div> - </div> -<? - } + printEntities(stories); } ?> </div> |