\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
\section{ Output Buffering}
\textbf{Colortext: NIThis information is valid for Horde 4 and later only.Colortext: NI}

Normally in PHP, one could wrap code in \texttt{ob\_start()} and \texttt{ob\_get\_clean()} to grab output meant for the browser.  Unfortunately, it is not so easy in the Horde framework since CSS stylesheet and JS output must not be sent until the page is entirely ready to output to the browser.

Therefore, it is necessary to use the Horde utility functions \texttt{Horde::startBuffer()} and \texttt{Horde::endBuffer()} to do output buffering.  Example:

\begin{verbatim}
Horde::startBuffer();
$notification->notify(array('listeners' => 'status'));
$notify_output = Horde::endBuffer();
\end{verbatim}

In the above example, the status notifications may do things like add javascript files to the output buffer.  By using startBuffer()/endBuffer(), this guarantees that these javascript files will not be output to the browser and will instead properly be displayed when the page header is eventually created (normally \texttt{templates/common-header.inc}).

\end{document}
