Skip to content

Instantly share code, notes, and snippets.

@veryrobert
Created October 18, 2015 12:16
Show Gist options
  • Save veryrobert/b0dae664bfe0e6dacf01 to your computer and use it in GitHub Desktop.
Save veryrobert/b0dae664bfe0e6dacf01 to your computer and use it in GitHub Desktop.

Revisions

  1. Robert Farrelly created this gist Oct 18, 2015.
    12 changes: 12 additions & 0 deletions Kirby Structure Field with Images
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    // Using Kirby structure field with a selection field inside for images

    <?php foreach($page->structureName()->yaml() as $name) {

    $title = $name['fieldNameText'];
    $image = $name['fieldNameImage'];
    $imageUrl = $page->file($image)->url();
    echo html('<h1>'.$title.'</h1><img src="'.$imageUrl.'" alt="'.$title.'">');

    }

    ?>