$htmlFile = basename($gameDataFile, '.json') . '.htm';
file_put_contents(
$wwwGameDir . $htmlFile,
- renderGameFile($gameDataFile)
+ renderGameFile($gameDataFile, 'game/' . $htmlFile)
);
}
}
file_put_contents(
$wwwDiscoverDir . $htmlFile,
- renderDiscoverFile($discoverFile)
+ renderDiscoverFile($discoverFile, 'discover/' . $htmlFile)
);
}
file_put_contents(
$wwwDiscoverDir . 'allgames.htm',
- renderAllGamesList(glob($gameDetailsDir . '*.json'))
+ renderAllGamesList(glob($gameDetailsDir . '*.json'), 'discover/allgames.htm')
);
-function renderAllGamesList($detailsFiles)
+function renderAllGamesList($detailsFiles, $path)
{
$games = [];
foreach ($detailsFiles as $gameDataFile) {
$navLinks = [
'./' => 'back',
];
+ $canonicalUrl = $GLOBALS['baseUrl'] . $path;
$allGamesTemplate = __DIR__ . '/../data/templates/allgames.tpl.php';
ob_start();
return $html;
}
-function renderDiscoverFile($discoverFile)
+function renderDiscoverFile($discoverFile, $path)
{
$json = json_decode(file_get_contents($discoverFile));
$title = $json->title . ' OUYA games';
+ $subtitle = $json->stouyapi->subtitle ?? null;
+
$sections = [];
foreach ($json->rows as $row) {
$section = (object) [
$navLinks['./'] = 'discover';
}
+ if ($path === 'discover/index.htm') {
+ $path = 'discover/';
+ }
+ $canonicalUrl = $GLOBALS['baseUrl'] . $path;
+
$discoverTemplate = __DIR__ . '/../data/templates/discover.tpl.php';
ob_start();
include $discoverTemplate;
return $html;
}
-function renderGameFile($gameDataFile)
+function renderGameFile($gameDataFile, $path)
{
$json = json_decode(file_get_contents($gameDataFile));
$apkDownloadUrl = null;
}
*/
+ $developerDetailsUrl = null;
+ if (isset($json->developer->url) && $json->developer->url) {
+ $developerDetailsUrl = '../discover/' . str_replace(
+ 'ouya://launcher/discover/',
+ '',
+ $json->developer->url
+ ) . '.htm';
+ }
$internetArchiveUrl = $json->stouyapi->{'internet-archive'} ?? null;
$developerUrl = $json->stouyapi->{'developer-url'} ?? null;
+ $canonicalUrl = $GLOBALS['baseUrl'] . $path;
$pushUrl = $GLOBALS['pushToMyOuyaUrl']
. '?game=' . urlencode($json->apk->package);