關於部落格
人生戲。戲人生。夢想在那裡。就飛多遠吧
  • 57371

    累積人氣

  • 0

    今日人氣

    2

    追蹤人氣

TinyButStrong小強來了-.- +

tbs.php 原始碼

<?php
require_once('DB.php');       //PEAR::DB class
include_once('include/tbs_class.php');    //TinyButStrong Template Engine

//=================================================================
//functions
//=================================================================
function rpSet($BlockName,&$CurrRec,$RecNum){   //replace SN,TeamID,LoginID
 $ArrDontWant=array('CYCO','TSNC');
 $CurrRec['SN']=str_replace($ArrDontWant,'SN',$CurrRec['SN']);
 $CurrRec['TeamID']=str_replace('C06','R26',$CurrRec['TeamID']);
 $CurrRec['LoginID']=str_ireplace('cyber','tbs',$CurrRec['LoginID']);
}


//=================================================================
//some variables
//*** MUST be assigned before $TBS->LoadTemplate() if want to use onload *** 
//================================================================= 
$title='TinyButStrong with PEAR DEMO';   //Page Title
$light=1;          //for testing onload tag
$alarm_color='#ff0000';


//=================================================================
//query data records
//================================================================= 
$dsn='mysql://root@localhost/tbs';
$db =& DB::connect($dsn);
if(PEAR::isError($db)){
 die($db->getMessage());
}
$query="select * from infocertificate where TeamID like 'C0611%'";   


//=================================================================
//TinyButStrong powering now
//================================================================= 
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('template.htm','BIG5') ;
$TBS->MergeBlock('blk1','mysql',$query);
$TBS->Show();
?>

template.htm  原始碼

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>[var.title]</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body>
<br>
<table width="" border="0" cellpadding="1" cellspacing="1" bgcolor="#CCCCCC" style="font-size:12px ">
  <tr height="30" align="center" bgcolor="#CCFFFF">
   <td width="30"></td>
    <td width="97">SN</td>
    <td width="120">TeamID</td>
    <td width="167">LoginID</td>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#FFFFFF">[var.light;block=tr;if [var.light]=1;then 'Light(var.light) is ON.';else 'Light(var.light) is OFF']</td>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#FFFFFF">[onload;block=tr;when [var.light]=1]<font color="[var.alarm_color]">Light(onload) is ON.</font></td>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#FFFFFF">[onload;block=tr;when [var.light]=0]Light(onload) is OFF.</td>
  </tr>
  <tr>
    <td colspan="4" align="center" bgcolor="#FFFFFF">[onload;block=tr;default]Light(onload) is GONE.</td>
  </tr>
  <tr bgcolor="#FFFFFF">
   <td align="center">[blk1.#;block=tr;ondata=rpSet]<!-- ondata must be set at the first field of the wanted block --></td>
    <td>&nbsp;[blk1.SN]</td>
    <td>&nbsp;[blk1.TeamID]</td>
    <td>&nbsp;[blk1.LoginID]</td>
  </tr>
</table>

</body>
</html>

相簿設定
標籤設定
相簿狀態