06/09/2011, 08:16
|
Colaborador | | Fecha de Ingreso: octubre-2009 Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 15 años, 1 mes Puntos: 334 | |
Respuesta: url amigables te adjunto la class que hice para el asunto de las url amigables.. espero te sea de utilidad..
intenta entender el como esta hecha para que tengas la idea también
saludos. Código PHP: <?php /** * Khaus Framework * * LICENSE * * This source file is subject to the Public license Creative Commons LPCC * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://creativecommons.org/licenses/by-nc/2.0/cl/ * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Khaus * @package Khaus_Helper * @copyright Copyright (c) 2010 - 2011, Khaus Corp. Chile [[email protected]] * @license Atribucion-Licenciar Igual 2.0 Chile. CC BY-NC 2.0 * @version 1:20110315 */
class Khaus_Helper_Seo { static public function removeAccents($string) { $html = get_html_translation_table(HTML_ENTITIES); $html = array_slice($html, 32, -4); foreach ($html as $char => $entitie) { $bar[] = substr($entitie, 1, 1); } $string = htmlentities($string, ENT_QUOTES, 'UTF-8'); $string = str_replace($html, $bar, $string); return $string; } static public function safeName($string) { $string = self::removeAccents($string); $string = strtolower($string); $string = preg_replace('/(&[a-z0-9]+;|[^a-z0-9_])/', '_', $string); $string = preg_replace('/[\s_]+/', '_', $string); $string = trim($string, '_'); return $string; } } |