How to include a web page in to another

Server Side Includes

SSI, or Server Side Includes: Use to include html files.
<!–#include virtual=”path to file/include-file.html” –>

PHP

PHP is a server side programming language: Use this to inlcude php pages or html pages

Simple:
<?php include(“your_file.html”); ?>
Or
<?php
require($DOCUMENT_ROOT . “your_file.html”);
?>

ASP

Active Server Pages are server side programming languages: Use this to inlcude asp pages or html pages
<!–#include file=”your_file.html”–>

JavaScript

JavaScript is a client side programming language (processed by your browser, no the server): You must take your html code, place it in side of a javascript document.write function to be printed to the screen. Be sure to fix your html quote marks by adding a backslash to the front of each one.  Save the file and include it using below.

<script type=”text/javascript” src=”your_file.js”> </script>

A list of htaccess Tutorials

First off, here are a few samples. The first thing you will need to do is add these two lines at the top of your .htacccess file:

Options +FollowSymlinks
RewriteEngine on

RewriteRule:
Say you’ve change from using html files to dynamic PHP files. Instead of changing your nav links to point to php files, you can force all url path that end with .html to .php like so:

RewriteRule ^(.*).html$ $1.php [NC]

RewriteCond (Rewrite Condition)
If you have query string in the page and you want them to be carried over to the new page, you have to set a rewrite condition for query strings. The example below first sets the query condition in line one and than redirects from one web page a new web page using in line two. It uses this bit of text “(.+)” to grab the query and “%1″ to pass it to the new page:

RewriteCond %{QUERY_STRING} (.+)
RewriteRule ^webpage.php /new_webpage.php?%1

Convert url directory paths to a query string.
RewriteRule (.*) /index.php?paths=$1

Convert url directory paths to a query string using custom folder paths.
This one only does it if you’re under directory “sell”. So if users are under “/sell/computers/mac/”
you can send “computers/mac” as the category and do a split on the “/” slash to seperate them.
RewriteRule ^sell/(.*) /sell.php?category=$1


ErrorDocument :
Here’s how to customize or ignore your error messaging. You can do this by targeting a file like this:

ErrorDocument 404 /dir/home.html
ErrorDocument 403 /custom_error_message.html

Here are a few more site I found helpful.

Custom HTTP Errors via htaccess:

http://perishablepress.com/press/2008/03/18/custom-http-errors-via-htaccess/

Custom dynamic redirecting and rewriting

http://corz.org/serv/tricks/htaccess2.php

US State Pulldown Menu List

I am always looking for a list of the US states to populate a pulldown menu so I’m posting it here. This one however has some PHP code to help select the current state if predefined.

<select name="state" id="state">
<option value="AL" <?PHP if($state=="AL") echo "selected";?>>Alabama</option>
<option value="AK" <?PHP if($state=="AK") echo "selected";?>>Alaska</option>
<option value="AZ" <?PHP if($state=="AZ") echo "selected";?>>Arizona</option>
<option value="AR" <?PHP if($state=="AR") echo "selected";?>>Arkansas</option>
<option value="CA" <?PHP if($state=="CA") echo "selected";?>>California</option>
<option value="CO" <?PHP if($state=="CO") echo "selected";?>>Colorado</option>
<option value="CT" <?PHP if($state=="CT") echo "selected";?>>Connecticut</option>
<option value="DE" <?PHP if($state=="DE") echo "selected";?>>Delaware</option>
<option value="DC" <?PHP if($state=="DC") echo "selected";?>>District of Columbia</option>
<option value="FL" <?PHP if($state=="FL") echo "selected";?>>Florida</option>
<option value="GA" <?PHP if($state=="GA") echo "selected";?>>Georgia</option>
<option value="HI" <?PHP if($state=="HI") echo "selected";?>>Hawaii</option>
<option value="ID" <?PHP if($state=="ID") echo "selected";?>>Idaho</option>
<option value="IL" <?PHP if($state=="IL") echo "selected";?>>Illinois</option>
<option value="IN" <?PHP if($state=="IN") echo "selected";?>>Indiana</option>
<option value="IA" <?PHP if($state=="IA") echo "selected";?>>Iowa</option>
<option value="KS" <?PHP if($state=="KS") echo "selected";?>>Kansas</option>
<option value="KY" <?PHP if($state=="KY") echo "selected";?>>Kentucky</option>
<option value="LA" <?PHP if($state=="LA") echo "selected";?>>Louisiana</option>
<option value="ME" <?PHP if($state=="ME") echo "selected";?>>Maine</option>
<option value="MD" <?PHP if($state=="MD") echo "selected";?>>Maryland</option>
<option value="MA" <?PHP if($state=="MA") echo "selected";?>>Massachusetts</option>
<option value="MI" <?PHP if($state=="MI") echo "selected";?>>Michigan</option>
<option value="MN" <?PHP if($state=="MN") echo "selected";?>>Minnesota</option>
<option value="MS" <?PHP if($state=="MS") echo "selected";?>>Mississippi</option>
<option value="MO" <?PHP if($state=="MO") echo "selected";?>>Missouri</option>
<option value="MT" <?PHP if($state=="MT") echo "selected";?>>Montana</option>
<option value="NE" <?PHP if($state=="NE") echo "selected";?>>Nebraska</option>
<option value="NV" <?PHP if($state=="NV") echo "selected";?>>Nevada</option>
<option value="NH" <?PHP if($state=="NH") echo "selected";?>>New Hampshire</option>
<option value="NJ" <?PHP if($state=="NJ") echo "selected";?>>New Jersey</option>
<option value="NM" <?PHP if($state=="NM") echo "selected";?>>New Mexico</option>
<option value="NY" <?PHP if($state=="NY") echo "selected";?>>New York</option>
<option value="NC" <?PHP if($state=="NC") echo "selected";?>>North Carolina</option>
<option value="ND" <?PHP if($state=="ND") echo "selected";?>>North Dakota</option>
<option value="OH" <?PHP if($state=="OH") echo "selected";?>>Ohio</option>
<option value="OK" <?PHP if($state=="OK") echo "selected";?>>Oklahoma</option>
<option value="OR" <?PHP if($state=="OR") echo "selected";?>>Oregon</option>
<option value="PA" <?PHP if($state=="PA") echo "selected";?>>Pennsylvania</option>
<option value="RI" <?PHP if($state=="RI") echo "selected";?>>Rhode Island</option>
<option value="SC" <?PHP if($state=="SC") echo "selected";?>>South Carolina</option>
<option value="SD" <?PHP if($state=="SD") echo "selected";?>>South Dakota</option>
<option value="TN" <?PHP if($state=="TN") echo "selected";?>>Tennessee</option>
<option value="TX" <?PHP if($state=="TX") echo "selected";?>>Texas</option>
<option value="UT" <?PHP if($state=="UT") echo "selected";?>>Utah</option>
<option value="VT" <?PHP if($state=="VT") echo "selected";?>>Vermont</option>
<option value="VA" <?PHP if($state=="VA") echo "selected";?>>Virginia</option>
<option value="WA" <?PHP if($state=="WA") echo "selected";?>>Washington</option>
<option value="WV" <?PHP if($state=="WV") echo "selected";?>>West Virginia</option>
<option value="WI" <?PHP if($state=="WI") echo "selected";?>>Wisconsin</option>
<option value="WY" <?PHP if($state=="WY") echo "selected";?>>Wyoming</option>
</select>

Flash AS2 using setInterval and clearInterval as a timer

SetInterval comes in handy as a timers or to set time delays for action events. To stop the setInterval from repeating use the the clearInterval(myID) function using the id that you specified for the setInterval. See code sample below for a fully functional counter that ends after 4 seconds. Note that setIntervals time is in milliseconds. So 1000 = 1 second.

var count = 0;
var stopCount = 4;
myFunction = function (message) {
	trace (count +" "+message);
	count++;
	if (count >= stopCount) {
		count = 0;
		clearInterval (intervalID);
	}
};
intervalID = setInterval (myFunction, 1000, "Optional Message Passed");

Time Delay in Flash AS2 with setInterval

It’s relatively simple. Say you want to delay a slideshow of images every 5 seconds using actionscript. You would achive this with setInterval at 5000 milliseconds (every 5 seconds) calling predefined or anonymous function like so:

setInterval( function(){ trace("interval called"); fadeImage(); }, 5000 );

AS3 Pass Variable to FlashVars using LoaderInfo

Unlike AS2, you can nolonger access embeded flashVars from _root using Actionscript 3. You must now using LoaderInfo.

function loaderComplete(myEvent:Event)
{
  var flashVars=this.loaderInfo.parameters;
  userNameTextField.text=flashVars.userName;
}
this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);

What is a FlashVar?
FlashVars are nothing more than a list of variables structured as a Query Strings of data (flash.swf?user=bob&pass=123). It’s a way to pass variables from html to a Flash movie.

Actionscript 3: Name Loops to stop parent loop

Say you had a nested loop and you wanted to stop the outer loop if a conditions was met. You would use the Name Loop like so:

// my top loop
outsideLoop:for(var i:uint = 0; i &lt; 10; i++)
{
	trace(i + ": called from outsideLoop.");
 
	//my inside loop
	insideLoop:for(var j:uint = 0; j &lt; 5; j++)
	{
		trace(j + ": called from insideLoop.");
 
		if(j &lt; 2) break outsideLoop; // stop the outside loop
	}
}

Unlike as2, in as3, you can name your loop conditions giving you the ability to target those loops to call break when needed. This is very important for when you have deeply nested loops and you want to exit one of the outer loops.

Using Colored SyntaxHighlighter on WordPress

I’ve seen a number of developers using code syntaxhiglighers on their wordpress blog sites. Here are a list of plug-ins to chose from:

1: WP-Syntax
WP-Syntax provides clean syntax highlighting using GeSHi — supporting a wide range of popular languages. Wrap code blocks with <pre lang="LANGUAGE" line="1"> and </pre> where LANGUAGE is a GeSHi supported language syntax. The line attribute is optional. See sample code block below:
http://wordpress.org/extend/plugins/wp-syntax/

2: Google Syntax Highlighter for WordPress
100% client side, no server dependency, Multiple languages support, Wide browser support, Very lightweight.

http://wordpress.org/extend/plugins/google-syntax-highlighter/

2a: AS3 Syntax Highlighting (with SyntaxHighlighter)
Actionscript 3.0 add-on for Goolge SyntaxHighlighter for all the flash coders.
http://www.digitalflipbook.com/archives/2007/09/as3_syntax_high.php

3: CodeColorer
Plugin works with WordPress 1.5 and 2.0/2.1 as well. Recommended to update your WordPress to version 2.1 because it has many nice features.
http://kpumuk.info/projects/wordpress-plugins/codecolorer/

4: GeSHi – Generic Syntax Highlighter
Generic Syntax Highlighter for php. Highlight many languages, including PHP, CSS, HTML, SQL, Java and C for XHTML compliant output
http://qbnz.com/highlighter/index.php

WP-Syntax Sample Code Block

 //end colors
import com.xml.XMLData;
var myXML:XMLData;
country_id = "us";
if (_root.country_id == "us") {
	mask_can._x = mask_uk._x = Stage.width;
	var stateAbbrev = new Array("al", "ak", "as", "az", "ar", "ca", "co", "ct", "de", "dc", "fm", "fl", "ga", "gu", "hi", "id", "il", "in", "ia", "ks", "ky", "la", "me", "mh", "md", "ma", "mi", "mn", "ms", "mo", "mt", "ne", "nv", "nh", "nj", "nm", "ny", "nc", "nd", "mp", "oh", "ok", "or", "pw", "pa", "pr", "ri", "sc", "sd", "tn", "tx", "ut", "vt", "vi", "va", "wa", "wv", "wi", "wy");
	var stateNames = new Array("ALABAMA", "ALASKA", "AMERICAN SAMOA", "ARIZONA", "ARKANSAS", "CALIFORNIA", "COLORADO", "CONNECTICUT", "DELAWARE", "DC", "FEDERATED nameS OF MICRONESIA", "FLORIDA", "GEORGIA", "GUAM", "HAWAII", "IDAHO", "ILLINOIS", "INDIANA", "IOWA", "KANSAS", "KENTUCKY", "LOUISIANA", "MAINE", "MARSHALL ISLANDS", "MARYLAND", "MASSACHUSETTS", "MICHIGAN", "MINNESOTA", "MISSISSIPPI", "MISSOURI", "MONTANA", "NEBRASKA", "NEVADA", "NEW HAMPSHIRE", "NEW JERSEY", "NEW MEXICO", "NEW YORK", "NORTH CAROLINA", "NORTH DAKOTA", "NORTHERN MARIANA ISLANDS", "OHIO", "OKLAHOMA", "OREGON", "PALAU", "PENNSYLVANIA", "PUERTO RICO", "RHODE ISLAND", "SOUTH CAROLINA", "SOUTH DAKOTA", "TENNESSEE", "TEXAS", "UTAH", "VERMONT", "VIRGIN ISLANDS", "VIRGINIA", "WASHINGTON", "WEST VIRGINIA", "WISCONSIN", "WYOMING");
	instructions_mc.gotoAndStop(1);
} else if (_root.country_id == "uk") {
	mask_can._x = mask_us._x = Stage.width;
	var stateAbbrev = new Array("uk");
	var stateNames = new Array("United Kingdom");
	instructions_mc.gotoAndStop(2);
} else if (_root.country_id == "can") {
	mask_us._x = mask_uk._x = Stage.width;
	var stateAbbrev = new Array("on");
	var stateNames = new Array("Ontario");
	instructions_mc.gotoAndStop(2);
}
function setRollOver() {
	for (var i:Number = 0; i &lt; stateAbbrev.length; i++) {
		//trace("cap_name: "+stateNames[i]);
		me["" + stateAbbrev[i] + "_mc"].cap_name = stateNames[i];
		me["" + stateAbbrev[i] + "_mc"].onRollOver = rollOverMC;
		me["" + stateAbbrev[i] + "_mc"].onRollOut = rollOutMC;
		me["" + stateAbbrev[i] + "_mc"].onRelease = onReleaseMC;
		////trace(i);
	}
	fetchXML();
}
setRollOver();

Apple Computer, Inc., is an American multinational corporation

Apple with a focus on designing and manufacturing consumer electronics and software products. The company’s best-known hardware products include the Macintosh line of personal computers, the iPod line of portable media players, and the iPhone. Apple’s software products include the Mac OS X operating system, iTunes media browser, the iLife suite of multimedia and creativity software, and Final Cut Studio, a suite of professional audio- and film-industry software products. The company operates more than 200 retail stores in eight countries[3] and an online store where hardware and software products are sold.

Established in Cupertino, California on April 1, 1976 and incorporated January 3, 1977,[4] the company was called “Apple Computer, Inc.” for its first 30 years, but dropped the word “Computer” on January 9, 2007 [5] to reflect the company’s ongoing expansion into the consumer electronics market in addition to its traditional focus on personal computers. [6] Apple has about 28,000 employees worldwide[2] and had worldwide annual sales of US$24 billion in its fiscal year ending September 29, 2007. [1] For reasons varying from its philosophy of comprehensive aesthetic design to its distinctive advertising campaigns, Apple has established a unique reputation in the consumer electronics industry. This includes a customer base that is devoted to the company and its brand, particularly in the United States.[7] Fortune magazine named Apple the most admired company in the United States.[8]

MySQL is a relational database management system (RDBMS)

The program runs as a server providing multi-user access to a number of databases.

MySQL is owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now a subsidiary of Sun Microsystems,[3] which holds the copyright to most of the codebase. The project’s source code is available under terms of the GNU General Public License, as well as under a variety of proprietary agreements.

“MySQL” is officially pronounced /maɪˌɛskjuːˈɛl/[4] (My S Q L), not “My sequel” /maɪˈsiːkwəl/. This adheres to the official ANSI pronunciation; SEQUEL was an earlier IBM database language, a predecessor to the SQL language.[5] The company does not take issue with the pronunciation “My sequel” or other local variations.[citation needed]