Tag Archive for html

Sending html from Mutt

mutt -e "my_hdr Content-Type: text/html" -s "my subject" <a href="mailto:you@xxxxxxxxxxx">you@xxxxxxxxxxx</a> < message.html

source

wrong.html

<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<title>Ridiculously Wrong HTML</title>
</head>
	<style type="text/css" media="screen">
		style1 { display:none; }
		.style2 { display:block; }
		dl { color: orange; }
		dl dt { color: green; }
		dl dt h3 { color: black; }
	</style>
	<!--[if IE 6]> 
	<style type="text/css" media="screen">
		.style2 { display: inline-block; }
		section { border: 1px solid rgb(255,255,255);}
	</style>
	<![endif]-->
	
<body>
	<header>
		<h1>Ridiculously Wrong HTML<h1>
	</header>
	<section id="main">
		<div id="container" class="style1">
			<h3>This should not show up.</h3>
		</div>
		<div id="container" class="style2">
			<h3>This should show up</h3>
			<dl>
				<dt><h3>The Internet</h3></dt>
				<dd><p>A collection of tubes.</p></dd>
			</dl>
		</div>
		<table>
			<tbody>
				<th>List of Tubes</th>
				<th>Length</th>
			</tbody>
			<td>Tube 1</td>
			<td>5 ft</td>
		</table>
	</section>
	<footer>
		
	</footer>
	<script>
	
		$(function() {			
			// write a jquery function to remove 
			// the first div from "main" and replace it
			//  with a blue box 15px X 15px
			
		});
		
		for(x=0; x<99; x++) {
			alert(x);
		}
	
	</script>
</body></html>

source

HTML5 Template

<!DOCTYPE html>
<html>
    <head>
        <!-- Meta Content -->
         <meta name="description" content="" />
         <meta name="keywords" content="" />
         <meta name="author" content="Nate Johnson" />
         <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
         <!-- End Meta Content -->
        <title></title>
      <!-- CSS Section -->
      <link rel="stylesheet" type="text/css" href="css/default.css" />
      <!-- End CSS Section -->
    </head>
    <body>
         <!-- Page Content -->
             <div id="container">
           
             </div>
         <!-- End Page Content -->
    </body>
</html>

source

PHP Country Code to HTML Currency Symbol List

function country_currency( $amount = 0 ) {
    $bc = ''; // Set this to your country
    $currency_before = '';
    $currency_after = '';
    
    if( $bc == 'GB' || $bc == 'IE' || $bc == 'CY' ) $currency_before = '&pound;';
    if( $bc == 'AT' || $bc == 'BE' || $bc == 'FI' || $bc == 'FR' || 
        $bc == 'DE' || $bc == 'GR' || $bc == 'GP' || $bc == 'IT' ||
        $bc == 'LU' || $bc == 'NL' || $bc == 'PT' || $bc == 'SI' ||
        $bc == 'ES') $currency_before = '&euro;';
    if( $bc == 'BR' ) $currency_before = 'R$';
    if( $bc == 'CN' || $bc == 'JP' ) $currency_before = '&yen;';
    if( $bc == 'CR' ) $currency_before = '&cent;';
    if( $bc == 'HR' ) $currency_after = ' kn';
    if( $bc == 'CZ' ) $currency_after = ' kc';
    if( $bc == 'DK' ) $currency_before = 'DKK ';
    if( $bc == 'EE' ) $currency_after = ' EEK';
    if( $bc == 'HK' ) $currency_before = 'HK$';
    if( $bc == 'HU' ) $currency_after = ' Ft';
    if( $bc == 'IS' || $bc == 'SE' ) $currency_after = ' kr';
    if( $bc == 'IN' ) $currency_before = 'Rs. ';
    if( $bc == 'ID' ) $currency_before = 'Rp. ';
    if( $bc == 'IL' ) $currency_after = ' NIS';
    if( $bc == 'LV' ) $currency_before = 'Ls ';
    if( $bc == 'LT' ) $currency_after = ' Lt';
    if( $bc == 'MY' ) $currency_before = 'RM';
    if( $bc == 'MT' ) $currency_before = 'Lm';
    if( $bc == 'NO' ) $currency_before = 'kr ';
    if( $bc == 'PH' ) $currency_before = 'PHP';
    if( $bc == 'PL' ) $currency_after = ' z';
    if( $bc == 'RO' ) $currency_after = ' lei';
    if( $bc == 'RU' ) $currency_before = 'RUB';
    if( $bc == 'SK' ) $currency_after = ' Sk';
    if( $bc == 'ZA' ) $currency_before = 'R ';
    if( $bc == 'KR' ) $currency_before = 'W';
    if( $bc == 'CH' ) $currency_before = 'SFr. ';
    if( $bc == 'SY' ) $currency_after = ' SYP';
    if( $bc == 'TH' ) $currency_after = ' Bt';
    if( $bc == 'TT' ) $currency_before = 'TT$';
    if( $bc == 'TR' ) $currency_after = ' TL';
    if( $bc == 'AE' ) $currency_before = 'Dhs. ';
    if( $bc == 'VE' ) $currency_before = 'Bs. ';
    
    if( $currency_before == '' && $currency_after == '' ) $currency_before = '$';
    
    return $currency_before . number_format( $amount, 2 ) . $currency_after;
}

source

Calibre Remote – HTML

<!DOCTYPE html>
<html>
    <head>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta http-equiv="keywords" content="" />
        <meta http-equiv="description" content="" />
        
        <meta name="viewport" content="width=device-width" />

        <title>Calibre Remote WebApp - by pixaweb.co.uk</title>
        
        <link rel="shortcut icon" href="favicon.png" />

        <link rel="stylesheet" href="css/calibre.css" type="text/css" media="screen,print,projection,mobile" />

        <script type="text/javascript" src="js/jquery.js"></script>

    </head>

    <body>

        <div id="wrapper">
        
            <header id="header">
            
                <hgroup>
                    <h1>Calibre Remote Web App</h1>
                    <p>by <a href="<a href="http://www.pixaweb.co.uk"" >http://www.pixaweb.co.uk"</a> target="_blank">Pixaweb.co.uk <img src="favicon.png" alt="Pixaweb - London Web Development" /></a></p>
                </hgroup>

                <section id="server" class="server panel hidden float-left">
                    <section>
                        <div id="host" class="hidden"></div>
                        <div id="port" class="hidden"></div>
                        <div id="username" class="hidden"></div>
                        <div id="password" class="hidden"></div>
                    </section>
                </section>

                <section id="search" class="search panel float-left">
                    <header>
                        <h1>Search</h1>
                    </header>
                    <section>
                        <input type="text" name="search" value="" class="search" />
                        <a href="#search" class="search button">Search</a>
                    </section>
                </section>

                <section id="order" class="order panel float-left">
                    <header>
                        <h1>Order</h1>
                    </header>
                    <section>
                        <ul>
                            <li>
                                <a href="order/ascending" class="active qs-link button">Ascending</a>
                            </li>
                            <li>
                                <a href="order/descending" class="qs-link button">Descending</a>
                            </li>
                        </ul>
                    </section>
                </section>
                
                <section id="sort" class="sort panel float-left">
                    <header>
                        <h1>Sort</h1>
                    </header>
                    <section>
                        <ul>
                            <li class="float-left">
                                <a href="sort/title" class="active qs-link button">Title</a>
                            </li>
                            <li class="float-right">
                                <a href="sort/author" class="qs-link button">Author</a>
                            </li>
                            <li class="float-left float-left-clear">
                                <a href="sort/date" class="qs-link button">Date</a>
                            </li>
                            <li class="float-right float-right-clear">
                                <a href="sort/series" class="qs-link button">Series</a>
                            </li>
                        </ul>
                    </section>
                </section>

                <div class="float-clear"></div>

            </header>

            <section id="content">

                <article class="server config">

                    <header>
                        <h1>Server Config</h1>
                    </header>

                    <section>

                        <dl>

                            <dt>Host</dt>
                            <dd><input type="text" name="host" /></dd>

                            <dt>Port</dt>
                            <dd><input type="text" name="port" value="8080" /></dd>

                            <dt>Username</dt>
                            <dd><input type="text" name="username" /></dd>

                            <dt>Password</dt>
                            <dd><input type="password" name="password" /></dd>

                            <dt></dt>
                            <dd><a class="button save server" href="#connect">Connect</a></dd>

                        </dl>

                    </section>

                </article>

            </section>

        </div>

        <footer id="footer">
            
            <div class="logo">
                <a href="<a href="http://www.pixaweb.co.uk"" >http://www.pixaweb.co.uk"</a> target="_blank">Pixaweb - London Web Development</a>
            </div>
            
            <div class="copyright">
                <p>Copyright &copy; 2010 Pixaweb.co.uk</p>
            </div>

            <div class="privacy">
                <p>Server details are stored temporarily inside page elements; refreshing the page will mean they are reset to defaults. Please see <a href="<a href="http://www.pixaweb.co.uk/projects/Calibre"" >http://www.pixaweb.co.uk/projects/Calibre"</a> target="_blank"><a href="http://www.pixaweb.co.uk/projects/Calibre</a>" >http://www.pixaweb.co.uk/projects/Calibre</a></a> for the Source Code.</p>
            </div>
            
        </footer>

    </body>
    
    <script type="text/javascript" src="js/calibre.js"></script>

</html>

source

Centering Footers

CSS:

.footer {
width:960px;
}

.content_ft {
width:400px;
margin-left: auto !important;
margin-right: auto !important;
}




HTML:


<div class="footer">

<div class="content_ft">

<p>This text should now be centred at the bottom of the page as your footer</p>

</div>

</div>

source

Implode Form Element Array

// implodeFormArray(form name : String, form element name : String, delimiter : String);
function implodeFormArray(f, e, del) {
	var form	= document.forms[f];
	if (typeof(form.elements[e].value) != "undefined") {
		if (form.elements[e].checked) return form.elements[e].value;
		else return '';
	} else {
		var output	= '';
		var len		= form.elements[e].length;
		for(var i=0;i<len;i++) {
			if (form.elements[e][i].checked) {
				output+= (output == '' ? '':del) + form.elements[e][i].value;
			}
		}
		return output;
	}
}

source

PHP – HTML Generation Class

<?php
    /**
     * html
     *
     * @copyright Copyright 2010 (c) Jared Clarke @ Pixaweb.co.uk
     * @author Jared Clarke <<a href="mailto:jared@pixaweb.co.uk">jared@pixaweb.co.uk</a>>
     * @version 0.1
     */
    class html {

        public $element;
        public $innerHTML;
        public $attributes = array();

        private $special = array("img", "input", "hr", "br", "meta", "link");

        public function __construct($element, $innerHTML = NULL, $attributes = NULL) {

            $this->element = $element;

            if(!is_null($innerHTML))
                $this->innerHTML($innerHTML);

            if(!is_null($attributes))
                $this->attributes($attributes);
                
        }

        public function __toString() {
            return $this->generate();
        }

        public function attributes($attributes) {

            $this->attributes = array_merge($this->attributes, (array) $attributes);

            return $this;

        }

        public function innerHTML($innerHTML) {
            
            $this->innerHTML = $innerHTML;

            return $this;

        }

        public function output() {
            return $this->generate();
        }
        
        private function generate() {

            $html = "<{$this->element}";

            if(!empty($this->attributes)) {
                foreach($this->attributes AS $key => $value) {
                    // allow boolean array("disabled" => true);
                    if(is_bool($value)) {
                        // most browsers support <.. disabled OR disabled="disabled" />
                        if(!$value) continue;

                        $value = $key;

                    }

                    $html .= ' '. $key .'="'. $value .'"';

                }
            }

            if(in_array($this->element, $this->special)) {

                $html .= "/>";

                return $html;

            }

            $html .= ">{$this->innerHTML}</{$this->element}>";

            return $html;

        }

    }
    
    $input = new html("input");
    echo $input->attributes(array("name" => "test", "value" => "testing", "disabled" => true))->output();
    // <input name="test" value="testing" disabled="disabled"/>

    echo new html("a", "Link Text", array("href" => "<a href="http://www.google.com"));" >http://www.google.com"));</a>
    // <a href="<a href="http://www.google.com">Link" >http://www.google.com">Link</a> Text</a>

    $html = new html("a");
    $html->innerHTML("Link Text");
    $html->attributes(array("href" => "<a href="http://www.google.com"));" >http://www.google.com"));</a>
    echo $html->output();
    // <a href="<a href="http://www.google.com">Link" >http://www.google.com">Link</a> Text</a>
    
    echo $html->innerHTML("Link Text")->attributes(array("href" => "<a href="http://www.google.com"))->output();" >http://www.google.com"))->output();</a>
    // <a href="<a href="http://www.google.com">Link" >http://www.google.com">Link</a> Text</a>
    
    $html->innerHTML = "Override Text";
    echo $html->output();
    // <a href="<a href="http://www.google.com">Override" >http://www.google.com">Override</a> Text</a>
    
    $html->attributes["href"] = "<a href="http://www.yahoo.com";" >http://www.yahoo.com";</a>
    echo $html->output();
    // <a href="<a href="http://www.yahoo.com">Override" >http://www.yahoo.com">Override</a> Text</a>
    
?>

source

Call ASP Page Inside HTML page

<!-- #exec CGI="/_assets/behaviour/example.asp -->

source

UTF to HTML

function utf8_to_html($data) {
	return preg_replace("/([xC0-xF7]{1,1}[x80-xBF]+)/e", '_utf8_to_html("1")', $data);
}

function _utf8_to_html($data) {
	$ret = 0;
	foreach((str_split(strrev(chr((ord($data{0}) % 252 % 248 % 240 % 224 % 192) + 128) . substr($data, 1)))) as $k => $v)
		$ret += (ord($v) % 128) * pow(64, $k);
	return "&#$ret;";
}

source