WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : A simple class with some HTML output functions that would come in handy for consistent page layout etc.
Categories : PHP, PHP Classes, HTML and PHP, HTML, Navigation Update Picture
JJ Harrison
Date : Oct 13th 2002
Grade : 3 of 5 (graded 6 times)
Viewed : 10318
File : No file for this code example.
Images : No Images for this code example.
Search : More code by JJ Harrison
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?php
// html output class
// if you were going to use this for a site i would recommend having it in
// an include file with these lines of code after the class creation:
// $htmlout = new htmlout;
// $htmlout->initialize('<sitedomain>', '<sitetitle>',);
// replace <sitedomain> with your site url and <sitetitle> with its default title.. eg Weberdev
// Free for use etc, if it is a personal site a link to www.co2busters.org would be heavily appreciated.

class htmlout {
 
   
//declare class variables
   
var $base_url;//Default Base url
   
var $site_name;//Title for entire site
 
   
function initialize($base_url, $site_name)
    {
//initialize class variables
     
$this->base_url = $base_url;
     
$this->site_name = $site_name;
    }
   
    function
head($title, $keywords = '', $description = '')
  {
// does the html header for the page
   
?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
    <html>
    <head>
    <title><?=$this->site_name.' - '.$title?></title>
      <meta name="description" content=><?=$description?>">
    <meta name="keywords" content=><?=$keywords?>">
    </head>
    <body>
      <?
        $this
->do_h($this->site_name.' - '.$title, 1);
  }
   
  function
foot($time = 0)
  {
// does the html header for the page
     
if($time != 0){
        echo
'<p>'.date('r');
        }
   
?>
    </body>
        </html>
      <?
 
}
   
    function
print_link($name, $a, $def = true)
    {
// useful in many cases - for instance a domain change or dynamic menu
working
everywhere
.
      if(
$def = true)
        {
// Default
       
echo '<a href="'.$this->site_name.$a.'">'.$name.'</a>';
        } else {
// Incase you want to link elsewhere...
       
echo '<a href="'.$a.'">'.$name.'</a>';
        }
    }

    function
do_h($text, $hsize = 2)
    {
        echo
'<h'.$hsize.'>'.$text.'</h'.$hsize.'>';
    }
   
}
?>


Usage Example
<?php
$htmlout
= new htmlout;
$htmlout->initialize('http://www.example.com', 'Cool stuff');
$htmlout->head('Home', $keywords = 'global, warming, climate, abatement, greenhouse,sequestration, pollution, solution, enviroment, sustainablity, ecology, waste',
$description = 'The Global Warming, Climate Change, Greenhouse Effect, Sequestration and Pollution Resource');
echo
'Tons of really interesting stuff etc. Blah Blah.<br>';
$htmlout->do_h('This is at the default heading size.');
$htmlout->do_h('This isn\'t.', 3);
$htmlout->do_h('Links!!', 1);
$htmlout->print_link('Example 1<br>', 'nonexistant.htm');
$htmlout->print_link('TecEco (CO2busters Sponsor)<br>', 'http://www.tececo.com', false);
$htmlout->print_link('CO2Busters (My Hobby Site!)<br>', 'http://www.co2busters.org', false);
$htmlout->foot(1);// footer with timestamp
?>



Automatic generation of HTML code for a table. OO interface. Can define colspan, rowspan, table style, cell style, and data style. Simple, but effective.
Categories : PHP, PHP Classes, HTML, HTML and PHP
GonxTabs : Create elegant HTML tabs based interface
Categories : Navigation, HTML, HTML and PHP, PHP
class formHTML build your HTML Forms from PHP
Categories : PHP, PHP Classes, HTML and PHP, HTML
Powerful php/mysql Pagination for up to 6 URL Params
Categories : PHP, PHP Classes, Databases, MySQL, Navigation
Browser Detecor Class
Categories : PHP Classes, PHP, HTML
Display Slashdot headers on your own site
Categories : HTML and PHP, HTML, PHP
webcam cam view image ispy browser independant
Categories : Graphics, HTML, HTML and PHP, PHP
Record Set Paging with PHP (RSP)
Categories : PHP, MySQL, Navigation, Databases, HTML and PHP
Vote-Poll script that has a wrapper class that allows the user to create multiple polls on the same page with little trouble.
Categories : PHP, PHP Classes, HTML and PHP
This script shows you the 7th latest php items from the mailing list archive on zend.com
Categories : HTML, HTML and PHP, HTTP, PHP
Class to build a select tag in html, useful to build select boxes from a data base
Categories : PHP, HTML and PHP, PHP Classes
How to preset a text string in a textarea input field
Categories : HTML, HTML and PHP, PHP, Beginner Guides
Snipe.Net's Web Design Color Scheme Previewer- Allows uses to input hex codes for their text, background, and link colors, and preview the color scheme with their background image. Example: http://www.snipe.net/tech/snipeschool/hex.php3
Categories : PHP, HTML and PHP, General, Graphics, HTML
XML Menu
Categories : PHP, PHP Classes, Navigation, XML, XSL
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
 Keith Ganger wrote :1059
Using a template engine like Smarty or fast templates is a much better way present a consistant easy to modify UI