Viewing 1 replies (of 1 total)
  • Plugin Author thaikolja

    (@thaikolja)

    Hi there,

    I’ve tested the plugin on my WordPress installations and everything runs fine. All information are in the array and none is wrongly formatted.

    But I do have a guess why you can’t display language, country and writers. It’s because they don’t return a string, but an array because some movies have more than one country/language/… Because of that, the array keys that result an array are written in plural. “country” changes to “countries”, “language” to “languages” and so on. You can see the official documentation for a full list of available array keys:

    http://www.koljanolte.com/wordpress/plugins/imdb-connector/#PHP-Functions

    Here’s one example on how to display the language:

    <?php
       $imdb_id = "tt3733778";
       $movie   = imdb_connector_get_movie($imdb_id);
       echo "Language: " . $movie["languages"][0];
    ?>

    Regarding the runtime:

    You can display a move’s runtime in three different formats: In minutes, in hours and minutes or as a timestamp. The timestamp allows you to use it in the date($format, $timestamp) function where you can define a custom output (click here to see some more information about the date() function).

    Let me give you an example for all three types:

    1. For minutes:

    $imdb_id         = "tt3733778";
       $movie           = imdb_connector_get_movie($imdb_id);
       $runtime_minutes = $movie["runtime"]["minutes"];
    
       echo "The movie's runtime is $runtime_minutes minutes.";

    2. For hours and minutes:

    $imdb_id         = "tt3733778";
       $movie           = imdb_connector_get_movie($imdb_id);
       $runtime_minutes = $movie["runtime"]["hours"];
    
       echo "The movie's runtime is $runtime_minutes.";

    3. With a timestamp:

    $imdb_id         = "tt3733778";
       $movie           = imdb_connector_get_movie($imdb_id);
       $runtime_minutes = $movie["runtime"]["hours"];
       $timestamp       = $movie["runtime"]["timestamp"];
       $time            = date("H:i:s", $timestamp);
    
       echo "The total movie runtime is $time.";

    And here is the whole array structure of the example movie you have used so that you can see that all information is actually inside:

    http://pastebin.com/rb5rgSbC

    I hope this helps. If not, please report back.

Viewing 1 replies (of 1 total)
  • The topic ‘Error with the Language, Country, time and stars’ is closed to new replies.