Home Back
     
 

 

 

Basismap Intra- Internet programmeren
Categorie Programmeren Bestandsbeheer en templates

Struktuur van het voorbeeld :
» hoofdmap www
 --dir_top.php
»»class.css
» submappen :
»»beheer
 --class.css
 --dir_tpl.htm
»»klassen
 --alg_javafunc.js
 --klasse_template.php
» map voor het opladen van bestanden [bvb:testen]

Uitzicht van het dir_tpl.htm - bestand
http://www.tribuun.com/Kantoren/projectdemo/mod_dir/dir_tpl.htm

1.dir_top.php
 
Code:

<?php
//    Licence :: open source :: GNU General Public License
//    Program :: Bestandsbeheerder
//    Copyright (C) 2004  <piet willems>
//    Add authorname here by modifying [GNU]

//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.

//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.

//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   
//______________ Java functies ________________________________________

//De gebruikte javafuncties worden op de html-pagina ingelast op de volgende manier:
//<script language="Javascript" src="http:/uwdir/class_javafunc.js"></script>}


$_POST    = $HTTP_POST_VARS;
$_GET     = $HTTP_GET_VARS;
$aantbest = 2 ;
$oplaaddir = "../../testen";//"testen";//../mod_dir/testen
$action = ($HTTP_POST_VARS['name']);




//_____________ 1. De Klasse dir configureren __________________________________________________________
class dir {
    var $tabel;               
    var $titel;
    var $ophaaldir;         // om verschillende menus kunnen weer te geven
    var $Kol = array();
    var $KolNaam  = array();
    var $ingang;           
    var $AG_tabel;         // waarden gezet in TD
    var $AG_td;             // rij waar de lichtband niet moet oplichten
    var $Stijl = array();   //[0] tabel
                      //[1] thead
                      //[2] th
                      //[3] tbody
                      //[4] tfoot
                      //[5] td_no [no=niet oplichten]
                      //[6] kol_1
                      //[7] kol_2
                      //[8] kol_3
                      //[9] kol_4]
                      //[10] kol_5

    //______________________________ Klasse-functie : Tabelnaam opgeven _________________________________
   
    function ZetDirTitel($dir,$titel) {
        $this->titel = $titel;
        $this->ophaaldir= $dir;
    }


    //______________________________ Klasse-functie : Kolom en Kolomhoofding _____________________________

    function ZetKol($omschrijving) {
        $this->KolNaam[] = $omschrijving;
    }
    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

      if (!$handle = @opendir($this->ophaaldir))
      {
         print "
         <span>
         Kan ". $oplaaddir . " niet openen. Kijk na of de map bestaat of controleer de eigenschappen van de map.
         </span>
         ";
           }
           print "
           <div align=\"center\">
           <table ".$this->style[0]." border = \"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">
         <tr>
         <thead ".$this->style[1]." colspan=\"5\">".$this->titel."</thead>
         </tr>
           <tr>
           <th ".$this->Stijl[2].">".$this->KolNaam[0]."</th>
           <th ".$this->Stijl[2].">".$this->KolNaam[1]."</th>
           <th ".$this->Stijl[2].">".$this->KolNaam[2]."</th>
           <th ".$this->Stijl[2].">".$this->KolNaam[3]."</th>                      
           <th ".$this->Stijl[2].">".$this->KolNaam[4]."</th></tr>
           <col ".$this->Stijl[6]."><col ".$this->Stijl[7]."><col ".$this->Stijl[8]."><col ".$this->Stijl[9]."><col ".$this->Stijl[10].">
           <TBODY ONMOUSEOVER='lichtband(true)' ONMOUSEOUT='lichtband(false)'>
           ";

           while($ingang = @readdir($handle))
              {
                if($ingang != ".." && $ingang != "." && !is_dir($ingang))
                {
                  //Set the filesize type (bytes, KiloBytes of MegaBytes)
                  $filesize = filesize($this->ophaaldir . "/" . $ingang);
                  $grafwaarde = $filesize/70;
                  $type = Array ('B', 'KB', 'MB');
                  for ($i = 0; $filesize > 1024; $i++)
                    $filesize /= 1024;
                    if($filesize  <= 0){
                   $filesize="dir" ;
                   $beeldgraf= "src=\"dir1.jpg\"";
                   $grafwaarde =5;
               } else {
                   $filesize = round ($filesize, 2)." $type[$i]";
                   $beeldgraf= "src=\"graf1.jpg\"";
               }

                     
             print "<tr>
            <td>&nbsp;".$ingang."</td>
            <td>&nbsp;<img ".$beeldgraf." width=".$grafwaarde."  height=\"5\" alt='Grootte : ".$filesize."'> » ".$filesize."</td>
            <td width='15'>";
            ?><A onclick="javascript:if(confirm('Verwijder <?=$ingang;?>?')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=verwijder&amp;file=<?=$ingang;?>';"><?
            print "<img src='verw.jpg' alt='Verwijder ".$ingang."' width=15 height=15 border=0></a></td>";
            print "<td width='15'>"
            ?><A onclick="javascript: var inserttext = ''; if(inserttext = prompt('Hernoem <?=$ingang;?>. Geef een nieuwe naam op voor het bestand.','<?=$ingang;?>')) location.href='<?=$_SERVER['PHP_SELF'];?>?handeling=hernoem&amp;file=<?=$ingang;?>&amp;to='+inserttext; "><?
            print "<img src='hern.jpg' alt='Hernoem ".$ingang."' width=15 height=15 border=0></a></td>";
            print "<td width='15'>";
            print "<a href='".$GLOBALS[oplaaddir]."/".$ingang."' target='_blank' >";
            print "<img src='edit.jpg' alt='Openen ".$ingang."' width=15 height=15 border=0></a></td>";
              print "</tr>";
                                 }
                }
                
            print "
            </TBODY></table>
            </div>
      ";
   
   }
}

//_____________ 2. De Klasse opladen configureren __________________________________________________________
class opladen {
             
    var $AG_tabel;         // waarden gezet in hoofdtabel
    var $titel;
    var $AG_td;            // dient niet noodzakelijk gezet te worden.
    var $Stijl = array();    // te zetten klassen » indien gewenst

    //______________________________ Klasse-functie : Tabelnaam opgeven _________________________________
   
    function ZetTabelTitel($titel) {
        $this->titel = $titel;
    }


    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetAG_tabel($html) {
        $this->AG_tabel = $html;
    }
    function ZetAG_td($html) {
        $this->AG_td = $html;
    }   

    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

   print "
      <form method='post' enctype='multipart/form-data' action='".$_SERVER['PHP_SELF']."?handeling=opladen'?>
       <table ".$this->style[0]." border = \"0\" cellspacing=\"9\" cellpadding=\"0\" height =\"100%\" width=\"100%\">
         <tr>
         <thead ".$this->style[1]." colspan=\"5\">".$this->titel."</thead>
         </tr>
      ";      
   for( $i = 0; $i < $GLOBALS['aantbest']; $i++ )
   { 
   print "
      <tr>
      <td>
      <input type='file' name='file[]' ".$this->Stijl[4]."></td>
      </tr>
      ";
   }
   print "
      <tr><td>
      <input type='submit' value='Opladen' ".$this->Stijl[2]."><br>
      </td></tr>
      <tr><td>
      <input type='button' value='Ververs | Pagina - update' ".$this->Stijl[2]." onclick=\"location.href = 'dir_buffoff.php'\"><br>
      </td></tr>      
      </table>
      </form>
      ";
   }
}

//_____________ 3. De Klasse graf configureren __________________________________________________________
class graf {
             
    var $titel;
    var $hist_titel;
    var $hist_tekst;
    var $aantal;
   var $legende = array();
   var $titelwaarde = array();
   var $extraInfo = array();
   var $waarde = array();
   var $Stijl = array();    // te zetten klassen » indien gewenst

    //______________________________ Klasse-functie : Tabelnaam opgeven _________________________________
   
    function ZetTabelTitel($titel,$aantal) {
        $this->titel = $titel;
        $this->aantal = $aantal;    }
       
    function ZetHistoriek($histtitel,$histtekst) {
        $this->hist_titel = $histtitel;
        $this->hist_tekst = $histtekst;
    }

    //______________________________ Klasse-functie : stijlen ____________________________________________

    function ZetStijl($stijlen) {
        $this->Stijl[] = $stijlen;
    }       
    function ZetLegende($legende,$extrainfo) {
        $this->legende[] = $legende;
        $this->extraInfo[] = $extrainfo;
    }
    function ZetTitelWaarde($titelwaarde) {
       $this->titelwaarde[] = $titelwaarde;
    }   
    function ZetWaarde($waarde) {
        $this->waarde[] = $waarde;
    }
    //______________________________ Klasse-functie : Maak de html-code __________________________________

    function MaakHtml() {

   print "
   <div align=\"center\">
   
       <table ".$this->style[0]." border = \"0\" cellspacing=\"0\" cellpadding=\"0\" height =\"100%\" width=\"100%\">
         <tr>
         <thead ".$this->style[1]." colspan=\"5\">&nbsp;".$this->titel."</thead>
         </tr>

      <tr>
         <td colspan=\"2\" class=\"tabeltitel\" bgcolor=\"#638697\">&nbsp;".$this->hist_titel."</td>
         <td class=\"tabeltitel\" bgcolor=\"#638697\" height=\"14\">&nbsp;".$this->legende[0]."</td>
      </tr>
      <tr>
         <td class=\"mini\" bgcolor=\"#7494A4\" colspan=\"2\" rowspan=\"2\">&nbsp;".$this->hist_tekst."</td>
         <td class=\"mini\" bgcolor=\"#7494A4\" height=\"19\">&nbsp;
         <img border=\"0\" src=\"graf1.jpg\" width=\"5\" height=\"5\">&nbsp;Aantal bestanden</td>
      </tr>
      <tr>
         <td class=\"mini\" bgcolor=\"#7494A4\" height=\"19\">&nbsp;
         <img border=\"0\" src=\"dir1.jpg\" width=\"5\" height=\"5\">&nbsp;Aantal mappen</td>
      </tr>
      ";
      for( $i = 0; $i < $this->aantal; $i++ )
      
      {
      $x=($this->waarde[$i]/2);
      print "
      <tr>
         <td width=\"117\" bgcolor=\"#7494A4\" class=\"mini\">&nbsp;".$this->titelwaarde[$i]."</td>
         <td width=\"239\" bgcolor=\"#7494A4\" class=\"mini\">
         <img border=\"0\" src=\"graf1.jpg\" width=".$this->waarde[$i]." height=\"5\"><br>
         <img border=\"0\" src=\"dir1.jpg\" width=".$x." height=\"5\"></td>
         <td width=\"236\" bgcolor=\"#7494A4\" height=\"14\" class=\"mini\">".$this->extraInfo[$i]."</td>
      </tr>
      ";
      }
      print "
      <tr>
         <td width=\"117\" bgcolor=\"#7494A4\" class=\"mini\"></td>
         <td width=\"239\" bgcolor=\"#7494A4\" class=\"mini\"></td>
         <td width=\"236\" bgcolor=\"#7494A4\" height=\"14\" class=\"mini\"></td>
      </tr>
      
      <tr>
         <td colspan=\"3\" bgcolor=\"#638697\" height=\"13\">
         <p align=\"right\" class=\"mini\">pw TRIBUUN.COM</td>
      </tr>
   </table>
</div>
      ";
   }
}



switch ($_GET[handeling])
{
       case 'opladen':
            $file_array = $HTTP_POST_FILES['file'];
            $ingave = false;
            for($i = 0 ; $i < $aantbest; $i++)   //of  : $GLOBALS['aantbest']
            {
                 if($_FILES['file']['name'][$i])
                 {
                    $ingave = true;
                   if($_FILES['file']['name'][$i])
                      {
                        $bestand = $oplaaddir."/".$_FILES['file']['name'][$i];
                        move_uploaded_file($_FILES['file']['tmp_name'][$i],$bestand);
                        chmod($bestand,0777);
                        //echo  $_FILES['file']['name'][$i]." opgeladen.<br>";

                      }
                 }
            }
            if(!$ingave) echo "Er zijn geen bestanden geselecteerd";
         //print "$GLOBALS[startlocatie]"; // buffering off
         //print  "<a href=\"dir_buffoff.php\">Terug</a>";
         //print "<javascript:\"location.href = 'dir_buffoff.php'\" >";
          exit;
   case 'verwijder':
            if(!@unlink($oplaaddir."/".$_GET['file']))
                 print "Bestand niet gevonden";
            else
         {
                 print $_GET['file'] . " is verwijderd<br>";
         }
         print "$GLOBALS[startlocatie]"; // buffering off
         print  "<a href=\"dir_buffoff.php\">Terug</a>";
         exit;
   case 'hernoem':
            rename( $oplaaddir . "/" . $_GET['file'] , $oplaaddir . "/" . $_GET['to'] );
            print "Bestand " . $_GET['file'] . " hernoemd tot " . $_GET['to'];
         //print "$GLOBALS[startlocatie]"; // buffering off
         //print  "<a href=\"dir_buffoff.php\">Terug</a>";
         include ("dir_htm.htm");   
         exit;


   default:
      //klasse template aanroepen
      require("klassen/Klasse_template.php");

      $doel = new template("../templates/beheer");
          $doel->LaadBestand( array(
           'dirvars' => '/dir_tpl.htm' )
          );

          $doel->varRef( "dirvars", array(
           "COPYRIGHT"    =>    '<a style="font-size:10px;font-family:Verdana; color:#C0C0C0;letter-spacing:-1px">pw Tribuun.com</a>',
           "TITEL"=>'Template voorbeeld')
          );

          $doel->parse("dirvars");

      break;
}
?>
 


2.class.css
 
Code:

.rijover {background-color:#5B7B8B;color:#FFFFFF;cursor:hand;}
.tabeltitel{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
color:#FFFFFF;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
}
.kolhoofd{
font-family:Verdana;
font-size:8pt;
background-color:#5B7B8B;
color:#FFFFFF;
cursor:hand;
border-bottom:1px solid #000000;
border-left 1px solid #000000;
border-right 1px solid #000000;
border-top:1px solid #000000;
letter-spacing: -1px;
}

.kolgeel{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFFFEB;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolgroen{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#D2ECD8;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}

.kolrood{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#FFECD1;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kolblauw{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#C9DEE9;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}
.kollichtblauw{
font-family:Verdana;
font-size:8pt;
color:#000000;
background-color:#DCE9F0;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
letter-spacing: -1px;
}

.mini{
font-family: Verdana; 
border-bottom:1px solid #000000;
font-size: 10px;
letter-spacing: -1px;
}
.hoofding{
background-color : #FFFFFF;
border-style: solid;
border-width: 1px;
height:17;
font-size:8pt;
font-family:Tahoma;
}   
 
.ingave{
background-color:#FFFFFF;
color :#000000 ;
border-style: solid;
border-width: 1px;
width: 100%;
height:17;
font-size:8pt;
font-family:Tahoma;

.ingavekl{
background-color:#FFFFFF;
color :#000000 ;
border-style: solid;
border-width: 1px;
width: 100;
height:17;
font-size:8pt;
font-family:Tahoma;
}
.knop{
background-color:#5B7B8B;
color : #FFFFFF;
border-style: solid;
border-width: 1px;
width: 100%;
height:17;
font-size:8pt;
font-family:Tahoma;

.knopkl{
color : #FFFFFF;
background-color:#5B7B8B;
border-style: solid;
border-width: 1px;
width: 100;
height:17;
font-size:8pt;
font-family:Tahoma;
}


body
{
background-color:#5B7B8B;

}
.tabel{ 
color:#FFFFFF;
border-bottom:1px solid #000000;
border-left-width:1px solid #000000;
border-right-width:1px solid #000000;
border-top-width:1px solid #000000;
}
thead
{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
background-color:#4F6B79;
color:#FFFFFF;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;

}
th
{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
background-color:#638697;
color:#000000;
border-bottom:1px solid #000000;
cursor:hand;
border-left-width:1px;
border-right-width:1px;
border-top-width:1px;
}

td.blauw_0
{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
background-color:#638697;
color:#000000;
border-top : 1px solid #516D7B;
border-left : 1px solid #516D7B;
border-bottom : 1px solid #FFFFFF;
}


td.blauw_1
{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
background-color:#638697;
color:#FFFFFF;
border: 1px solid #FFFFFF;
}


td.blauw_2
{
font-family:Tahoma;
font-size:8pt;
font-weight:bold;
background-color:#638697;
color:#000000;
border: 1px solid #516D7B;
}
 


3.dir_tpl.htm
 
Code:

<html>
<head>
<meta http-equiv="Content-Language" content="nl-be">
<link REL="stylesheet" TYPE="text/css" href="class.css">
<title>Bestandsbeheer</title>
<script language="Javascript" src="klassen/alg_javafunc.js"></script>
</head>
<body>
      
<p align="center"><font color="#FFFFFF">{TITEL}</font>&nbsp;&nbsp;&nbsp;
Copyright (c) <font face="Verdana" size="1" color="#C0C0C0">open source</font>&nbsp; {COPYRIGHT}</p>
<table border="0" cellspacing="9" cellpadding="0">
   <tr>
      <td valign="top">
      <table border="0" width="100%" cellspacing="0" cellpadding="4">
         <tr>
            <td class="blauw_0" width="46">Afdeling</td>
            <td class="blauw_1">Kantoren</td>
         </tr>
      </table>
      </td>
      <td  valign="top" align="center" class="blauw_2">
      <font size="4"><font color="#FFFF00">--</font><font color="#FF0000">»</font></font></td>
      <td valign="top">
      <table border="0" width="100%" cellspacing="0" cellpadding="4">
         <tr>
            <td width="57" style="border-bottom: 1px solid #FFFFFF" bgcolor="#638697">
            <b><font face="Verdana" size="1">Programma</font></b></td>
            <td style="border: 1px solid #FFFFFF" bgcolor="#638697">
            <b>
      <font face="Verdana" size="1" color="#FFFFFF">Bestandsbeheer
            Afstandscontrole</font></b></td>
         </tr>
      </table>
      </td>
      <td valign="top" height="24">
      </td>
   </tr>
   <tr>
      <td valign="top">
      <table border="0" width="100%" cellspacing="0" cellpadding="4">
         <tr>
            <td class="blauw_0" width="47">Oplader</td>
            <td class="blauw_1">Lokaal<font color="#00FF00">»</font><font color="#FFFFFF">Extern</font></b></td>
         </tr>
      </table>
      </td>
      <td class="blauw_2" valign="top" align="center"><font size="4"><font color="#FFFF00">
      --</font><font color="#FF0000">»</font></font></td>
      <td class="blauw_2" valign="top" width="74%" >
      <table width="100%"><tr>
      <td width="50%">
         <!--
         $Opladen_1 = new opladen;               // initiatie
         $Opladen_1->ZetTabelTitel("");// dirpad + tabeltitel
         $Opladen_1->ZetStijl("class='tabeltitel'");      //[0]
         $Opladen_1->ZetStijl("");      //[1]
         $Opladen_1->ZetStijl("class='knop'");         //[2]         
         $Opladen_1->ZetStijl("class='knopkl'");         //[3]
         $Opladen_1->ZetStijl("class='ingave'");         //[4]         

         $Opladen_1->MaakHtml();
         -->
      </td>
      </tr>
      </table>

      </td>
      <td valign="top" height="84">

      </td>
   </tr>
   <tr>
      <td valign="top">
      <table border="0" width="100%" cellspacing="0" cellpadding="4">
         <tr>
            <td class="blauw_1">
      <b>
      <font color="#FFFFFF" face="Verdana" size="1">grafische voorstelling</font></b></td>
         </tr>
      </table>
      </td>
      <td class="blauw_2" valign="top" align="center">
         <font size="4"><font color="#FFFF00">--</font><font color="#FF0000">»</font></font></td>
      <td class="blauw_2" valign="top">
         <!--
         $graf_1 = new graf;
         $graf_1->ZetTabelTitel("Algemene Info Externe Map",2);
             $graf_1->ZetHistoriek("Historiek","Bestandsinhoud en grootte van de map");
         $graf_1->ZetLegende("Legende","bar-voorstelling");
         $graf_1->ZetLegende("Leg1","bar-voorstelling");


         $graf_1->ZetWaarde("100");
         $graf_1->ZetWaarde("60");
         $graf_1->ZetWaarde("56");
         $graf_1->ZetWaarde("50");
         $graf_1->ZetTitelWaarde("Aantal bestanden");
         $graf_1->ZetTitelWaarde("Mapgrootte");
         $graf_1->ZetTitelWaarde("Titwaarde3");
         $graf_1->ZetTitelWaarde("Titwaarde4");

         $graf_1->MaakHtml();
         -->

      </td>
      <td valign="top" height="24">&nbsp;</td>
   </tr>
   <tr>
      <td valign="top">
      <table border="0" width="100%" cellspacing="0" cellpadding="4">
         <tr>
            <td class="blauw_1">Externe map</td>
         </tr>
      </table>
      </td>
      <td class="blauw_2" valign="top" align="center">
         <font size="4"><font color="#FFFF00">--</font><font color="#FF0000">»</font></font></td>
      <td class="blauw_2" valign="top">
         <!--
         $oplaaddir="../../testen";
         $Dir_1 = new dir;         // initiatie
         $Dir_1->ZetDirTitel($oplaaddir,"Bestandslijst");// dirpad + tabeltitel

         $Dir_1->ZetKol("Bestandsnaam");     // kolomtitel
         $Dir_1->ZetKol(" Grootte");         // kolomtitel
         $Dir_1->ZetKol(" v");               // kolomtitel 
         $Dir_1->ZetKol(" h");               // kolomtitel
         $Dir_1->ZetKol(" o");               // kolomtitel
 

         $Dir_1->ZetStijl("class='tabel'");      //[0] 
         $Dir_1->ZetStijl("class='hoofding'");   //[1]
         $Dir_1->ZetStijl("class='kolhoofd'");   //[2]
         $Dir_1->ZetStijl("class='kolgeel'");   //[3]
         $Dir_1->ZetStijl("class='kolgroen'");   //[4]
         $Dir_1->ZetStijl("class='kolrood'");   //[5]
         $Dir_1->ZetStijl("class='kollichtblauw'");   //[6]
         $Dir_1->ZetStijl("class='kolblauw'");   //[7]
         $Dir_1->ZetStijl("class='kolgeel'");      //[8]
         $Dir_1->ZetStijl("class='kolgroen'");      //[9]
         $Dir_1->ZetStijl("class='kolblauw'");      //[10]
         
         $Dir_1->ZetAG_tabel("align='left' valign='top' width='580' bgcolor='#638697'");
         $Dir_1->ZetAG_td("bgcolor='#8AA1AC'");

         $Dir_1->MaakHtml();      // geef de records weer
         -->         
      </td>
      <td valign="top" height="24">&nbsp;</td>
   </tr>
   <tr>
      <td width="152" valign="top">&nbsp;</td>
      <td valign="top" width="38" align="center"></td>
      <td valign="top">
      <p align="right"><font color="#FFFFFF" face="Arial Narrow" size="1">pw
      Tribuun.com</font></td>
      <td valign="top" height="19" width="7">&nbsp;</td>
   </tr>
</table>
</body>
</html>
 


4.alg_javafunc.js
 
Code:

/* voor het uitklappen van de contents */
var ns6=document.getElementById&&!document.all?1:0

function haalelement(el) {
    var tagList = new Object
    for (var i = 1; i < arguments.length; i++)
      tagList[arguments[i]] = true
    while ((el!=null) && (tagList[el.tagName]==null))
      el = el.parentElement     
    return el
  }

function lichtband(janee) {
    var el = haalelement(event.srcElement,"TD")
    if (el==null) return
    if ((el.tagName=="TD")) {
      var rij = haalelement(el, "TR")
      if (janee)
        rij.className = "rijover"
      else
        rij.className = ""
                    }
  }
 


5.klasse_template.php
 
Code:

<?php 
$codevlag = 0;
class template

   
    var $html_oud = array();      //    Originele htmlcode in array [html_oud] lezen
    var $hou_vars = array();      //    De gelezen variabelen opslaan in array [hou_vars] 
    var $html_nieuw = array();      //    De gelezen en bijgewerkte code opslaan in [html_nieuw]

    function template($html_map)
    {
        if( !is_dir( $html_map ) )
        {
            die("template(): $html_map : Deze map werd niet gevonden.");
        }
        $this->map['html_map'] = $html_map;
    }


    function LaadBestand($file_array)      // Aan te passen code in array html_oud lezen
    {
        foreach( $file_array as $html_var=>$filename )
        {
            $tplbest = $this->map['html_map'] . $filename;
            $this->html_oud[$html_var] = implode( "", @file($tplbest) );
        }
    }

 
    function varRef( $greep, $html_varArray )
    {     
        if( !empty( $this->html_oud[$greep] ) )
        {
            foreach( $html_varArray as $html_var=>$replace )
            {
                $this->hou_vars['{' . $html_var . '}'] = $replace;      // Alle waarden tussen {} in array [hou_vars] lezen
            }
        }
    }

    function parse( $greep )
    {
        if( empty( $greep ) )
        {
            die("parse(): $de greep was leeg.");
        }
        if( !empty( $this->html_oud[$greep] ) )
        {
                
            $this->html_nieuw[$greep] = $this->maakeindcode( $greep );
            eval( $this->html_nieuw[$greep] ); // omzetten in waarden
           
        }
    }

    function maakeindcode( $greep )
    { 
      $code = $this->html_oud[$greep];
        $eindcode = explode( "\n", $code );
        $aantregels = sizeof( $eindcode ); 
        for( $x = 0; $x < $aantregels; $x++ )
        {
            foreach( $this->hou_vars as $php_vars=>$replace )      // Vervang de html_vars met de echte waarden uit het php-bestand
            {
                //if( preg_match( "/^(.*)" . $php_vars . "(.*)$/", $eindcode[$x] ) )
                if( preg_match( " $php_vars ", $eindcode[$x] ) )
                {
                    $eindcode[$x] = preg_replace( "{". $php_vars ."}", "\\1" . $replace . "\\2", $eindcode[$x] );           
                }
            }
           
            if (trim($eindcode[$x]) == "<!--"){
            $eindcode[$x] = "";
            $codevlag = 1;
            }
            if (trim($eindcode[$x]) == "-->"){
            $eindcode[$x] = "<br>";
            $codevlag = 0;           
            }
            if ($codevlag == 0) {
            $eindcode[$x] = 'print \'' . $eindcode[$x] . '\' . "\\n";';
            }
        }
        $code = implode("\n", $eindcode);
        return $code;
    }
}
?>
 


Opmerking : om gemakkelijk te kunnen werken met de tpl-bestanden aangaande dessign is het best het stijl-bestand ook in de map van de templates te zetten.Tijdens de uitvoering van de php-code wordt het stijlbestand gelezen vanuit de map waarin de php_top bestanden staan.
 

Copyright (c) 2005 :: willems piet