//HTML Template for the user-specific part on the website $userTemplate = new Template("www/templates/loggedin_template.html"); //Give the template the possibility to use the UserAuthentification class. $userTemplate->setVar("UserAuthentification", $userAuth); //Array mapping a champion name to its icon. Array ( ["ChampionName"] => "Icon", ["ChampionName2"] => "Icon2" ) $champJson = cURL("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?champData=image&api_key=" . $apiKey); $championData = parseChampJSON($champJson, array("Champion" => new ArrayObject(array("img" => "www/any.png", "name" => "Any Champion", "key" => "Champion"), ArrayObject::ARRAY_AS_PROPS))); //$spellData = parseSpellJSON(cURL("https://global.api.pvp.net/api/lol/static-data/euw/v1.2/summoner-spell?spellData=image,key&api_key=" . $apiKey)); //Get all those items... $itemdata = recursiveArrayObject(collapseResultArray2($database->query("SELECT i.ID AS ItemID, i.Gold, i.Name AS ItemName, i.Description, ibi.BuildsIntoID, ibf.BuildsFromID, it.Tag FROM `Items` i LEFT JOIN `ItemBuildsFrom` ibf ON i.ID = ibf.ItemID LEFT JOIN `ItemBuildsInto` ibi ON i.ID = ibi.ItemID LEFT JOIN `ItemTags` it ON i.ID = it.ItemID"), true, true, true), ArrayObject::ARRAY_AS_PROPS); $headerTemplate = new Template("www/templates/header_template.html"); $headerTemplate->setVar("UserTemplate", $userTemplate); $headerTemplate->setVar("buttons", array(new ArrayObject(array("name" => "Home", "href" => "index.php"), ArrayObject::ARRAY_AS_PROPS), new ArrayObject(array("name" => "My Sets", "href" => "mysets.php"), ArrayObject::ARRAY_AS_PROPS))); //And then, printerino! $csTemplate = new Template("www/templates/createset_template.html"); $csTemplate->setVar("ChampionData", $championData); $csTemplate->setVar("ItemSet", $itemset); //$csTemplate->setVar("SpellData", $spellData); $csTemplate->setVar("Items", $itemdata); $csTemplate->setVar("i", 1); $csTemplate->setVar("TypusMaximusWaddafakius", $type); $csTemplate->setVar("ChampionData", $championData); $footerTemplate = new Template("www/templates/footer_template.html"); $userTemplate->prepare(); $headerTemplate->prepare(); $csTemplate->prepare(); $footerTemplate->prepare(); echo $headerTemplate->printTemplate(); echo $csTemplate->printTemplate(); echo $footerTemplate->printTemplate();
<?php if (isset($_GET['js'])) { $jsFileName = $_GET['js']; include 'class/template.class.php'; include 'include/functions.inc.php'; $language = setLanguage(array('en', 'de')); $js = new Template(); $js->setFolder('js/'); $js->setFileExtension('.js'); $js->readTpl($jsFileName); $js->tplReplace('lang', $language); $js->translateTemplate(); $js->printTemplate(); }