public function setDocType($doctype,$called_from_macro)
    {
        // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext)
        if (!$this->_docType) {
            $this->_docType = $doctype;
        }

        if ($this->_parentContext) {
            $this->_parentContext->setDocType($doctype, $called_from_macro);
        } else if ($this->_echoDeclarations) {
            if (!$called_from_macro) {
                echo $doctype;
            } else {
                throw new PHPTAL_ConfigurationException("Executed macro in file with DOCTYPE when using echoExecute(). This is not supported yet. Remove DOCTYPE or use PHPTAL->execute().");
            }
        }
        else if (!$this->_docType) {
            $this->_docType = $doctype;
        }
    }
public function setDocType($doctype,$called_from_macro)
    {
        // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext)
        if (!$this->_docType) {
            $this->_docType = $doctype;
        }

        if ($this->_parentContext) {
            $this->_parentContext->setDocType($doctype, $called_from_macro);
        } else if ($this->_echoDeclarations) {
            if (!$called_from_macro) {
                echo $doctype;
            } else {
                throw new PHPTAL_ConfigurationException("Executed macro in file with DOCTYPE when using echoExecute(). This is not supported yet. Remove DOCTYPE or use PHPTAL->execute().");
            }
        }
        else if (!$this->_docType) {
            $this->_docType = $doctype;
        }
    }
public function setDocType ( $ doctype , $ called_from_macro ) { // FIXME: this is temporary workaround for problem of DOCTYPE disappearing in cloned PHPTAL object (because clone keeps _parentContext) if ( ! $ this -> _docType ) { $ this -> _docType = $ doctype ; } if ( $ this -> _parentContext ) { $ this -> _parentContext -> setDocType ( $ doctype , $ called_from_macro ) ; } else if ( $ this -> _echoDeclarations ) { if ( ! $ called_from_macro ) { echo $ doctype ; } else { throw new PHPTAL_ConfigurationException ( "Executed macro in file with DOCTYPE when using echoExecute(). This is not supported yet. Remove DOCTYPE or use PHPTAL->execute()." ) ; } } else if ( ! $ this -> _docType ) { $ this -> _docType = $ doctype ; } }
Set output document type if not already set.

This method ensure PHPTAL uses the first DOCTYPE encountered (main
template or any macro template source containing a DOCTYPE.

@param bool $called_from_macro will do nothing if _echoDeclarations is also set

@return void
Set output document type if not already set .