PHP/HTML — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:37, 26 мая 2010
- Authentication
- Content Types
- HTML
- HTML Cohabitation
- HTML File
- HTML String
- HTML Table
- HTTP_REFERER
- HTTP_Request
- HTTP_USER_AGENT
- Hyperlink
- PATH_INFO
- REMOTE_ADDR
- Table Utilities
- Web Color
- _FILES
- get_html_translation_table
- get_meta_tags
- header
- headers_sent
- html_entity_decode
- htmlentities
- htmlspecialchars
- http_build_query
- rawurldecode
- tidy_clean_repair
- tidy_parse_file
- tidy_parse_string
Define function to change HTML text font
<source lang="html4strict">
<?php function fontWrap($txt,$fontsize = "12pt") {
echo "".$txt."";
}
fontWrap("A Heading
","24pt");
fontWrap("some body text
");
fontWrap("smaller body text
");
fontWrap("even smaller body text
");
?>
</source>
Use Php class to control the HTML page font
<source lang="html4strict">
<?php class MyPageFont{
var $header_face = "Tahoma"; var $header_size = "7"; var $body_face = "Times New Roman"; var $body_size = "5"; var $footer_face = "Letter Gothic"; var $footer_size = "2"; function set_header($face, $size) { $this->header_face = $face; $this->header_size = $size; } function set_body($face, $size) { $this->body_face = $face; $this->body_size = $size; } function set_footer($face, $size) { $this->footer_face = $face; $this->footer_size = $size; } function header_text($text) { echo "header_face . "" size="" . $this->header_size . "">"; echo $text; echo ""; } function footer_text($text) { echo "footer_face . "" size="" . $this->footer_size . "">"; echo $text; echo ""; } function body_text($text) { echo "body_face . "" size="" . $this->body_size . "">"; echo $text; echo ""; }
}
$style = new MyPageFont();
$style->header_text("
this is a header");
$style->set_header("Tahoma", 6);
$style->header_text("
this is a modified header");
$style->body_text("
this is a body");
$style->footer_text("
this is a footer");
?>
</source>