<?php require_once "res/include.php"; echo GBApi::search('metroid prime', GBSearchType::Game, ['id', 'name', 'original_release_date', 'image', 'api_detail_url']);
<?php $serviceContainer = \Propel\Runtime\Propel::getServiceContainer(); $serviceContainer->checkVersion('2.0.0-dev'); $serviceContainer->setAdapterClass('default', 'mysql'); $manager = new \Propel\Runtime\Connection\ConnectionManagerSingle(); $manager->setConfiguration(array('dsn' => 'mysql:host=localhost;dbname=pcmratings', 'user' => 'pcmratings', 'password' => '', 'settings' => array('charset' => 'utf8', 'queries' => array()), 'classname' => '\\Propel\\Runtime\\Connection\\ConnectionWrapper')); $manager->setName('default'); $serviceContainer->setConnectionManager('default', $manager); $serviceContainer->setDefaultDatasource('default'); //GB apikey - if you need one, ask or get your own from GB. GBApi::setApiKey(''); //RedditAuth RedditAuth::setClientId(''); //public client id, accessible from your reddit API developer page RedditAuth::setClientSecret(''); //private "secret", accessible from your reddit API developer page RedditAuth::setRedirectUrl(''); //set this to http://[your host]/index.php e.g. http://pcmr.darkholme.net/index.php
<link rel='stylesheet' href='/css/index.css'> <?php include 'res/head.php'; ?> <title>PC Masterratings</title> </head> <body> <?php include 'res/nav.php'; //if is post if (isset($_POST['btnSearch'])) { $games = []; $limit = 10; try { $games = GBApi::searchForGames($_POST['txtSearch'], $limit); } catch (GBApiException $e) { //VERY rudimentary error handling - change this!! echo '<h3>', $e, '<h3>'; exit; } $cols = 3; //change to whatever, but you'll have to mess with bootstrap classes to make it display properly $rows = ceil(count($games) / $cols); //Try to generate search results //This is a gross way of generating html echo "<h1>Results</h1>\n <div class='container'>"; for ($i = 0; $i < $rows; $i++) { echo "<div class='row'>"; for ($k = 0; $k < $cols; $k++) { $index = $cols * $i + $k;
public static function setApiKey($key) { if (!isset(GBApi::$apikey)) { GBApi::$apikey = $key; } }