Sample Integration

Download sample-site-screenshot

This download includes a sample site we built to show how simple it is to use Osmek. All the content on this site is fed and managed by Osmek.

View the sample site in action: http://osmek.com/sample-site

This site includes integration examples of 4 different section modules: a single entry section, a multi entry section in the form of a blog with comments, a photo gallery, and an events section. Look through the code, make comments, and play with the output. If you have any questions, don't hesitate to ask. Contact us through our support site.

This Starter Kit includes:

  • Osmek.php
  • 5 php files: home (index.php), blog roll (blog.php), post (blog_post.php), events (events.php), and photo gallery (photo_gallery.php)
  • a views folder with 9 content templates
  • an assets folder with a style sheet and a shadowbox library.

Code Excerpts

Integration

<?php
    
// Include Osmek.php
    
include('osmek/Osmek.php');
    
    
// Instatiate the Osmek class and provide your API key
    
$osmek = new Osmek('OGxHpAUSbMXaILD5CB4ky1T3zKtnjJVv');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Osmek Starter-Kit</title>
        <link rel="stylesheet" type="text/css" href="assets/css/styles.css" />
    </head>
    <body>

Single Entry

<div id="welcome">    
    <?php
                         
        
// Get welcome template view
        
$template file_get_contents('views/home-welcome.php');
        
        
// Fetch content from Osmek section id 1036.
        
echo $osmek->fetch_template(1036$template); 
        
    
?>
</div>

Sidebar

<div id="sidebar">
                
    <div class="section">
        <h3>Recent Posts</h3>
        <?php
         
            
// Get the recent posts sidebar view
            
$template file_get_contents('views/sidebar-recent-posts.php');
            
            
// Fetch and print template limiting the results to 3 
            
echo $osmek->fetch_template(347$template, array('limit' => 3)); 
            
        
?>
    </div>
    
    <div class="section">
        <h3>Photo Albums</h3>
        <?php
        
            
// Get the sidebar photo albums template
            
$template file_get_contents('views/sidebar-photo-albums.php');
            
            
// Fetch content from Osmek.
            
echo $osmek->fetch_template(350$template, array('limit' => 4)); 
            
        
?>            
        <div class="clearer"></div>    
    </div>
    
    <div class="section">
        <h3>Next Event</h3>
        <?php
        
            
// Get the sidebar events template
            
$template file_get_contents('views/sidebar-events.php');
            
            
// Fetch the next event  
            
echo $osmek->fetch_template(1037$template, array('date_range' => 'future''order_by' => 'date_start asc''limit' => 1)); 
            
        
?>    
        <div class="clearer"></div>    
    </div>
</div>