Advertisement
Guest User

page.inc

a guest
Feb 2nd, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.73 KB | None | 0 0
  1. <?php
  2. class page{
  3.     public $content;
  4.     public $title = "TLA consultanting Agency";
  5.     public $keywords = "TLA, consultanting, etc";
  6.    
  7.     public $buttons = array(
  8.                             "Home"     => "home.php",
  9.                             "Contact"  => "contact.php",
  10.                             "Services" => "services.php",
  11.                             "Site Map" => "map.php"
  12.                             );
  13.     public function __set($name, $value){
  14.         $this -> $name = $value;
  15.     }
  16.    
  17.     public function display(){
  18.     echo"<html>\n<head>\n";
  19.     $this -> DisplayTitle();
  20.     $this -> DisplayKeywords();
  21.     $this -> DisplayStyles();
  22.     echo "</head>\n<body>\n";
  23.     //$this -> DisplayHeader();
  24.     $this -> DisplayMenu($this->$buttons);
  25.     echo $this->content;
  26.     //$this -> DisplayFooter();
  27.     echo "</body>\n</html>\n";
  28.     }
  29.    
  30.     public function DisplayTitle(){
  31.         echo"<title>". $this->title."</title>";
  32.     }
  33.     public function DisplayKeywords(){
  34.         echo "<meta name=\"Keywords\"
  35.                 content=\"".$this->keywords."\"/>";
  36.     }
  37.    
  38.     public function DisplayStyles()
  39.     {
  40.     ?>
  41.     <style>
  42.         h1 {
  43.             color:white; font-size:24pt; text-align:center; text-align:center;
  44.             font-family:arial, san-serif
  45.         }
  46.         .menu{
  47.             color:white; font-size:12pt; text-align:justify;
  48.             font-family:arial, san-serif; font-weight:bold
  49.         }
  50.         td{
  51.             background:black
  52.         }
  53.         p{
  54.             color:black; font-size:12pt; text-align:justify;
  55.             font-family:arial, san-serif
  56.         }
  57.         p.foot{
  58.             color:white; font-size:9pt; text-align:center;
  59.             font-family:arial, san-serif; font-weight: bold
  60.         }
  61.         a:link, a:visited, a:active{
  62.             color:white
  63.         }
  64.     </style>
  65.     <?php}
  66.    
  67.     public function DisplayHeader(){?>
  68.    
  69.     <table width="100%" cellpadding="12"
  70.     cellspacing="0" border="0">
  71.     <tr bgcolor="black">
  72.     <td align="left"><img src="logo.png"/></td>
  73.     <td>
  74.         <h1>TLA Consultanting Pty LTD</h1>
  75.     </td>
  76.     <td align="right"><img src="logo.png"/></td>
  77.     </tr>
  78.     </table>
  79.     <?php
  80.     }
  81.    
  82.     public function DisplayMenu($buttons){
  83.         echo"<table width=\"100%\" bgcolor=\"white\" cellpadding=\"4\" cellspacing=\"4\">\n";
  84.         echo"</tr>\n";
  85.         $width = 100/count($buttons);
  86.         while(list($name,$url) = each($buttons)){
  87.             $this -> DisplayButton($width, $name, $url,!$this->IsUrlCurrentPage($url));
  88.         }
  89.         echo"</tr>\n";
  90.         echo"</table>\n";
  91.     }
  92.    
  93.     public function IsUrlCurrentPage($url){
  94.     if(strpos($_SERVER['PHP_SELF'],$url) == false){
  95.         return false;
  96.     }
  97.     else{
  98.         return true;
  99.     }
  100.     }
  101.    
  102.     public function DisplayButton($width, $name, $url, $active = true){
  103.         if ($active){
  104.             echo "<td width= \"". $width . "%\">
  105.             <a href=\"". $url ."\">
  106.             <img src=\"s-logo.png\" alt=\"".$name."\" border=\"0\"/></a>
  107.             <a href=\"".$url."\"><span class=\"menu\">".$name."</span></a></td>";
  108.         }
  109.         else{
  110.             echo "<td width= \"". $width . "%\">
  111.             <img src=\"s-logo.png\">
  112.             <span class=\"menu\">".$name."</span></td>";
  113.         }
  114.     }  
  115. }
  116. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement