2017 © Pedro PelĂĄez
 

library simple-youtube-embed-manager

Easy way to integrate youtube videos in your site

image

ishaq/simple-youtube-embed-manager

Easy way to integrate youtube videos in your site

  • Friday, August 14, 2015
  • by ishaq
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple-Youtube-Embed-Manager

Easy way to embed youtube videos in your site. All you have to do is just insert youtube video id with video title and description and voilĂ ! video will be up on your site., (*1)

Installation Instructions

Notice: You need to have CForm and CDatabase installed in order to use this module. - First you need to have a copy of [Anax-MVC][1]. - Drag and drop "app" and "src" folder to your Anax-copy. - Make new frontcontroller in webroot folder and insert the lines:, (*2)

// Create services and inject into the app. 
$di = new \Anax\DI\CDIFactoryDefault();

$di->setShared('db', function() {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
    $db->connect();
    return $db;
});

$di->set('YoutubeController', function() use ($di) {
    $controller = new \Ishaq\Youtube\YoutubeController();
    $controller->setDI($di);
    return $controller;
});

$app = new \Anax\Kernel\CAnax($di);
$di->set('form', '\Mos\HTMLForm\CForm');
$app->session;


// Get navbar
$app->navbar->configure(ANAX_APP_PATH . 'config/navbar_youtube.php');

// Routes
$app->router->add('', function() use ($app) {

    $app->theme->setTitle("Youtube");

    $app->views->add('youtube/page', [
        'content' => "<h1 style='border: 0;'>Welcome to the Youtube Videos database!</h1>",
    ]);

});

$app->router->add('setup', function() use ($app) {

    $app->theme->setTitle("Setup Videos");

    $app->db->dropTableIfExists('youtube')->execute();

    $app->db->createTable(
        'youtube',
        [
            'id' => ['integer', 'primary key', 'not null', 'auto_increment'],
            'title' => ['varchar(80)','not null'],
            'ytid' => ['varchar(80)','not null'],
            'description' => ['varchar(255)','not null'],
            'created' => ['datetime'],
        ]
    )->execute();


    // insert Two test videos
    $app->db->insert(
        'youtube',
        ['title', 'ytid', 'description','created']
    );

    $now = date("Y-m-d h:i:s");

    $app->db->execute([
        'Zlatan Ibrahimovic - Craziest Skills Ever - Impossible Goals',
        'ln35qLphK4I',
        'Music : What So Not - Touched _Slumberjack Edit',
        $now
    ]);

    $app->db->execute([
        'Avicii - The Nights',
        'UtF6Jej8yb4',
        'The Nights" is a song by Swedish DJ and music producer Avicii.',
        $now
    ]);
    $app->db->execute([
        'Shakira - Waka Waka',
        'pRpeEdMmmQ0',
        '"Waka Waka (This Time for Africa)" (Spanish: "Waka Waka (Esto es África)") is a song by Colombian singer-songwriter Shakira featuring South African band Freshlyground',
        $now
    ]);

    $url = $app->url->create('youtube/videos');

    $app->response->redirect($url);
});

That's it! you can access youtube module on www.yoursite.com/webroot/yourfrontcontroller.php, (*3)

DEMO

http://www.student.bth.se/~isjc13/phpmvc/kmom05/webroot/youtube.php/youtube/videos, (*4)

The Versions

14/08 2015

dev-master

9999999-dev http://dbwebb.se

Easy way to integrate youtube videos in your site

  Sources   Download

MIT

The Requires

  • php >=5.4

 

mvc manager anax youtube education embed anax-mvc