src/Template.php
public static function render() {
		$apiMode = Request::isAPI();

		if(self::$twig === null)
			self::initialize();

		$data = Request::getAllData();
		if(!$apiMode) {
			$data["siteName"]  = Configuration::get("dachi.siteName", "Unnamed Dachi Installation");
			$data["timezone"]  = Configuration::get("dachi.timezone", "Europe/London");
			$data["domain"]    = Configuration::get("dachi.domain", "localhost");
			$data["baseURL"]   = Configuration::get("dachi.baseURL", "/");
			$data["assetsURL"] = str_replace("%v", Kernel::getGitHash(), Configuration::get("dachi.assetsURL", "/build/"));
			$data["renderTPL"] = self::getRenderTemplate();
			$data["URI"]       = Request::getFullUri();
		}

		if($apiMode) {
			$response = array(
				"data"           => $data,
				"response"       => Request::getResponseCode()
			);
			return json_echo($response);
		} else if(Request::isAjax()) {
			$response = array(
				"render_tpl"     => self::getRenderTemplate(),
				"data"           => $data,
				"response"       => Request::getResponseCode(),
				"render_actions" => self::$render_actions
			);

			return json_echo($response);
		} else {
			$data["response"] = Request::getResponseCode();

			$response = self::$twig->render(self::getRenderTemplate(true), $data);

			foreach(array_reverse(self::$render_actions) as $action) {
				switch($action["type"]) {
					case "redirect":
						if($action["soft"] !== true)
							header("Location: " . $action["location"]);
						break;
					case "display_tpl":
						$match = preg_match("/<dachi-ui-block id=[\"']" . preg_quote($action["target_id"]) . "[\"'][^>]*>([\s\S]*)<\/dachi-ui-block>/U", $response, $matches);
						if($match) {
							$replacement = "<dachi-ui-block id='" . $action["target_id"] . "'>" . self::$twig->render($action["template"] . '.twig', $data) . "</dachi-ui-block>";
							$response = str_replace($matches[0], $replacement, $response);
						}
						break;
				}
			}

			echo $response;
		}
	}
public static function render() {
		$apiMode = Request::isAPI();

		if(self::$twig === null)
			self::initialize();

		$data = Request::getAllData();
		if(!$apiMode) {
			$data["siteName"]  = Configuration::get("dachi.siteName", "Unnamed Dachi Installation");
			$data["timezone"]  = Configuration::get("dachi.timezone", "Europe/London");
			$data["domain"]    = Configuration::get("dachi.domain", "localhost");
			$data["baseURL"]   = Configuration::get("dachi.baseURL", "/");
			$data["assetsURL"] = str_replace("%v", Kernel::getGitHash(), Configuration::get("dachi.assetsURL", "/build/"));
			$data["renderTPL"] = self::getRenderTemplate();
			$data["URI"]       = Request::getFullUri();
		}

		if($apiMode) {
			$response = array(
				"data"           => $data,
				"response"       => Request::getResponseCode()
			);
			return json_echo($response);
		} else if(Request::isAjax()) {
			$response = array(
				"render_tpl"     => self::getRenderTemplate(),
				"data"           => $data,
				"response"       => Request::getResponseCode(),
				"render_actions" => self::$render_actions
			);

			return json_echo($response);
		} else {
			$data["response"] = Request::getResponseCode();

			$response = self::$twig->render(self::getRenderTemplate(true), $data);

			foreach(array_reverse(self::$render_actions) as $action) {
				switch($action["type"]) {
					case "redirect":
						if($action["soft"] !== true)
							header("Location: " . $action["location"]);
						break;
					case "display_tpl":
						$match = preg_match("/<dachi-ui-block id=[\"']" . preg_quote($action["target_id"]) . "[\"'][^>]*>([\s\S]*)<\/dachi-ui-block>/U", $response, $matches);
						if($match) {
							$replacement = "<dachi-ui-block id='" . $action["target_id"] . "'>" . self::$twig->render($action["template"] . '.twig', $data) . "</dachi-ui-block>";
							$response = str_replace($matches[0], $replacement, $response);
						}
						break;
				}
			}

			echo $response;
		}
	}
public static function render ( ) { $ apiMode = Request :: isAPI ( ) ; if ( self :: $ twig === null ) self :: initialize ( ) ; $ data = Request :: getAllData ( ) ; if ( ! $ apiMode ) { $ data [ "siteName" ] = Configuration :: get ( "dachi.siteName" , "Unnamed Dachi Installation" ) ; $ data [ "timezone" ] = Configuration :: get ( "dachi.timezone" , "Europe/London" ) ; $ data [ "domain" ] = Configuration :: get ( "dachi.domain" , "localhost" ) ; $ data [ "baseURL" ] = Configuration :: get ( "dachi.baseURL" , "/" ) ; $ data [ "assetsURL" ] = str_replace ( "%v" , Kernel :: getGitHash ( ) , Configuration :: get ( "dachi.assetsURL" , "/build/" ) ) ; $ data [ "renderTPL" ] = self :: getRenderTemplate ( ) ; $ data [ "URI" ] = Request :: getFullUri ( ) ; } if ( $ apiMode ) { $ response = array ( "data" => $ data , "response" => Request :: getResponseCode ( ) ) ; return json_echo ( $ response ) ; } else if ( Request :: isAjax ( ) ) { $ response = array ( "render_tpl" => self :: getRenderTemplate ( ) , "data" => $ data , "response" => Request :: getResponseCode ( ) , "render_actions" => self :: $ render_actions ) ; return json_echo ( $ response ) ; } else { $ data [ "response" ] = Request :: getResponseCode ( ) ; $ response = self :: $ twig -> render ( self :: getRenderTemplate ( true ) , $ data ) ; foreach ( array_reverse ( self :: $ render_actions ) as $ action ) { switch ( $ action [ "type" ] ) { case "redirect" : if ( $ action [ "soft" ] !== true ) header ( "Location: " . $ action [ "location" ] ) ; break ; case "display_tpl" : $ match = preg_match ( "/<dachi-ui-block id=[\"']" . preg_quote ( $ action [ "target_id" ] ) . "[\"'][^>]*>([\s\S]*)<\/dachi-ui-block>/U" , $ response , $ matches ) ; if ( $ match ) { $ replacement = "<dachi-ui-block id='" . $ action [ "target_id" ] . "'>" . self :: $ twig -> render ( $ action [ "template" ] . '.twig' , $ data ) . "</dachi-ui-block>" ; $ response = str_replace ( $ matches [ 0 ] , $ replacement , $ response ) ; } break ; } } echo $ response ; } }
Render the render queue to the browser

If the request is an ajax request, the render queue and data will be sent to the browser via JSON.
If the request is a standard request, the render queue will be rendered server-side and will be sent to the browser via HTML.

@internal
@see Router
@return null
Render the render queue to the browser