|
|
|
|
|
|
| |
|
<?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
?> | | |
|
| GonxTabs : Create elegant HTML tabs based interface Categories : Navigation, HTML, HTML and PHP, PHP | | | 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 | | | class formHTML build your HTML Forms from PHP Categories : PHP, PHP Classes, HTML and PHP, HTML | | | Record Set Paging with PHP (RSP) Categories : PHP, MySQL, Navigation, Databases, HTML and PHP | | | Database resultset navigation Categories : PHP, HTML and PHP, Databases, MySQL, Navigation | | | webcam cam view image ispy browser independant Categories : Graphics, HTML, HTML and PHP, PHP | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | A script to generate a report from a valid mysql connection. The user has to supply which fields he wants to display in table. All properties are changable.
Categories : PHP, PHP Classes, Databases, MySQL, HTML and PHP | | | How To Create a PDF Using PHP Categories : PHP, PDF, PHP Classes, HTML and PHP | | | Popup Menu 0.5, popup, select, html, state-maintaing Categories : HTML, PHP, HTML and 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 | | | Gonx URLs - This class is meant to generate URLs for accessing application dynamically generated pages based on parameters passed in the URL.
Categories : PHP, PHP Classes, Navigation, URLs | | | Powerful php/mysql Pagination for up to 6 URL Params Categories : PHP, PHP Classes, Databases, MySQL, Navigation | | | TreeView - Finally a working tree view function to be used as you want. Simple create the Table using the code provided and you will be able to have a tree view in your project. Download the zip to get the images. Categories : PHP, HTML and PHP, Navigation | | | CachedFastTemplate class, extends CDI's FastTemplate to allow page caching Categories : HTML and PHP, HTML, PHP Classes | |
| | | | 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
| |
|
|