Hey guys!
Please will somebody help me with this?
Link now looks like this:
<a href="this-is-some-folder/word1-word2-word3.html" target="_blank">this is some folder/word1 word2 word3</a>
and I need to be without ’this is some folder/’ (highlighted with red) like this
<a href="this-is-some-folder/word1-word2-word3.html" target="_blank">word1 word2 word3</a>
This is my PHP code:
<?php
function makeLinksFromWords($text)
{
$text = html_entity_decode($text);
$text = " ".$text;
$text = preg_replace('/ link_in_folder:(\S+)/e', '" <a href=\""."\\1.html\""." target=\"_blank\">".str_replace("-"," ","\\1")."</a>"', $text);
$text = preg_replace('/(<a.+>)(\.+)(<\/a>)/Ue',"'$1'.preg_replace('{.+/}','','$2').'$3'",$text);
return $text;
}
// Live Example
echo makeLinksFromWords("This is a example for link in folder: link_in_folder:this-is-some-folder/word1-word2-word3");
?>
I would appreciate little help with this one.
Thank you advance
Cheers!



Reply With Quote

Bookmarks