lithium\template\view\adapter\File::_paths()

protected method

Searches one or more path templates for a matching template file, and returns the file name.

Parameters

  • string $type
  • array $params

    The set of options keys to be interpolated into the path templates when searching for the correct file to load.

Returns

string

Returns the first template file found. Throws an exception if no templates are available.

Source

	protected function _paths($type, array $params) {
		if (!isset($this->_paths[$type])) {
			throw new TemplateException("Invalid template type '{$type}'.");
		}

		foreach ((array) $this->_paths[$type] as $path) {
			if (!file_exists($path = Text::insert($path, $params))) {
				continue;
			}
			return $path;
		}
		throw new TemplateException("Template not found at path `{$path}`.");
	}