final public function display($name=NULL) {

		$this->render();
		
		// look for css files
		if (is_dir($this->modulePath . '/css')) {
			
			// get all folder files
			$files = Utilities::getDirectoryFilenames($this->modulePath . '/css');
			
			// load files as script and add timestamp to ignore browser caching
			foreach ($files as $file) {
				$fullPath = $this->moduleUrl . '/css/' . $file;
				$this->app->loadCss($fullPath . '?' . filemtime($fullPath));
			}
			
		}
		
		// look for javascript files
		if (is_dir($this->modulePath . '/js')) {
				
			// get all folder files
			$files = Utilities::getDirectoryFilenames($this->modulePath . '/js');
				
			// load files as script and add timestamp to ignore browser caching
			foreach ($files as $file) {
				$fullPath = $this->moduleUrl . '/js/' . $file;
				$this->app->loadScript($fullPath . '?' . filemtime($fullPath), TRUE);
			}
				
		}
		
		if (!$name) {
			$name = $this->layout;
		}

		$file = $this->modulePath .'/'. $this->scriptPath . $name .'.php';

		$this->app->logEvent('Applying ' . $this->layout . ' layout');
		
		// includes layout file
		try {

			if (file_exists($file)) {
				include $file;
			} else {
				throw new \Exception('Layout file ' . $file . ' was not found');
			}
			
		} catch (\Exception $e) {
			
			$this->app->enqueueError($e->getMessage());
			
		}
		
	}