Create SEF Tags – Helpers


SEF Helpers

This function will create unique links for your URL’s
It will genrate a string of different tags joined together.

// ------------------------------------------------------------------------

/**
* SEF Helpers
*
* @package SEO/SEM
* @subpackage Helpers
* @category Helpers
* @author SEO/SEM 316 Dev Team
* @link http://
*/

// --------------------------------------------------------------------------

/**
* Create SEF Tags
*
* This function will create unique links for your URL's
* It will genrate a string of different tags joined together.
*
* @category function
* @access public
* @param string
* @return string
*/
function create_sef_tags($tag_string='')
{
// Clean the string with all the dirty or unwanted characters
$mixed_search = array("!", "#", "$", "%", "^","&", "*", "(",
")", "+","=", "|", "\\", "{", "[",
"}", "]", ":", ";", "\"","'", "<", ",", ">", "?","/", "~", "`", "@", ".");
$mixed_replace = "";
$tag_string = str_replace($mixed_search,$mixed_replace,$tag_string);

// Replace space or underscore with (minus) character
$mixed_search = array(" ","_");
$mixed_replace = "-";
$tag_string = str_replace($mixed_search,$mixed_replace,$tag_string);

// Convert all the characters to lower case
$tag_string = strtolower($tag_string);

// Return formated string
return($tag_string);

}

Lets try and example :

// Example
echo create_sef_tags('@@Austin Noronha 316 Rockz.......@@');

Output:

austin-noronha-316-rockz

So enjoy the code………

Do you want to share this code or provide a short link to this post use :

http://wp.me/p7jlT-3

Advertisements