multi-entry

PHP Example

<?
    
require_once('Osmek.php');
    
$osmek = new Osmek('myapikey1234567890');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Multi Entry</title>
    </head>
    <body>
        <h2>Entries</h2>
            <? $items $osmek->fetch_vars(section_id, array('id','title''description')); ?>    
            <? foreach($items as $item): ?>
                <div class="entries" id="entry<?=$item['id']?>">
                    <h3 class="title"><?=$item['title']?></h3>
                    <div class="description"><?=$item['description']?></div>
                </div>
            <? endforeach; ?>
    </body>
</html>

First we instantiate a new Osmek class and name it $osmek. Then we call osmek.php's fetch_vars(), which includes the section id of the osmek section requested and an array of variables we need. The fetch_vars() function returns a multi-demential array that we assign to the variable $items. Finally we loop through each entry in the $items array to echo the data. Notice we used each entry's Osmek id to give their div wrapper a unique id. This is useful when adding javascript functionality.