<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bufa Webmaster &#187; urls</title>
	<atom:link href="http://www.bufa.es/tag/urls/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bufa.es</link>
	<description>Recursos web en español</description>
	<lastBuildDate>Thu, 09 Sep 2010 14:28:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Función php validar url de dominio</title>
		<link>http://www.bufa.es/funcion-validar-url/</link>
		<comments>http://www.bufa.es/funcion-validar-url/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 00:34:28 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[función]]></category>
		<category><![CDATA[urls]]></category>
		<category><![CDATA[validar]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=228</guid>
		<description><![CDATA[Función en php utilizando una expresión regular para validar cualquier tipo de url de dominio. 1 2 3 4 5 6 7 8 9 10 $url = &#34;http://www.bufa.es&#34;; function valida_url&#40;$url&#41;&#123; if &#40;preg_match&#40;'/^(http&#124;https&#124;ftp):\/\/([\w]*)\.([\w]*)\.(com&#124;net&#124;org&#124;biz&#124;info&#124;mobi&#124;us&#124;cc&#124;bz&#124;tv&#124;ws&#124;name&#124;co&#124;me)(\.[a-z]{1,3})?\z/i', $url&#41;&#41; &#123; echo 'dominio correcto'; &#125;else&#123; echo 'dominio ...]]></description>
			<content:encoded><![CDATA[<p>Función en php utilizando una expresión regular para validar cualquier tipo de url de dominio.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.bufa.es&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> valida_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>  
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/^(http|https|ftp):\/\/([\w]*)\.([\w]*)\.(com|net|org|biz|info|mobi|us|cc|bz|tv|ws|name|co|me)(\.[a-z]{1,3})?\z/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'dominio correcto'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>  
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'dominio incorrecto'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Modo de uso</span>
valida_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/funcion-validar-url/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Función php urls amigables</title>
		<link>http://www.bufa.es/funcion-php-urls-amigables/</link>
		<comments>http://www.bufa.es/funcion-php-urls-amigables/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 20:15:29 +0000</pubDate>
		<dc:creator>bufa</dc:creator>
				<category><![CDATA[Funciones]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[función]]></category>
		<category><![CDATA[urls]]></category>

		<guid isPermaLink="false">http://www.bufa.es/?p=214</guid>
		<description><![CDATA[Tener en nuestra página web nuestros links internos con urls amigables esta demostrado que favorecen a un mejor posicionamiento web y facilitan al visitante información del contenido del enlace antes de hacer click sobre el. Vamos a crear una función ...]]></description>
			<content:encoded><![CDATA[<p>Tener en nuestra página web nuestros links internos con urls amigables esta demostrado que favorecen a un mejor posicionamiento web y facilitan al visitante información del contenido del enlace antes de hacer click sobre el.</p>
<p>Vamos a crear una <strong>función en php para generar cadenas amigables</strong> para nuestras urls.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> url_amigable<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">// Sepadador de palabras que queremos utilizar</span>
   <span style="color: #000088;">$separador</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;-&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// Eliminamos el separador si ya existe en la cadan actual</span>
   <span style="color: #000088;">$cadena</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$separador</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// Convertimos la cadena a minusculas</span>
   <span style="color: #000088;">$cadena</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// Remplazo tildes y eñes</span>
   <span style="color: #000088;">$cadena</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strtr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cadena</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;áéíóúÁñÑ&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;aeiouAnN&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// Remplazo cuarquier caracter que no este entre A-Za-z0-9 por un espacio vacio</span>
   <span style="color: #000088;">$cadena</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[^ A-Za-z0-9]&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #666666; font-style: italic;">// Inserto el separador antes definido</span>
   <span style="color: #000088;">$cadena</span> <span style="color: #339933;">=</span> <span style="color: #990000;">ereg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;[ <span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]+&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$separador</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cadena</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">return</span> <span style="color: #000088;">$cadena</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">// Modo de empleo:</span>
<span style="color: #b1b100;">echo</span> url_amigable<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;¡¡¡Sin LEÓN no hubiera España, que antes que Castilla leyes, Concilios, fueros y reyes, dieron prestigio a León!!!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// Resultado: sin-leon-no-hubiera-espana-que-antes-que-castilla-leyes-concilios-fueros-y-reyes-dieron-prestigio-a-leon</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.bufa.es/funcion-php-urls-amigables/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
