Hi StarLion,
What do you think about this solution?
It works, but am I horribly overcomplicating things?
PHP Code:
<?php
$String ='<li class="page_item page-item-1225"><a class="fadeThis" href="http://mynerja.com/about/balcon-de-europa-nerja/?param=1"><span>Balcon de Europa, Nerja</span></a></li>
<li class="page_item page-item-1452"><a class="fadeThis" href="http://mynerja.com/about/beaches-in-nerja/"><span>Beaches in Nerja</span></a></li>
<li class="page_item page-item-2958"><a class="fadeThis" href="http://mynerja.com/about/charities-in-nerja/"><span>Charities in Nerja CAS, Nerja Donkey Sanctuary, CUDECA</span></a></li>';
function processURL($matches){
$queryString = (array_key_exists('query', parse_url($matches[2])))? "&pb=1" : "?pb=1";
return "$matches[1]$matches[2]$queryString$matches[3]";
}
echo preg_replace_callback('/(<li.*?href=")(.*?)(".*?<\/li>)/', 'processURL', $String);
?>
You will notice I've attached a querystring to the first link.
Would be grateful for any feedback.
Bookmarks