Back to Document class

Method setMimeEncoding

public \Joomla\CMS\Document\Document
setMimeEncoding
(mixed $type = 'text/html', mixed $sync = true)
Sets the document MIME encoding that is sent to the browser.
Parameters
  • string $type The document type to be sent
  • bool $sync Should the type be synced with HTML?
Returns
  • \Joomla\CMS\Document\Document instance of $this to allow chaining
Since
  • 1.7.0
-
  • https://www.w3.org/TR/xhtml-media-types/
Class: Document
Project: Joomla

Method setMimeEncoding - Source code

/**
 * Sets the document MIME encoding that is sent to the browser.
 *
 * This usually will be text/html because most browsers cannot yet
 * accept the proper mime settings for XHTML: application/xhtml+xml
 * and to a lesser extent application/xml and text/xml. See the W3C note
 * ({@link https://www.w3.org/TR/xhtml-media-types/
 * https://www.w3.org/TR/xhtml-media-types/}) for more details.
 *
 * @param   string   $type  The document type to be sent
 * @param   boolean  $sync  Should the type be synced with HTML?
 *
 * @return  Document instance of $this to allow chaining
 *
 * @since   1.7.0
 *
 * @link    https://www.w3.org/TR/xhtml-media-types/
 */
public function setMimeEncoding($type = 'text/html', $sync = true)
{
    $this->_mime = strtolower($type);
    // Syncing with metadata
    if ($sync) {
        $this->setMetaData('content-type', $type . '; charset=' . $this->_charset, true);
    }
    return $this;
}