i use # Templet class # (c) 2001, from [EMAIL PROTECTED], but i confuse when 
call the class such as this code :
  $main = new Templet("tmpl/menus.htm", "<!--delimiter-->");
  and then use $main->b(0); 
  what is the meaning of $main->b(0); 
  this is the templet.class.php
  <?
# Templet class
# (c) 2001, [EMAIL PROTECTED]
# 2001-03-02 v 0.09
# 2001-05-20 v 0.1
# 2001-07-02 v 0.2
  function getv($v) {
  $v=ereg_replace("__","",$v);
  global $$v;
  return $$v;
}
  
class Templet {
    var $content,    # full content
        $contents,   # array filled with splits
        $delimiter,  # delimiter used to split the template
        $splits,     # split names
        $numsplits;  # number of splits
      function display() {
       echo $this->content; # display full content
    }
      function add($str) {
       $this->content .= $str;
    }
      function add2($split) {
       if (!is_integer($split))
          $split=$this->splits["$split"];
       $this->content .= $this->contents[$split];
    }
   
    function parse($pattern,$replacement,$split){
       if (!is_integer($split))
          $split=$this->splits["$split"];
       $what = $this->contents[$split];
       $what = preg_replace($pattern,$replacement,$what);
       return $what;
    }
  
    function a($pattern,$replacement,$split) {
       if (!is_integer($split))
          $split=$this->splits["$split"];
       $str = $this->parse($pattern,$replacement,$split);
       $this->content .= $str;
    }
      function c($pattern,$replacement,$split) {
       if (!is_integer($split))
          $split=$this->splits["$split"];
       return $this->parse($pattern,$replacement,$split);
    }
      function b($split) {
       $this->a("/__[a-z0-9A-Z]+__/e","getv('\\0')",$split);
//        echo $this->a("/__[a-z0-9A-Z]+__/e","getv('\\0')",$split);
    }
      function d($split) {
       return $this->c("/__[a-z0-9A-Z]+__/e","getv('\\0')",$split);
    }
      function Templet($file,$delimiter="<!--delimiter-->") {
       if (!$delimiter) exit();
       $this->delimiter=$delimiter;
       $f=file($file);
       $this->numsplits=0;
       $this->splits=array();
    $jum = sizeof($f);
    //echo "file = " . file($file);
    echo "jum = " . $jum;
   // echo "delimiter :" . $this->delimiter;
       for ($i=0;$i<sizeof($f);$i++) {
          $line=$f[$i];
          $this->contents[$this->numsplits] .= $line;
          if (ereg($this->delimiter,$line)) {
     echo "true";
             if (ereg("<!--name=(.*)-->",$line,$nam)) 
    {
     $name=$nam[1];
    echo "bener";
    }
    //echo $name;
   // echo $name;
   //echo "nama = " . $name;
  //echo $name;
             $this->numsplits++;
             $this->splits["$name"]=$this->numsplits;
             unset($nam);
          }
       }
    }
}
?>
  this is menus.php
  <?
include "inc/config.inc.php";
include "inc/function.inc.php";
include "inc/templet.class.php";
  $main = new Templet("tmpl/menus.htm", "<!--delimiter-->");
  $act = "Menu utama";
if(!ceksession($session, $act, $menu)) header("Location: errorsession.php");
  /* tampilkan bagian header */
$tanggal = date("j");
$bulan = date("n");
$tahun = date("Y");
$cekhari = date("w", mktime(0, 0, 0, $bulan, $tanggal, $tahun));
$namahari = $arrhari[$cekhari];
$namabulan = $arrbulan[$bulan];
$waktu = $namahari.", ".$tanggal." ".$namabulan." ".$tahun;
$main->b(0);
//echo "Halo" . $main;
  /* buat tampilan menu bagian kiri */
bukadb();
$q = mysql_query("select user from $tbl_session where session='$session'");
list($user) = mysql_fetch_row($q);
$q = mysql_query("select capable from $tbl_user where user='$user'");
list($capable) = mysql_fetch_row($q);
$capable = split(",", $capable);
  /* Buat tampilan menu */
$q = mysql_query("select no, description from $tbl_category order by no");
while(list($idcat, $category) = mysql_fetch_row($q)) {
  /* Tampilan kategori */
  $q1 = mysql_query("select no from $tbl_function where category='$idcat'");
  while(list($idfunc) = mysql_fetch_row($q1)) {
    if(in_array($idfunc, $capable)) {
      $main->b(1);
   //echo $main;
      break 1;
    }
  }
/*
  $q1 = mysql_query("select nama, url from $tbl_link where kategori='$nokat' 
order by no");
  while(list($link, $url) = mysql_fetch_row($q1)) {
    $url = ereg_replace("__session__", $session, $url);
    if($kategori == "Link") $url .= " target=_blank";
    $main->b(11);
  }
*/
  /* Tampilan fungsi */
  $q1 = mysql_query("select no, name, description from $tbl_function where 
category='$idcat'");
  while($o = mysql_fetch_object($q1)) {
    if(in_array($o->no, $capable)) {
//      $link = $o->name.".php";
      $link = 
"?session=".$session."&menu=".$o->name;//"__session__"$o->name.".php";
      $funcname = $o->description;
      $main->b(2);
   
  // echo $main;
    }
  }
  $q1 = mysql_query("select no from $tbl_function where category='$idcat'");
  while(list($idfunc) = mysql_fetch_row($q1)) {
    if(in_array($idfunc, $capable)) {
      $main->b(3);
   //echo $main;
      break 1;
    }
  }
}
  /* buat tampilan isi tengah situs */
$main->b(4);
//echo $main;
include "isi-situs.php";
$main->b(5);
//echo $main;
/* tampilkan bagian footer */
$main->b(6);
//echo $main;
  $main->display();
?>
   
  this is menus.htm
  <html>
<head>
  <title>Admin Area of okta-education.com</title>
  <link href="../s.css" type=text/css rel=stylesheet>  
 <script language="JavaScript" type="text/javascript" 
src="richtext.js"></script>
  </head>
<body topmargin="5">
<script src="../main.js"></script>
<table align="center" width="778" bgcolor="#637FAE" cellpadding="0" 
cellspacing="0" border="0">
  <tr>
    <td width="519" align="left" height="30" valign="top"><font 
color="#FFFFFF">__
      <a class=submenub href="?session=__session__" 
class="cssLinkNavigasi">Let's go Home</a> __</font>
    </td>
    <td width="135" align="center" height="30" valign="bottom">
      <font face="Arial, Helvetica, sans-serif" size="1" 
color="white">__waktu__</font>
    </td>
 <td align="right"><IMG src="images/us_01.jpg"></td>
  </tr>
</table>
<!--#E8F1FF-->
<table align="center" width="780" cellpadding="1" cellspacing="0"  
bgcolor=#E8F1FF border="0">
  <tr>
    <td width="167" valign="top" align="left">
 <table width="100%">
   <tr>
    <td width="167" bgcolor=#E8F1FF>
   &nbsp; Control Panel Menu
    <ul>
      <!--delimiter-->
      <li><b>__category__</b></li>
      <ul>
        <!--delimiter-->
        <li><a  class=submenub href=__link__ >__funcname__</a></li>
        <!--delimiter-->
      </ul>
      <!--delimiter-->
      <li><a class=submenub href=logout.php?session=__session__>Log Out</a></li>
     </ul>
  <ul>&nbsp;</ul>
   <img src="images/web_10.jpg" width="167" height="267" valign="bottom">
    </td>
   </tr>
 </table>
    </td>
      <!--delimiter-->
    <td valign="top">
__isitengah__
      <!--delimiter-->
    </td>
  </tr>
</table>
</body>
</html>
   
  
this is the config.php
  <?
/* untuk koneksi dengan MySQL Server */
$dbuser = "root";                   /* user database */
$dbpass = "";                     /* password database */
$dbname = "";                     /* nama database */
$dbhost = "localhost";                  /* lokasi server database */
  //$dbuser = "oktaeduc_oktaedu";                   /* user database */
//$dbpass = "oktaeduc890";                /* password database */
//$dbname = "oktaeduc_dbokta";            /* nama database */
//$dbhost = "localhost";                  /* lokasi server database */
  $self = (!strcmp(PHP_OS, "Linux")) ? $PHP_SELF : getenv("PHP_SELF");
$secexpire = "900";                      /* masa expire session, dalam detik */
$special_user = array('');               /* user yang tidak akan ditampilkan */
$jumberita = 4;                          /* jumlah berita yang ingin 
ditampilkan */
$jumkata = 20;                           /* jumlah kata untuk sekilas berita */
$jumkatacari = 10;                       /* jumlah kata untuk hasil pencarian */
  /* array nama hari dan nama bulan */
$arrhari = array("Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", 
"Sabtu");
$arrbul = array(1 => "Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", 
"Sep",
  "Okt", "Nop", "Des");
$arrbulan = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni",
  "Juli", "Agustus", "September", "Oktober", "Nopember", "Desember");
  /* konfigurasi counter */
$filecounter = "datacounter.txt";        /* file counter pengunjung */
$imagecounterdir = "images/";            /* direktori image untuk counter */
  /* konfigurasi tips dan banner */
$showtips = 1;                           /* opsi tampilkan tips */
$tipspos = 0;                            /* posisi tips, 1 = kiri, 0 = kanan */
$showbanner = 1;                         /* opsi tampilkan banner */
$bannerpos = 1;                          /* posisi banner, 1 = kiri, 0 = kanan 
*/
  /* konfigurasi guestbook */
$kirimmail = 0;                          /* opsi kirim email, 1 = kirim, 0 = 
tidak */
$kirimke = "[EMAIL PROTECTED]";         /* email tujuan */
$judulmail = "Guestbook New Entry ...";  /* subyek email */
$limitgb = 5;                            /* jumlah entry per halaman */
$limitcp = 10;                            /* jumlah entry per halaman */
  
/* konfigurasi daftar produk,harga,karir dan anggota */
$limitproduk = 10;
$limitmember = 10;
$limithrg = 20;
$limitjob = 4;
  /* permainan warna untuk kategori link */
$bgmenuR = 0;
$bgmenuG = 51;
$bgmenuB = 102;
$textmenuR = 255;
$textmenuG = 204;
$textmenuB = 0;
  /* permainan warna untuk judul informasi di tengah halaman */
$bginfoR = 51;
$bginfoG = 51;
$bginfoB = 102;
$textinfoR = 255;
$textinfoG = 255;
$textinfoB = 255;
  /* tabel database */
$tbl_content = "content";                /* tabel content */
$tbl_gbook = "guestbook";                /* tabel isi guestbook */
$tbl_job = "job";                        /* tabel lowongan karir */
$tbl_kegiatan = "kegiatan";              /* tabel agenda kegiatan */
$tbl_link = "link";                      /* tabel link menu */
$tbl_user = "user";                      /* tabel daftar user */
$tbl_session = "session";                /* tabel daftar session */
$tbl_category = "kategori_fungsi";       /* tabel kategori fungsi */
$tbl_function = "fungsi";                /* tabel fungsi */
$tbl_logs = "logs";
$tbl_article = "article";                /* tabel article */
$tbl_tips = "tips";                      /* tabel kumpulan tips */
$tbl_comment = "comment";                /* tabel komentar */
$tbl_info = "info";                      /* tabel berita */
$tbl_polling = "polling";                /* tabel polling */
$tbl_polling_detail = "polling_detail";  /* tabel polling_detail */
$tbl_jadwal = "jadwal";                  /* tabel jadwal */
$tbl_program = "program";                /* tabel daftar produk */
$tbl_produk = "produk";                /* tabel produk detail */
  
$tbl_promosi = "promosi";           /* tabel promosi */
$tbl_forum = "forum";           /* tabel forum */
$tbl_forum_detail = "forum_detail";      /* tabel reply forum */
$tbl_konsultasi = "konsultasi";          /* tabel tanya jawab */
$tbl_download = "download";              /* tabel download */
$tbl_registrasi = "registrasi";          /* tabel pendaftaran */
$tbl_pengumuman = "pengumuman";          /* tabel pengumuman */
$tbl_workshop = "workshop";            /* tabel workshop */
?>
  Anybody has used mdamt before to make cms?? i really need help. Thanx before.

 __________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

[Non-text portions of this message have been removed]

Reply via email to