\section{Playtest second!} Now that we have a passing test, we want to display some results as web pages. The following examples utilize the Prado framework to display and manipulate the database through SQLMap. Since SQLMap framework and Prado framework solve different problems, they are both fairly independent, they can be used together or separately. \subsection{SQLMap and Prado} To setup Prado, we need to create the follow files and directory structure under our \tt{example/WebView} directory. \begin{verbatim} assets/ % application public assets protected/pages/Home.page % default page protected/pages/Home.php % default page class protected/runtime/ % run time data protected/application.xml % application configuration index.php % application entry point \end{verbatim} The \tt{application.xml} and \tt{assets} directory are not necessary but we will make use of them later. The \tt{application.xml} is used to define some directory aliases and override the data source definitions in the \tt{sqlmap.config}. This is because SQLite database files are defined relatively, otherwise we don't need to override the data source definitions. The example \tt{application.xml} is show in Example~\ref{example:2.0}. \begin{example}\label{example:2.0} Prado application.xml, defines path aliases and override SQLite database location. \begin{verbatim} \end{verbatim} \end{example} The entry point to a Prado application in this example is \tt{index.php}. Example~\ref{example:2.1} shows the basic \tt{index.php} content. \begin{example}\label{example:2.1} Prado application entry point, \tt{index.php}. \begin{verbatim} run(); ?> \end{verbatim} \end{example} Now we are ready to setup a page to display our list of people. Example~\ref{example:7} shows the Prado code for our display page. The key piece is the TDataGrid. \begin{example}\label{example:7} Prado page for our Person list, \tt{Home.page}. \begin{verbatim} Person

Person List

\end{verbatim} \end{example} Of course, we still need to populate that TDataGrid. Example~\ref{example:8} shows the PHP code for \tt{Home.php}. The operative method is \tt{loadData()}. The rest is supporting code. \begin{example}\label{example:8} \tt{Home.php} class for our Person list page \begin{verbatim} Application->getModule('SQLMap')->getClient(); $this->personList->DataSource = $sqlmap->queryForList('SelectAll'); $this->personList->dataBind(); } public function onLoad($param) { if(!$this->IsPostBack) $this->loadData(); } } ?> \end{verbatim} \end{example} If we run this now, we'll get a list like the one shown in Figure~\ref{figure:2}. \begin{figure}[!h] \centering \includegraphics[width=0.75\textwidth]{grid1} \caption{A quick-and-dirty Person List} \label{figure:2} \end{figure}