Tag Archive for template

HTML5 boilerplate with comments

<!doctype html>
<html lang="en" class="no-js">
<head>
  <meta charset="utf-8">

  <!-- <a href="http://www.phpied.com/conditional-comments-block-downloads/">www.phpied.com/conditional-comments-block-downloads/</a> -->
  <!--[if IE]><![endif]-->

  <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame 
       Remove this if you use the .htaccess -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <title></title>
  <meta name="description" content="">
  <meta name="author" content="">

  <!--  Mobile Viewport Fix
        j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag 
  device-width : Occupy full width of the screen in its current orientation
  initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
  maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
  -->
  <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">


  <!-- Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references -->
  <link rel="shortcut icon" href="/favicon.ico">
  <link rel="apple-touch-icon" href="/apple-touch-icon.png">


  <!-- CSS : implied media="all" -->
  <link rel="stylesheet" href="css/style.css?v=1">

  <!-- For the less-enabled mobile browsers like Opera Mini -->
  <link rel="stylesheet" media="handheld" href="css/handheld.css?v=1">

 
  <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
  <script src="js/modernizr-1.5.min.js"></script>

</head>

<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->

<!--[if lt IE 7 ]> <body class="ie6"> <![endif]-->
<!--[if IE 7 ]>    <body class="ie7"> <![endif]-->
<!--[if IE 8 ]>    <body class="ie8"> <![endif]-->
<!--[if IE 9 ]>    <body class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <body> <!--<![endif]-->

  <div id="container">
    <header>

    </header>
    
    <div id="main">

    </div>
    
    <footer>

    </footer>
  </div> <!--! end of #container -->


  <!-- Javascript at the bottom for fast page loading -->

  <!-- Grab Google CDN's jQuery. fall back to local if necessary -->
  <script src="<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>" >http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script></a>
  <script>!window.jQuery && document.write('<script src="js/jquery-1.4.2.min.js"></script>')</script>


  <script src="js/plugins.js?v=1"></script>
  <script src="js/script.js?v=1"></script>

  <!--[if lt IE 7 ]>
    <script src="js/dd_belatedpng.js?v=1"></script>
  <![endif]-->


  <!-- yui profiler and profileviewer - remove for production -->
  <script src="js/profiling/yahoo-profiling.min.js?v=1"></script>
  <script src="js/profiling/config.js?v=1"></script>
  <!-- end profiling code -->


  <!-- asynchronous google analytics: mathiasbynens.be/notes/async-analytics-snippet 
       change the UA-XXXXX-X to be your site's ID -->
  <script>
   var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
   (function(d, t) {
    var g = d.createElement(t),
        s = d.getElementsByTagName(t)[0];
    g.async = true;
    g.src = '//www.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g, s);
   })(document, 'script');
  </script>
  
</body>
</html>

source

Template partial specialization


#include <iostream>
#include <string>

template< class T >
class Foo;

template< class T>
class Foo< T* > {
public:
Foo( const T *t ):
t_( t ) {}
void print() const {
std::cout << *t_ << std:

Conditional Geo Mashup map template code

<?php
$coordinates = GeoMashup::post_coordinates();
if ( class_exists( 'GeoMashup' ) and ! empty( $coordinates ) ) {
	echo GeoMashup::map();
}
?>

source

Button Template Class in AS3

/*
	
	Author: Alvin Crespo
	Date: 3/1/2010
	
	TemplateButton is a template class for buttons.

*/
package acrespo.classes.templates{
	
	//display
	import flash.display.MovieClip;
	
	//events
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	public class TemplateButton extends MovieClip{
		
		private var cButtonArea:MovieClip;
		
		public function Button(){ } //Constructor
		
		protected function setClickArea(pButtonArea:MovieClip):void{ initiateClickArea(pButtonArea); }
		
		private function initiateClickArea(pButtonArea:MovieClip):void{
			cButtonArea = pButtonArea;
			cButtonArea.buttonMode = true;
			cButtonArea.addEventListener(MouseEvent.MOUSE_DOWN, buttonDown);
			cButtonArea.addEventListener(MouseEvent.MOUSE_UP, buttonUp);
			cButtonArea.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
			cButtonArea.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);		
		}
		
		private function buttonDown(e:MouseEvent):void {
			stage.addEventListener(MouseEvent.MOUSE_UP, buttonUp);
			gotoAndStop('down');
		}

		private function buttonUp(e:MouseEvent):void {
			stage.removeEventListener(MouseEvent.MOUSE_UP, buttonUp);
			if (e.currentTarget != cButtonArea) {//onreleaseoutside
				gotoAndStop('normal');
			} else {//onrelease
				buttonUpAction();
			}
		}
		
		protected function buttonUpAction():void{ }
		
		private function buttonOver(e:MouseEvent):void {
			if (e.buttonDown) {//ondragover

			} else {//onrollover
			
			}			 
			gotoAndStop('over');
		}	
		
		private function buttonOut(e:MouseEvent):void {
			//The user is dragging something from the target object
			if (e.buttonDown) {//ondragout
				gotoAndStop('down');
			} else {//onrollout
				gotoAndStop('normal');
			}
		}
		
	}//end of class
}//end of package


/*
	
The Following is how you would extend that class

*/
package acrespo.classes.buttons{
	
	//classes
	import acrespo.classes.templates.TemplateButton;
	import acrespo.classes.MainDocument;
	
	public class UploadFileButton extends TemplateButton{
		
		public function UploadFileButton():void{ 
			setClickArea(buttonarea); //function of parent class TemplateButton
		}
		
		override protected function buttonUpAction():void{
			MainDocument(parent)._FileManager.uploadFiles();
		}//end of buttonUpAction
		
	}//end of class
}//end of package

source

Global Geo Mashup map centered on current post

// Try only if Geo Mashup plugin is active
if ( class_exists( 'GeoMashup' ) ) {
	$current_location = GeoMashupDB::get_post_location( get_the_ID() );
	if ( $current_location ) {
		// The current post has a location, so include the map
		$map_arguments = array (
			'map_content' => 'global',
			'center_lat' => $current_location->lat,
			'center_lng' => $current_location->lng,
			'marker_select_info_window' => 'false',
			'marker_select_highlight' => 'true',
			'marker_select_center' => 'true',
			'auto_info_open' => 'true',
			'open_object_id' => $current_location->object_id
		);
		echo GeoMashup::map( $map_arguments );
	}
}

source

WordPress – Get template file used

get_post_meta($post->ID,'_wp_page_template',true)

source

XHTML 1 Strict Complete Starter Template

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">" >http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"></a>
<html xmlns="<a href="http://www.w3.org/1999/xhtml"" >http://www.w3.org/1999/xhtml"</a> xml:lang="en" lang="en">
<head>
<title>SITENAME</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<meta name="robots" content="index, follow" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="" media="screen,projection" type="text/css" />
<link rel="stylesheet" href="" media="print" type="text/css" />
<link rel="alternate" type="application/rss+xml" title="SITENAME Updates" href="" />
<script type="text/javascript" src="<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>" >http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script></a>
<script type="text/javascript" src=""></script>
<script type="text/javascript" charset="utf-8">
$(function(){
});
</script>
</head>
<body>
<div id="wrapper">
  <h1>SITENAME</h1>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "<a href="https://ssl."" >https://ssl."</a> : "<a href="http://www.");" >http://www.");</a>
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("YOUR-UA-GOES-HERE");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>

source

Basic Document Class Template, as Created by FlashDevelop

package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author <YourNameHere>
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
		}
		
	}
	
}

source

Blank Template – HTML+jQuery+CSS

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <a href="http://www.w3.org/TR/html4/loose.dtd">" >http://www.w3.org/TR/html4/loose.dtd"></a>
<html>
	<head>
		<title>
			title
		</title>
		<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
		<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
		<script type="text/javascript" src="jquery.js"></script>
		<script type="text/javascript" charset="utf-8">
			$(function(){
			});
		</script>
	</head>
	<body>
	</body>
</html>

source

AS3 Banner Template

package {

	import flash.events.*;
    import flash.display.*;
    import flash.net.*;
    import flash.utils.*;
	import flash.text.*;
    //import flash.media.Sound;
    //import flash.media.SoundChannel;
    //import flash.media.SoundTransform;
    //import flash.media.SoundMixer;

    import flash.filters.GlowFilter;
	import flash.filters.BlurFilter;

    //import com.MRM.*;

    import caurina.transitions.*;
    import caurina.transitions.properties.*;
    CurveModifiers.init();
	
	public class banner extends MovieClip {

		var dropWidth:Number = 3; // This will put this many pixels between the frame and the MASK/DROPSHADOW elements.
		//var loops:Number = 0; // do not change
		//var loopsMax:Number = 1; // how many times animation will loop
		//var loopDelay:Number = 2000; // time to delay before looping, set in milliseconds

        var glowIn:GlowFilter=new GlowFilter(0xFFFFFF,0.75,20,20,2,2);
        var glowOut:GlowFilter=new GlowFilter(0xFFFFFF,0,10,10,2,2);
		var blurIn:BlurFilter = new BlurFilter(2.0, 2.0, 1)
		var blurOut:BlurFilter = new BlurFilter(0.0, 0.0, 1)

		// animation function variables
		var pauseHere:Number; // change on each frame; determines how long you want to wait at any particular frame.
		var gap:Number; // a delay in between each step of an animation on each frame.
		
		var bumpSpeed:Number = .25;
		var spinSpeed:Number = .25;
		var moveSpeed:Number = .25;
		var FADESPEED:Number = .5;
		var BLURSPEED:Number = .5;
		var BUMPSIZE:Number = 1.25;


		public function banner() {
            //init
            ColorShortcuts.init();
            FilterShortcuts.init();
			
			// draw a border
			var myBorder:Shape = new Shape();
			myBorder.graphics.lineStyle(1,0x00000000);
			//myBorder.graphics.beginFill(0xff00ff00);
			myBorder.graphics.drawRect(0+dropWidth, 0+dropWidth, stage.stageWidth-(2*dropWidth), stage.stageHeight-(2*dropWidth));
			myBorder.graphics.endFill();
			addChild(myBorder);

			// size the dropshadow
			solid_mc.x = 0 + dropWidth;
			solid_mc.y = 0 + dropWidth;
			solid_mc.width = stage.stageWidth - 2*dropWidth;
			solid_mc.height = stage.stageHeight - 2*dropWidth;
			
			// size the mask
			mask_mc.x = 0 + dropWidth;
			mask_mc.y = 0 + dropWidth;
			mask_mc.width = stage.stageWidth - 2*dropWidth;
			mask_mc.height = stage.stageHeight - 2*dropWidth;
			
			// set button actions
			cta_invis_mc.buttonMode = true;
			cta_invis_mc.addEventListener(MouseEvent.MOUSE_DOWN,clickItem);
			cta_invis_mc.x = 0;
			cta_invis_mc.y = 0;
			cta_invis_mc.width = stage.stageWidth;
			cta_invis_mc.height = stage.stageHeight;
			
			makeButton(cta_manual_mc, overItem, outItem, clickItem);
			makeButton(cta_centering_mc, overItem, outItem, clickItem); cta_centering_mc.setText("DYNAMIC TEXT");
			
		}
		
		
		
		
		
		
		
		
		// GENERAL BUTTON OVER/OUT/CLICK FUNCTIONS
		
		private function makeButton(which_mc:MovieClip, overFunction:Function, outFunction:Function, clickFunction:Function):void {
			which_mc.buttonMode = true; 
			which_mc.useHandCursor = true;
			which_mc.mouseChildren = false;
			which_mc.addEventListener(MouseEvent.MOUSE_OVER, overFunction);
			which_mc.addEventListener(MouseEvent.MOUSE_OUT, outFunction);
			which_mc.addEventListener(MouseEvent.CLICK, clickFunction);
		}
		
        private function overItem(e:Event) {
            Tweener.addTween(e.currentTarget, {_filter:glowIn, scaleX:1.05, scaleY:1.05, time:0.2});
            //e.currentTarget.gotoAndStop(2);
//          switch (e.currentTarget.name) {
//              case "mc_dock_beef" :
//              break;
//          }
        }

        private function outItem(e:Event) {
            Tweener.addTween(e.currentTarget, {_filter:glowOut, scaleX:1, scaleY:1, time:0.2});
            //e.currentTarget.gotoAndStop(1);
        }


        private function clickItem(e:Event) {
			trace(e.currentTarget.name);
//            switch (e.currentTarget.name) {
//                case "tv01_mc" :
//                break;
//			}
		}












		// ANIMATION (CUSTOMIZED TWEENER) FUNCTIONS


		// init hides a movieclip and sets its alpha property to 0. This is useful for entering a new frame where the elements need to animate in.
		private function init(which_mc):void {
			which_mc.alpha = 0;
			which_mc.visible = false;
		}

		// fades a movieclip in or out.
		// syntax: fade(mymovieclip_mc, "out", .5, -1);
		private function fade(which_mc:MovieClip, method:String, myDelay:Number, newSpeed:Number):void {
			var thisSpeed:Number;
			if (newSpeed >= 0) thisSpeed = newSpeed; else thisSpeed = FADESPEED;
			
			switch(method)
			{
				case "in" :
				Tweener.addTween(which_mc, {alpha:100, time:thisSpeed, yDelay});
				which_mc.visible = true;
				break;
				case "out" :
				Tweener.addTween(which_mc, {alpha:0, time:thisSpeed, yDelay, onComplete:function() { which_mc.visible = false; } });				
				break;
			}
		}		
		
		// bump increases a movieclip's scale temporarily then returns it to normal
		// syntax: bump(mymovieclip_mc, 0, -1);
		private function bump(which_mc:MovieClip, myDelay:Number, factor:Number):void {
			var baseScale:Number = which_mc.scaleX;
			if (factor < 1) factor = 1;
			Tweener.addTween(which_mc, {scaleX:BUMPSIZE * baseScale * factor, scaleY:BUMPSIZE * baseScale * factor, time:bumpSpeed, yDelay});
			Tweener.addTween(which_mc, {scaleX:baseScale-(BUMPSIZE*baseScale*.1), scaleY:baseScale-(BUMPSIZE*baseScale*.1), time:bumpSpeed, yDelay + bumpSpeed});
			Tweener.addTween(which_mc, {scaleX:baseScale, scaleY:baseScale, time:bumpSpeed, yDelay + (bumpSpeed*2), transition:"easeInOutQuad" });
		}
		
		// blurs a movieclip in or out.
		// syntax: blur(mymovieclip_mc, "out", .5, -1);
		private function blur(which_mc:MovieClip, method:String, myDelay:Number, newSpeed:Number):void {
			var thisSpeed:Number;
			if (newSpeed >= 0) thisSpeed = newSpeed; else thisSpeed = BLURSPEED;
			
			switch(method)
			{
				case "in" :
				Tweener.addTween(which_mc, {_filter:blurIn, time:thisSpeed, yDelay});
				break;
				case "out" :
				Tweener.addTween(which_mc, {_filter:blurOut, time:thisSpeed, yDelay});
				break;
			}
		}





	}
}

source