PHP code example of justinholtweb / craft-tokr

1. Go to this page and download the library: Download justinholtweb/craft-tokr 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/ */

    

justinholtweb / craft-tokr example snippets




return [
    'clientKey' => '$TIKTOK_CLIENT_KEY',
    'clientSecret' => '$TIKTOK_CLIENT_SECRET',
    'refreshInterval' => 3600,
    'refreshOnRequest' => true,
    'videosPerRefresh' => 40,
    'keepRemovedVideos' => false,
    '
twig
{% set feed = craft.tokr.feed('homepage') %}
{% set account = feed.account %}

<h2>{{ account.displayName }} — {{ account.followerCount|number }} followers</h2>

<ul>
    {% for video in feed.videos %}
        <li>
            <a href="{{ video.url }}">
                <img src="{{ video.coverImageUrl }}" alt="{{ video.caption }}">
            </a>
            <p>{{ video.captionHtml }}</p>
            <p>{{ video.likeCount|number }} likes · {{ video.durationFormatted }}</p>
        </li>
    {% endfor %}
</ul>
sh
*/30 * * * * cd /path/to/project && php craft tokr/refresh