var timer:Timer = new Timer(1000, 2);
timer.addEventListener(TimerEvent.TIMER, blah);
timer.start();
function blah(e:TimerEvent):void{
trace("Times Fired: " + e.currentTarget.currentCount);
trace("Time Delayed: " + e.currentTarget.delay);
}
Basic Timer example
Tags: as3
Nice URLS PHP .htaccess
.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
# http://domain/about -> http://domain/about.php
drawer
#drawer {
position: relative;
float: right;
background: red;
width: 20%;
min-height: 100%;
/* above gmaps? */
//position: absolute;
//color: white;
//background: black;
/* for IE */
//filter:alpha(opacity=60);
/* CSS3 standard */
//opacity:0.6;
/* for Mozilla */
//-moz-opacity:0.6;
}
Override specific links in theme_links based on their class.
/**
* Return a themed set of links.
*
* @param $links
* A keyed array of links to be themed.
* @param $attributes
* A keyed array of attributes
* @return
* A string containing an unordered list of links.
*/
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$num_links = count($links);
$i = 1;
$items_str = '';
foreach ($links as $key => $link) {
$class = '';
// Automatically add a class to each link and also to each LI
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
$link['attributes']['class'] .= ' ' . $key;
$class = $key;
}
else {
$link['attributes']['class'] = $key;
$class = $key;
}
// Add first and last classes to the list of links to help out themers.
$extra_class = '';
if ($i == 1) {
$extra_class .= 'first ';
}
if ($i == $num_links) {
$extra_class .= 'last ';
}
// Is the title HTML?
$html = isset($link['html']) && $link['html'];
// Initialize fragment and query variables.
$link['query'] = isset($link['query']) ? $link['query'] : NULL;
$link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
//Check if we have a link, for sometimes we need to output just a splain string.
//A class can only contain spaces, hyphens or underscores. Translate these to underscores.
$func_class = strtr($link['attributes']['class'], '- ', '__');
//dpm($func_class);
if (isset($link['href'])) {
//First, see if we have a theme function for this class
if (!empty($func_class) && ($function = theme_get_function('links_'. $func_class))) { //then, look for a theme function based on the class.
dpm($function);
$items_str .= theme('links_'. $func_class, $link);
}
else { //If no specific function was found, fall back to a default.
$items_str .= '<li class="'. $extra_class . $class .'">';
$items_str .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html); $items_str .= "</li>
";
}
}
else if ($link['title']) {
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (!$html) {
$link['title'] = check_plain($link['title']);
}
$items_str .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
}
$i++;
}
$output = '<ul'. drupal_attributes($attributes) .'>'. $items_str .'</ul>';
}
return $output;
}
/**
* Theme callbakc from theme_links, renders the comment_add link
**/
function phptemplate_links_comment_add($ink) {
$output = '"<li class="'. $extra_class . $class .'">';
$output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
$output .= "</li>
";
}
Override specific links in theme_links based on their class.
/**
* Return a themed set of links.
*
* @param $links
* A keyed array of links to be themed.
* @param $attributes
* A keyed array of attributes
* @return
* A string containing an unordered list of links.
*/
function phptemplate_links($links, $attributes = array('class' => 'links')) {
$output = '';
if (count($links) > 0) {
$num_links = count($links);
$i = 1;
$items_str = '';
foreach ($links as $key => $link) {
$class = '';
// Automatically add a class to each link and also to each LI
if (isset($link['attributes']) && isset($link['attributes']['class'])) {
$link['attributes']['class'] .= ' ' . $key;
$class = $key;
}
else {
$link['attributes']['class'] = $key;
$class = $key;
}
// Add first and last classes to the list of links to help out themers.
$extra_class = '';
if ($i == 1) {
$extra_class .= 'first ';
}
if ($i == $num_links) {
$extra_class .= 'last ';
}
// Is the title HTML?
$html = isset($link['html']) && $link['html'];
// Initialize fragment and query variables.
$link['query'] = isset($link['query']) ? $link['query'] : NULL;
$link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;
//Check if we have a link, for sometimes we need to output just a splain string.
//A class can only contain spaces, hyphens or underscores. Translate these to underscores.
$func_class = strtr($link['attributes']['class'], '- ', '__');
//dpm($func_class);
if (isset($link['href'])) {
//First, see if we have a theme function for this class
if (!empty($func_class) && ($function = theme_get_function('links_'. $func_class))) { //then, look for a theme function based on the class.
dpm($function);
$items_str .= theme('links_'. $func_class, $link);
}
else { //If no specific function was found, fall back to a default.
$items_str .= '<li class="'. $extra_class . $class .'">';
$items_str .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html); $items_str .= "</li>
";
}
}
else if ($link['title']) {
//Some links are actually not links, but we wrap these in <span> for adding title and class attributes
if (!$html) {
$link['title'] = check_plain($link['title']);
}
$items_str .= '<span'. drupal_attributes($link['attributes']) .'>'. $link['title'] .'</span>';
}
$i++;
}
$output = '<ul'. drupal_attributes($attributes) .'>'. $items_str .'</ul>';
}
return $output;
}
/**
* Theme callbakc from theme_links, renders the comment_add link
**/
function phptemplate_links_comment_add($ink) {
$output = '"<li class="'. $extra_class . $class .'">';
$output .= l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment'], FALSE, $html);
$output .= "</li>
";
}
Selector for link tag with class
a.menu:link {color: black}
Selects:
<a class="menu" href="#">MenuItem</a>
Turn error reporting on
ini_set ('display_errors', '1');
Redirect a browser via JavaScript
<html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- window.location="http://www.go.here/whatever.html"; // --> </script> </head> <body> <p>If this page does not re-direct you automatically, please <a href="http://www.go.here/whatever.html">click here</a>.</p> </body> </html>
Print out your shared server’s real path
<?php print($_SERVER['DOCUMENT_ROOT']); ?>