Parámetros de búsqueda en google de tu web
15 de Noviembre de 2011ejemplo de parámetros de búsqueda de la web
site:www.vinosyrecetas.com inurl:cid
inurl:LOQUESEADELAURL
intitle:SOLOELTITULO
más: http://www.googleguide.com/advanced_operators.html
ejemplo de parámetros de búsqueda de la web
site:www.vinosyrecetas.com inurl:cid
inurl:LOQUESEADELAURL
intitle:SOLOELTITULO
más: http://www.googleguide.com/advanced_operators.html
Para ordenr números strings:
select * from table order by length(code), code;
Para comprimir una página se puede utilizar este tipo de compresión - zlib, Este escript comprueba si está instalado o no este tipo de compresión. Lo que no se es si es compatible con el gzip de toda la vida.
// Set HTML Compression on
if (extension_loaded(’zlib’)){
$_zlib_included = strtolower(ini_get(’zlib.output_compression’));
if (empty($_zlib_included) || $_zlib_included == ‘off’)
{
ini_set(’zlib.output_compression_level’, 7);
ob_start(’ob_gzhandler’);
}
}
Esta es una función generica de redirecciones en PHP
function movePage($num,$url){
static $http = array (
100 => “HTTP/1.1 100 Continue”,
101 => “HTTP/1.1 101 Switching Protocols”,
200 => “HTTP/1.1 200 OK”,
201 => “HTTP/1.1 201 Created”,
202 => “HTTP/1.1 202 Accepted”,
203 => “HTTP/1.1 203 Non-Authoritative Information”,
204 => “HTTP/1.1 204 No Content”,
205 => “HTTP/1.1 205 Reset Content”,
206 => “HTTP/1.1 206 Partial Content”,
300 => “HTTP/1.1 300 Multiple Choices”,
301 => “HTTP/1.1 301 Moved Permanently”,
302 => “HTTP/1.1 302 Found”,
303 => “HTTP/1.1 303 See Other”,
304 => “HTTP/1.1 304 Not Modified”,
305 => “HTTP/1.1 305 Use Proxy”,
307 => “HTTP/1.1 307 Temporary Redirect”,
400 => “HTTP/1.1 400 Bad Request”,
401 => “HTTP/1.1 401 Unauthorized”,
402 => “HTTP/1.1 402 Payment Required”,
403 => “HTTP/1.1 403 Forbidden”,
404 => “HTTP/1.1 404 Not Found”,
405 => “HTTP/1.1 405 Method Not Allowed”,
406 => “HTTP/1.1 406 Not Acceptable”,
407 => “HTTP/1.1 407 Proxy Authentication Required”,
408 => “HTTP/1.1 408 Request Time-out”,
409 => “HTTP/1.1 409 Conflict”,
410 => “HTTP/1.1 410 Gone”,
411 => “HTTP/1.1 411 Length Required”,
412 => “HTTP/1.1 412 Precondition Failed”,
413 => “HTTP/1.1 413 Request Entity Too Large”,
414 => “HTTP/1.1 414 Request-URI Too Large”,
415 => “HTTP/1.1 415 Unsupported Media Type”,
416 => “HTTP/1.1 416 Requested range not satisfiable”,
417 => “HTTP/1.1 417 Expectation Failed”,
500 => “HTTP/1.1 500 Internal Server Error”,
501 => “HTTP/1.1 501 Not Implemented”,
502 => “HTTP/1.1 502 Bad Gateway”,
503 => “HTTP/1.1 503 Service Unavailable”,
504 => “HTTP/1.1 504 Gateway Time-out”
);
header($http[$num]);
header(“Location: $url”);
}
La llamada de un ejemplo 403:
movePage(403,”http://www.vinosyrecetas.com/”);
Esta es la función:
SELECT * FROM tu_tabla ORDER BY CAST(tu_campo AS UNSIGNED)
esta es la función
function number_pad($number,$n) {
return str_pad((int) $number,$n,”0″,STR_PAD_LEFT);
}
//$number es el numero a modificar
// y $n sol los dígitos que se quiere contemplar, no los ceros a poner, en mi caso es $n=2
Para hacerlo compatible con Mootools añadiremos la función jQuery.noConflict() y cambiaremos las $ por jQuery, dejando así el código javascript:
jQuery.noConflict();
jQuery(document).ready(function(){
etc..
Ponemos el código para generar csv desde php, y guardarlo
<?php
include(“connect.php”); // Conexion a nuestra BD
$csv_end = ”
“;
$csv_sep = “|”;
$csv_file = “datas.csv”;
$csv=“”;
$sql=“SELECT * from table”;
$res=mysql_query($sql);
while($row=mysql_fetch_array($res))
{
$csv.=$row['field_1'].$csv_sep.$row['field_2'].$csv_end;
}
//Generamos el csv de todos los datos
if (!$handle = fopen($csv_file, “w”)) {
echo “Cannot open file”;
exit;
}
if (fwrite($handle, utf8_decode($csv)) === FALSE) {
echo “Cannot write to file”;
exit;
}
fclose($handle);
?>
Para quitar el HTML de una texto se puede hacer mediante la función:
strip_tags()
ejemplo:
echo strip_tags($text);
Si queremos excluir alguna etiqueta:
echo strip_tags($text, ‘<p><a>’);