PHP code example of dorsetdigital / silverstripe-simpleinstagram
1. Go to this page and download the library: Download dorsetdigital/silverstripe-simpleinstagram 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/ */
dorsetdigital / silverstripe-simpleinstagram example snippets
use DorsetDigital\SimpleInstagram\InstagramHelper;
class HomePage extends Page
{
public function getInstagramFeed()
{
$insta = InstagramHelper::create('natgeo');
return $insta->getFeed();
}
}
<% with $InstagramFeed %>
<h2 class="instagram__username">$FullName ($UserName)</h2>
<a href="$Link">
<img src="$ProfileImage" alt="Profile Image"/>
</a>
<p class="instagram__biotext">$Bio</p>
<p class="instagram__stats">Followers: $Followers / Following: $Following</p>
<% loop $Items %>
<div class="instagram__post-holder">
<a href="$Link" target="_blank" title="Link to Instagram post">
<img src="$ThumbURL" alt="$Caption" class="$Type instagram__postimage"/>
<p class="instagram__caption">$Caption</p>
<p class="instagram__likes">Liked: $Likes</p>
<p class="instagram__date">Posted: $Date</p>
</a>
</div>
<% end_loop %>
<% end_with %>