php - Current URL to variable and variable to regular exp -


sorry bad english... need code seo clean circuit urls, need regexp current url , swap < a, href , a> < i, title , i> (that searchengines - not see links , not flow page rank on it) in links coincide current url, jquery code swap in browser href links work exemple:

current url - http: //exemple.com/pizza/ (sorry space )

thу сode:

<div>     <a title="some text" href="http://exemple.com/pizza/">pizza</a><br>     <a title="text 2" href="http://exemple.com/salads/">salad</a> </div> 

i need code looks like:

 <div>         <i class="asd" title="http://exemple.com/pizza/">pizza</i><br>         <a class="asd" href="http://exemple.com/salads/">salad</a>     </div> 

when i'm on http:// exemple.com/pizza/ page, and

 <div>         <a class="asd" href="http://exemple.com/pizza/">pizza</a><br>         <i class="asd" title="http://exemple.com/salads/">salad</i>     </div> 

...when on http:// exemple.com/salads/

now trying that:

$current='http://'.$_server['http_host'].$_server['request_uri']; return (preg_replace('/<a(.*)href="('.$current.')"(.*)<\/a/','<i$1title="$2"$3<\/i>',$buffer)); echo $buffer; 

but $current in pattern not works.. when try put http://exemple.com/pizza/ - works, need code, work on every page , swap a tags of urls coincide current page url... plz help


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -