PHP Classes

File: simplecatalog.php

Recommend this page to a friend!
  Classes of Huda M Elmatsani   Data Displayer   simplecatalog.php   Download  
File: simplecatalog.php
Role: Example script
Content type: text/plain
Description: example: simple catalog
Class: Data Displayer
Display MySQL query result data in various formats
Author: By
Last change:
Date: 20 years ago
Size: 2,468 bytes
 

Contents

Class file image Download
<style type="text/css">
<!--
.style1 {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #FF0000;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
</script>
<?
function caps($str) {
    return
strtoupper($str);
}

function
currency($num) {
   
$num = "$&nbsp;".number_format($num,2,'.',',');
    return
$num;
}



include(
"datadisplayer.php");

$catalog = new datadisplayer;
$catalog->set_db ("localhost","user","password","eproshop");
$catalog->set_rs ("SELECT prodID,prodtitle,proddesc,prodimage,prodprice FROM products");
$catalog->set_page ($_REQUEST[page]);
$catalog->set_page_records (5);
$catalog->set_data();

$catalog->set_tbl ("catalogue",array("border"=>"0","cellspacing"=>"0","cellpadding"=>"5","width"=>"500"));

/* prepare table */
$catalog->set_tbl_cols (array("code","desc","price"));
$catalog->set_tbl_colprop ("code",array("width"=>"60"));

$catalog->set_tbl_header (array("bgcolor"=>"#CCCCCC","height"=>"30","style"=>"font-family: Arial, Helvetica; text-decoration:none;font-size:12"));
$catalog->set_tbl_rows (array("valign"=>"top","style"=>"font-family: Arial, Helvetica; text-decoration:none;font-size:11"));
$catalog->set_tbl_rowshade (array("#D0D0E8","#DEDEEF"));
$catalog->set_tbl_rowfade (array("#DDF0FF"));
$catalog->set_tbl_liner (array("bgcolor"=>"#006699","height"=>"1"));

/* manipulate data */
$catalog->set_function ("var_2","currency",array("prodprice"));
$catalog->set_image ("img_1","prodimage","images/thumbnails",array("align"=>"left","width"=>"80","height"=>"80","border"=>"0"));
$catalog->set_link ("link_1","http://www.justdummy.com/product.php?classid=prodID","prodtitle");

/* apply styles */
$catalog->set_style ("link_1","font-size:12;text-decoration:none");


/* placements */
$catalog->assign(array("code" => "prodID",
                     
"desc" => array("img_1","link_1","proddesc"),
                     
"price" => "var_2"));

echo
$catalog->get_result();


?>