[ PHPXref.com ] [ Generated: Sun Jul 20 19:18:17 2008 ] [ Pagetool 1.07 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> style.php (source)

   1  <?php
   2  /*
   3      Pagetool
   4      http://www.mediajumpstart.org/index.php?name=pagetool
   5      Copyright 2001 Pagetool Development Team, info@pagetool.org
   6      $Id: style.php,v 1.3 2002/12/01 20:41:57 daveguerin Exp $
   7  
   8      myphpPagetool
   9      http://sourceforge.net/projects/myphppagetool
  10      (C) 2000 by Sebastian Bunka <Sebastian.Bunka@vu-wien.ac.at>
  11  
  12      This file is part of Pagetool. Pagetool is a modification
  13      of myphpPagetool.
  14  
  15      Pagetool is free software; you can redistribute it and/or
  16      modify it under the terms of the GNU General Public License
  17      as published by the Free Software Foundation; either version
  18      2 of the License, or (at your option) any later version.
  19  */
  20  
  21  /*
  22      Please modify this file to fit your designs tastes. Don't be 
  23      intimidated by all the php code! You don't need to know any 
  24      php to change the style sheets.  
  25  
  26      Below is a description of the style declarations we have set 
  27      up by default. (We recommend that at a minimum you keep these 
  28      declarations. You can change their values and you can add new 
  29      declarations, but if delete these default ones, Pagetool 
  30      systems messages won't display consistantly.)
  31  
  32  A:link      Style of any A (links) tags
  33  A:visited   Style of any visited A (links) tags
  34  BODY        Style of the BODY of the page
  35  TD          Style of any TD on a page. Set as well as BODY because Netscape ignores the BODY style in a TD
  36  .header1    The largest text on your site.
  37  .header2    The second largest text on your site.
  38  .header3    You get the picture...
  39  .text1      Normal text.
  40  .text2      Text with emphasis (we use a different color, but you could use italics, for example)
  41  .text3      Small text.
  42  
  43      If you want to change the values of these declarations, scroll
  44      to the bottom of the page -- to where is says MODIFY STYLES HERE.
  45  
  46  
  47  /* This $dev variable, if set to 1, allows the style sheet to be viewed in the browser directly.
  48     So style.php?dev=1 will display as text/html. style.php or style.php?dev=0 will dispaly as text/css.
  49     If style.phh?dev=1 is called as a stylesheet, the browser will NOT be able to interpret the styles.
  50     $dev MUST be set to 0 therefore, for this file to act as a stylesheet.
  51  */
  52  
  53  if ($dev)
  54  {
  55      $br="<br>\n";
  56  }
  57  else
  58  {
  59      $br="\n";
  60      // Send out headers to tell the browser this is a stylesheet, and that it should be cached
  61      header("Content-Type: text/css");
  62      header("Cache-Control: must-revalidate, max-age=86400, s-max-age=86400");
  63      header("Last-modified: ".gmdate("D, d M Y H:i:s", time())." GMT");
  64      header("Expires: ".gmdate("D, d M Y H:i:s", time() + 86400)." GMT");
  65  }
  66  // this function returns the font size and units required
  67  function pt_font_size($size)
  68  {
  69      global $font_base,$font_unit,$br;
  70      if ("px" == $font_unit)
  71      {
  72          $fsize = round($font_base * $size, 0);
  73      }
  74      elseif ("em" == $font_unit)
  75      {
  76          $fsize = round($font_base * $size, 1);
  77      }
  78      else
  79      {
  80           $fsize = round($font_base * $size, 1);
  81      }
  82      return("font-size:" . $fsize . $font_unit . ";" . $br);
  83  }
  84  
  85  /* include and initiate the class.
  86     phpSniff is by Roger Raymond, see http://sourceforge.net/projects/phpsniff/
  87     If the location of the class files is not the same directory as the stylesheet
  88     then the include statment will need to include the path */
  89  
  90  include ("src/third_party/phpSniff.core.php");
  91  include ("src/third_party/phpSniff.class.php");
  92  $client = new phpSniff($ua,0);
  93  $client->init();
  94  
  95  // echo a style sheet header remark
  96  
  97  echo "/* This is a dynamic stylesheet produced by Pagetool for";
  98  echo " browser " . $client->property('browser');
  99  echo " version " . $client->property('version');
 100  echo " running on " . $client->property('platform');
 101  echo " with os " . $client->property('os');
 102  echo " */" . $br;
 103  
 104  // set variables for each style, if the variable is later set to 0 the style will not be echoed
 105  $alink = 1;
 106  $avisited = 1;
 107  $body = 1;
 108  $td = 1;
 109  $header1 = 1;
 110  $header2 = 1;
 111  $header3 = 1;
 112  $text1 = 1;
 113  $text2 = 1;
 114  $text3 = 1;
 115  $font_unit = "em"; // the default font unit
 116  $font_base = 1; // the default font size (in the default font unit!)
 117  
 118  // Now set various variables depending on platform and browser and browser version
 119  
 120  // em is displayed as px on ie3 so reset the base size, and use px as the unit
 121  
 122  if ("ie"==$client->property('browser') AND ($client->property('version')-3)<1)
 123  {
 124      $font_unit = "px";
 125      $font_base = "12";
 126  }
 127  // make the base font size a bit bigger for the mac
 128  if ("mac" == $client->property('platform'))
 129  {
 130      $font_base = $font_base * 6/5;
 131  }
 132  
 133  // add in other browser specific stuff here
 134  
 135  /* 
 136  *************************
 137  *************************
 138   MAKE YOUR CHANGES BELOW
 139  *************************
 140  *************************
 141  
 142  Below is where you can modify the style sheet to suit
 143  you design tastes. If you are wondering, the $br's are 
 144  simply line breaks, which makes the code eaiser to 
 145  trouble shoot. They are optional.
 146  */
 147  
 148  /* Change the font family. If you use a font with a space 
 149  in it, be sure to add esacped quotes around it, for example:
 150  
 151  \"Arial Black\"
 152  
 153  ...But who would want to use arial black? 
 154  */
 155  
 156  $fontfamily = "font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;" . $br; // the default font family string
 157  
 158  /* Below you can change any of the color, background color, or size
 159  values as you please. Size values are in decimals, with "1" set as the
 160  default base size. Therefore, 1.5 would be very big and .5 would be 
 161  very small. */ 
 162  
 163  if ($alink)
 164  {
 165      echo "A:link{" . $br;
 166      echo "color:#000066;" . $br;
 167      echo "background-color:#FFFFFF;" . $br;
 168      echo "}" . $br;
 169  }
 170  if ($avisited)
 171  {
 172      echo "A:visited{" . $br;
 173      echo "color:#660000;" . $br;
 174      echo "background-color:#FFFFFF;" . $br;
 175      echo "}" . $br;
 176  }
 177  if ($body)
 178  {
 179      echo "BODY{" . $br;
 180      echo "background:#FFFFFF;" . $br;
 181      echo $fontfamily;
 182      echo "}" . $br;
 183  }
 184  if ($td)
 185  {
 186      echo "TD{" . $br;
 187      echo "background:#FFFFFF;" . $br;
 188      echo $fontfamily;
 189      echo "}" . $br;
 190  }
 191  if ($header1)
 192  {
 193      echo ".header1{" . $br;
 194      echo "color:#000033;" . $br;
 195      echo "background-color:#FFFFFF;" . $br;
 196      echo pt_font_size(1.3);
 197      echo "font-weight:bold;" . $br;
 198      echo "}" . $br;
 199  }
 200  if ($header2)
 201  {
 202      echo ".header2{" . $br;
 203      echo pt_font_size(1);
 204      echo "}" . $br;
 205  }
 206  if ($header3)
 207  {
 208      echo ".header3{" . $br;
 209      echo pt_font_size(0.8);
 210      echo "}" . $br;
 211  }
 212  if ($text1)
 213  {
 214      echo ".text1{" . $br;
 215      echo pt_font_size(0.8);
 216      echo "}" . $br;
 217  }
 218  if ($text2)
 219  {
 220      echo ".text2{" . $br;
 221      echo "color:#000033;" . $br;
 222      echo "background-color:#FFFFFF;" . $br;
 223      echo pt_font_size(0.8);
 224      echo "font-weight:bold;" . $br;
 225      echo "}" . $br;
 226  }
 227  if ($text3)
 228  {
 229      echo ".text3{" . $br;
 230      echo pt_font_size(0.6);
 231      echo "}" . $br;
 232  }
 233  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]