Tag Archive for web

Rewrite underscores to hyphens for SEO URL

Options  FollowSymLinks
RewriteEngine On
RewriteBase /
 
RewriteRule !.(html|php)$ - [S=6]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6-$7 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5-$6 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4-$5 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_([^_]*)_(.*)$ $1-$2-$3-$4 [E=underscores:Yes]
RewriteRule ^([^_]*)_([^_]*)_(.*)$ $1-$2-$3 [E=underscores:Yes]
RewriteRule ^([^_]*)_(.*)$ $1-$2 [E=underscores:Yes]
 
RewriteCond %{ENV:underscores} ^Yes$
RewriteRule (.*) <a href="http://www.askapache.com/$1" >http://www.askapache.com/$1</a> [R=301,L]

source

HTML Strict starter

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "<a href="http://www.w3.org/TR/html4/strict.dtd">" >http://www.w3.org/TR/html4/strict.dtd"></a>

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<title>Sample Title</title>
</head>
<body>



</body>
</html>

source

@font-face

@font-face {
    font-family: Bickham;
    src: url('times_new_yorker.ttf');
}

/*voici une version plus complète d'utilisation de @font-face*/
@font-face {
  font-family: Cantarell;
  font-style: normal;
  font-weight: normal;
  src: local('Cantarell'), url('../fonts/cantarell.ttf') format('truetype');
}
		
body{
	
    background: #336688;	
	
    font-family: Bickham, serif; /*ATTENTION la propriete font-family doit toujours faire reference egalement a  une famille par defaut comme : sans-serif, serif ou encore monospace*/
    font-size: 4em;
}

source

How to get images from Google images with PHP

function getGoogleImg($k) {
	$url = "<a href="http://images.google.it/images?as_q=##query##&hl=it&imgtbs=z&btnG=Cerca+con+Google&as_epq=&as_oq=&as_eq=&imgtype=&imgsz=m&imgw=&imgh=&imgar=&as_filetype=&imgc=&as_sitesearch=&as_rights=&safe=images&as_st=y";" >http://images.google.it/images?as_q=##query##&hl=it&imgtbs=z&btnG=Cerca+con+Google&as_epq=&as_oq=&as_eq=&imgtype=&imgsz=m&imgw=&imgh=&imgar=&as_filetype=&imgc=&as_sitesearch=&as_rights=&safe=images&as_st=y";</a>
	$web_page = file_get_contents( str_replace("##query##",urlencode($k), $url ));

	$tieni = stristr($web_page,"dyn.setResults(");
	$tieni = str_replace( "dyn.setResults(","", str_replace(stristr($tieni,");"),"",$tieni) );
	$tieni = str_replace("[]","",$tieni);
	$m = preg_split("/[[]]/",$tieni);
	$x = array();
	for($i=0;$i<count($m);$i++) {
		$m[$i] = str_replace("/imgres?imgurlx3d","",$m[$i]);
		$m[$i] = str_replace(stristr($m[$i],"x26imgrefurl"),"",$m[$i]);
		$m[$i] = preg_replace("/^"/i","",$m[$i]);
		$m[$i] = preg_replace("/^,/i","",$m[$i]);
		if ($m[$i]!="") array_push($x,$m[$i]);
	}
	return $x;
}

source

HTML Transitional starter

<!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 lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<title>Sample Title</title>
</head>

<body>



</body>
</html>

source

XHTML Strict starter

<!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>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>Sample Title</title>
</head>

<body>
	
	
	
</body>
</html>

source

HTML Strict starter

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "<a href="http://www.w3.org/TR/html4/strict.dtd">" >http://www.w3.org/TR/html4/strict.dtd"></a>

<html lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<title>Sample Title</title>
</head>
<body>



</body>
</html>

source

Browser specific Hacks

/* IE 6 */
* html .foo { }

/* IE 7 */
*+html .yourclass{ }

/* IE 7 and modern browsers */
html>body .yourclass { }

/* Modern browsers (not IE 7) */
html>/**/body .yourclass { }

/* Opera 9.27 and below */
html:first-child .yourclass { }

/* Safari */
html[xmlns*=""] body:last-child .yourclass { }

/* Safari 3+, Chrome 1+, Opera 9+, Fx 3.5+ */
body:nth-of-type(1) .yourclass { }

/* Safari 3+, Chrome 1+, Opera 9+, Fx 3.5+ */
body:first-of-type .yourclass {  }

/* Safari 3+, Chrome 1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {
 .yourclass  {  }
}

source

Stop IE Page Load Flicker

<!--[if IE]>
<meta http-equiv="Page-Enter" content="blendTrans(duration=0)" />
<meta http-equiv="Page-Exit" content="blendTrans(duration=0)" />
<![endif]-->

source

Simple jquery accordion

<dl id="accordion">

<dt><a href="">This is what you would click on to show the content</a></dt>
<dd>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</dd>

<dt><a href="">Another Line Item</a></dt>
<dd>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</dd>

<dt><a href="">And Another</a></dt>
<dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</dd>

</dl>

source