RAW
The RAW document type allows us to do anything we want to the document. Any
document we want to return that is not HTML, PDF, or a feed, is RAW. For example
if we wanted to output data in XML format, we could use the RAW document.
There are three important methods to output a document exactly as we want. By
default RAW documents have a MIME type (Internet Media Type) of text/html; to
change the MIME type we can use the setMimeEncoding() method.
$document =& JFactory::getDocument();
$document->setMimeEncoding('text/xml');
Component Design
[ 92 ]
If we are outputting a document in which the content has been modified at
a set date, we may want to set the document modified date. We can use the
setModifiedDate() method to do this. In this example you would need to replace
time() with an appropriate UNIX timestamp to suit the date to which you are trying
to set the modified date:
$document =& JFactory::getDocument();
$date = gmdate('D, d M Y H:i:s', time()).' GMT';
$document->setModifiedDate($date);
Normally we serve all Joomla! responses using UTF-8 encoding.
Pages:
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137