/ CDK / Overview / Home

Home

Overview

This SDK provides everything to make a content configurable inside the Adways studio.



A content can be set up with variables like number, string, time, color, select list…

Step by step example

CDK call:

Using composer, require in your composer.json

"repositories": [{
    "type":"git",
    "url":"https://github.com/AdwaysDev/CDK.git"
}],
"require": {
    "adways-cdk": "dev-master"
}

Direct download zip file: https://github.com/AdwaysDev/CDK/archive/master.zip

Initialising CDK in your content:

Pre-requisite: Before using CDK you must call composer's autoload.
If you are using directly zip file you must call each PHP class files you use.

// Composer autoload call
require_once( __DIR__ .'/../vendor/autoload.php');
use Adways\Content\Template;
// Must declare the new Template with your api_key, api_secret.
$template = new Template(array(
    'key' => 'adways_key',
    'secret' => 'adways_secret'
));

With this code the Content Developpment Kit is initialized.

Be carefull, if you give bad key and secret you will be not able to use the entire CDK.

You need to get clicks and roll-over within your content:

Enabling this option require to use the AdwaysLib.js library to instanciate communication between your content and Adways Interactive Video library.
You can find the documentation about this library HERE. eg: in order to establish a commincation between a content and the interactive video engine.

// Content will get clicks and roll-over.
$template->setRequireUserInput(true);

Default: This parameter is false. There is an overlay over your enrichment which will catch users actions and click.
This overlay allows Adways library to natively works with hotspots and fire linked actions (such as: open an enrichment, play/pause/seek on video, open links...)

Use properties to create variables within Adways Studio.

This exemple will create a dynamic "String" property allowing user studio to configure his content.

You must declare the following property in your class use calls.

use Adways\Property\String;
use Adways\Property\Representations;

In your content, after the "new Template(...)" call.
Following code create the property.

$content_text = new String('content_text', 'Content text', '', Representations::_DEFAULT, 'Your default text');

This code declare the property but this property must be "linked" to the "template". If not, this property is not shown within Adways Studio.
To add this property within the studio, you must retrieve the "tab" where you want to display it.

You must declare Categories in you class use calls.

use Adways\Property\Categories;    

Then you can link your property to any Category tab. Following exemple will display it in "Content" tab.

// Retrieve the Content tab pannel.
$contentTab = $template->getNodeSet(Categories::CONTENT);
// Adding a property to this tab
$contentTab->addProperty($content_text);

Now this property will appear within the Content tab in Adways Studio when the user will configure his content.


To use this property later in your content page you must call:

// Retrieve the value given by Adways studio user
// If no value has been set, getValue will return the given defaultValue
$content_text->getValue();

Full exemple of use.

Following code will create an enrichment, which simply create a String property, allow user to define it in Adways Studio and display this string in the content.
Be carefull: This exemple is not responsive and will appear differently on runtime, regarding the rendered video size.

<?php
    // Composer autoload call
    require_once( __DIR__ .'/../vendor/autoload.php');
    use Adways\Content\PTemplate;
    use Adways\Property\String;
    use Adways\Property\Representations;
    use Adways\Property\Categories;
    // Must declare the new Template with your api_key, api_secret.
    $template = new Template(array(
        'key' => 'adways_key',
        'secret' => 'adways_secret'
    ));
    $content_text = new String('content_text', 'Content text', '', Representations::_DEFAULT, 'Your default text');
    // Retrieve the Content tab pannel.
    $contentTab = $template->getNodeSet(Categories::CONTENT);
    // Adding a property to this tab
    $contentTab->addProperty($content_text);
?>
<!DOCTYPE html>
<html lang="fr" dir="ltr">
    <head>
    </head>
    <body>
        <h3><?php echo $content_text->getValue(); ?></h3>
    </body>
</html>