Demo page source

Following is the source for the sample web page with two embedded report objects. Some JavaScript and HTML has been removed for simplicity.

// Create a php session. This must be the first line executed in your php file.

// Define the relative path to the QLR Manager file directory
$_SESSION['inc_path'] ='../demo/';

// Include the Report Object file
include ('../demo/ReportObject.php');

// Create a new report object
// Provide the host, database associated to the query to be run, userid and password
// The user id needs authority to execute the query
$rptObj  = new ReportObject( 'localhost', 'qlrmanager_baitshop', 'guest', 'guest');
$rptObj2 = new ReportObject( 'localhost', 'qlrmanager_baitshop', 'guest', 'guest');

// Define the query owner and query name, followed by the layout owner and name
$okay = $rptObj->defineReport('frank','overstock','frank','overstock');
$okay = $rptObj2->defineReport('frank','order info','frank','order info');

// Notice how this is done AFTER defineReport() and BEFORE createReport()
$rptObj2->setQueryVar('customer_number', 15);

// Now create the report table

// Start your HTML page
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."\n";
echo '<html><head>'."\n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'."\n";
echo '<meta http-equiv="Content-Script-Type" content="text/javascript">'."\n";
echo '<meta http-equiv="Content-Style-Type" content="text/css">'."\n";
echo '<title>Frank\'s Baitshop: Customer Info</title>'."\n";
echo '<style type="text/css"><!--'."\n";

// Styles used in page
echo 'BODY,TD { font-family:Arial,Helvetica,sans-serif; font-size:10pt; color:#000000 }'."\n";
echo 'P { font-family:Arial,Helvetica,sans-serif; font-size:10pt; color:#000000; margin-top:0px; margin-bottom:6px }'."\n";
echo 'A:HOVER   { color:#177CB0; text-decoration:underline }'."\n";
echo '.fntLogo { font-family:Arial,Helvetica,sans-serif; font-size:14pt; color:#033E66; font-weight:bold }'."\n";
echo '.hdrFont { font-family:Tahoma,Arial,Helvetica,sans-serif; font-size:14pt; color:#000000; font-weight:bold }'."\n";
echo '.rainbow { font-family:"Comic Sans MS",Georgia,Tahoma,sans-serif; font-size:14pt; color:#FF0000; font-weight:bold }'."\n";
echo '.welcome { font-family:Arial,Helvetica,sans-serif; font-size:12pt; color:#000000; font-weight:bold }'."\n";
echo '.celFade { filter:alpha(opacity=100,finishOpacity=10,style=1,startX=1,startY=1,finishX=100,finishY=100) }'."\n";

// Get the report CSS values and place them in the HEAD
echo $rptObj->getCSSvalues();
echo $rptObj2->getCSSvalues();
echo '//--></style>'."\n";

echo '</head><body bgcolor="#ffffff" link="#033E66" vlink="#033E66" alink="#033E66">'."\n";
echo '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>'."\n";
echo '<td width="1%" rowspan="5"><img src="../html/images/frank_s.gif" alt="Frank" width="50" height="60" /></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td width="1%" height="49" valign="bottom" nowrap><font face="Arial,Helvetica,sans-serif" color="#033E66"'."\n";
echo 'size="+1"><b class="fntLogo">Frank\'s Bait and Tackle</b></font></td>'."\n";
echo '<td width="1%" valign="bottom"><img src="../html/images/fish_s.gif" alt="" width="40" height="33" /></td>'."\n";
echo '<td width="97%" valign="bottom" align="center" nowrap><font face="Tahoma,Arial,Helvetica,sans-serif"'."\n";
echo 'color="#000000" size="+1"><b class="hdrFont">Customer Order Information</b></font></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td colspan="3" height="2"><spacer type="block" width="2" height="2"></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td colspan="3" bgcolor="#033E66" class="celFade" height="2"><spacer type="block" width="2" height="2"></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td colspan="3" height="7"><spacer type="block" width="7" height="7"></td>'."\n";
echo '</tr></table>'."\n";
echo '<table border="0" cellspacing="4" cellpadding="0" width="100%"><tr>'."\n";
echo '<td valign="top"><p><b class="welcome">Welcome back, Sam</b></p>'."\n";

echo '<p>Please check our  <font face="Comic Sans MS,Georgia,Tahoma,sans-serif" color="#FF0000" size="+2"><b'."\n";
echo 'class="rainbow">Weekly Specials...</b></font></p>'."\n";

echo '<p>Since your account is in good standing, we have an exclusive offer for you.'."\n";
echo 'We are overstocked on the listed items and are aiming to reduce or inventory by 75%'."\n";
echo 'with this weeks <b>Inventory Reduction Sale</b>. We\'re offering these popular items at'."\n";
echo 'a <font color="#FF0000"><b>20% Discount</b></font>. The table at right is generated'."\n";
echo 'from our database. It shows how much inventory we wish to sell of each item and'."\n";
echo 'is refreshed each time you log on. They\'re moving fast! Be sure to visit each week'."\n";
echo 'to check our specials.</p>'."\n";
echo '<p>As always, we offer <font color="#FF0000"><b>Free shipping</b></font> on orders'."\n";
echo 'over $30.00.</p>'."\n";
echo '<p>Sorry, no rain checks if an item sells out.</p></td>'."\n";
echo '<td rowspan="2" valign="top">'."\n";

// Following HTML can be used to float a DIV in a paragraph of text
// echo '<div style="position:relative;float:right;border:2px solid #033E66">'."\n";

// Get the first report
if ($rptObj->getRecordCount() > 0) {
    echo $rptObj->getReport();
else {
    echo '<br><nobr><b> No sales this week. </b></nobr></br><br>';

echo '<table border="0" cellspacing="2" cellpadding="0"><tr><td></td></tr></table></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td valign="bottom"><b class="welcome">Your order history:</b></td>'."\n";
echo '<td></td>'."\n";
echo '</tr><tr>'."\n";
echo '<td colspan="2" bgcolor="#033E66" class="celFade" height="1"><spacer type="block" width="1" height="1"></td>'."\n";
echo '</tr></table>'."\n";
echo '<table border="0" cellspacing="4" cellpadding="0" align="center"><tr>'."\n";
echo '<td align="center">'."\n";

// Get the second report
if ($rptObj2->getRecordCount() > 0) {
    echo $rptObj2->getReport();
else {
    echo '<br><b class="welcome">No order history.</b>';
echo '</td></tr></table>'."\n";
echo '</body></html>'."\n";