PHP code example of getolympus / olympus-file-field

1. Go to this page and download the library: Download getolympus/olympus-file-field library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

getolympus / olympus-file-field example snippets


return \GetOlympus\Dionysos\Field\Content::build(false, [
    'title'   => 'The Dark Knight',
    'content' => '',
    'debug'   => false,
    'file'    => 'im_the_batman.php',
    'vars'    => [
        'question' => 'Who\'s the Batman?',
        'answers'  => [
            'the-joker'    => 'The Joker',
            'harley-quinn' => 'Harley Quinn',
            'bruce-wayne'  => 'Bruce Wayne, don\'t tell anybody!',
            'gotham-city'  => 'Gotham City',
        ],
    ],
]);

// Display question
echo '<h2>'.stripslashes($v['question']).'</h2>';
echo '<ul>';

// Display answers choices with radio button
foreach ($v['answers'] as $k => $answer) {
    echo '<li class="'.$k.' is-the-batman">'.stripslashes($answer).'</li>';
}

echo '</ul>';