Пример #1
0
	public function render($indent=0)
	{
		$lang = LPC_Language::getCurrent();
		$POSIX = $lang->getAttr("locale_POSIX");
		if (strlen($POSIX) > 1) // at least 2
			$this->setAttr("lang", substr($POSIX, 0, 2));

		$this->prepareContent($this->content);
		if ($this->doctype & LPC_HTML_doctype::type_XHTML1)
			$this->setAttr("xmlns","http://www.w3.org/1999/xhtml");

		if (!$this->body->content || self::RM_NONE == $this->renderMode)
			return '';

		if (!$this->beforeRender($indent))
			return '';

		if (self::RM_RAW == $this->renderMode)
			return $this->body->renderContent($indent);

		if (self::RM_HTML != $this->renderMode)
			throw new RuntimeException("Unknown render mode: [".$this->renderMode."]");

		$title="";
		if ($this->title) {
			$titleObj=new LPC_HTML_fragment();
			$titleObj->content=$this->title;
			$titleObj->compact=true;
			$title=$titleObj->render();
		}

		if (strlen(trim($title)))
			$this->content['head']->content['title']->content=sprintf($this->title_format,$title);
		else
			$this->content['head']->content['title']->content=$this->title_default;

		$content=$this->output(LPC_HTML_doctype::$doctypes[$this->doctype],$indent); // <!DOCTYPE...>
		$content.=parent::render($indent);
		$this->onRender($indent);
		return $content;
	}
Пример #2
0
	public function render()
	{
		if (!$this->content || $this->unconditional_preparation)
			$this->prepare();
		return parent::render();
	}