If you want to use a
different character encoding you can use the setCharset() method:
$document =& JFactory::getDocument();
$document->setCharset('iso-8859-1');
Imagine we want to create an XML response using the RAW document. First, let
us choose a name for the document format. The name must not be the same as any
of the existing formats and although we could use the name 'raw', it is not very
descriptive. Instead, we will use the name xml. This URI demonstrates how we
would use this:
http://www.example.org/joomla/index.php?option=com_
myextension&format=xml
When we do this, the document will be of type JDocumentRaw.
The next thing we need to do is create the view class. This name of the file includes
the format name, note that we use the format name 'xml', not 'raw. For example, the
file might be named myview.xml.php. This example demonstrates how we might
construct the view class:
class MyextensionViewMyview extends JView
{
function display($tpl = null)
{
// modify the MIME type
$document =& JFactory::getDocument();
$document->setMimeEncoding('text/xml');
// add XML header
echo '
Pages:
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138