single-entry

Available Keywords

  • id
  • title
  • description
  • date

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>Single Entry</title>
    </head>
    <body>
        <h2>Entry</h2>
    
        <div id="entry">
            
            <? $item $osmek->fetch_vars(section_id, array('title''description'), array('limit' => 1)); ?>        
            
            <h3 class="title"><?=$item['title']?></h3>
            <div class="description"><?=$item['description']?></div>
        </div>
    </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, an array of variables we need, and an array to limit the items returned to one. Although we do not need to limit fetch_vars(), its good coding practice to limit the results if we are expecting a fixed number of items. The fetch_vars() function returns an array that we assign to the variable $item. Finally we echo the title and description keys from the $item array.