PDA

View Full Version : Code Question


wraggster
02-07-2009, 09:29 AM
Hi all i have some code i want to insert into my forum ie this

function convert_aff_links( $_body, $_aff_id = '2pz' )
{
$_body = preg_replace
(
'@://(w+\.)?(playasia|play-asia)\.com/?([^/a-zA-Z])@',
'://www.play-asia.com/SOap-23-' . '83-' . $_aff_id . '-50-00.html$3',
$_body
);

$_body = preg_replace
(
'/paOS-(\d{2})/',
'SOap-23-' . '83-' . $_aff_id . '-50-$1',
$_body
);

return $_body;
}

but when i edit the header/footer templates it shows up on my forum rather than just hidden in the background, is there a bit of code i need to add to make it hide ?

Lynne
02-07-2009, 04:12 PM
You cannot put php code in a template. Templates are for html. If you need to add php code, you need to either edit the file or add it in a plugin.

wraggster
02-08-2009, 03:44 PM
thanks for the reply, where would be a good place to insert the code to test it ?

Lynne
02-08-2009, 03:51 PM
You want this run on every page? I suppose you could try one of the global_xx locations.

wraggster
02-08-2009, 03:58 PM
thanks again, yes every page would be great, ill give the global locations a try :)

--------------- Added 1234116527 at 1234116527 ---------------

hmm not working, im begining to wonder if the code is actually valid

thanks for the replys, ill have to admit defeat i reckon :)

Dismounted
02-10-2009, 05:59 AM
You are probably looking to modify the $output variable in global_complete.