instaunt
02-20-2012, 10:43 AM
I have a php CMS code that calls a template based on the URL calling the code. I now have to insert a piece of code that would usually be placed directly in to the PHP page:
$OpenInNewWindow = "1";
$BLKey = "MFECU-J1BMR-TH1J7";
$QueryString = "LinkUrl=".urlencode((($_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$QueryString .= "&Key=" .urlencode($BLKey);
$QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);
if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) {
@readfile("http://brokerage.linkadage.com/engine.php?".$QueryString);
}
elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
if($content = @file("http://brokerage.linkadage.com/engine.php?".$QueryString))
print @join('', $content);
}
elseif(function_exists('curl_init')) {
$ch = curl_init ("http://brokerage.linkadage.com/engine.php?".$QueryString);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
if(curl_error($ch))
print "Error processing request";
curl_close ($ch);
}
else {
print "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information.";
}
To display this, I need to assign a template value e.g. %%newcode%% to this piece of coding but no matter what I try it will not work. How do you wrap up the above text and assign $template['%%newcode%%'] to it?
This may seem like a basic question, but my programmer quit and I'm stuck until I can find a new one. The list of repairs/edits the last guy never did is huge and it's taking me forever because my PHP knowledge is very limited.
Thanks for your help
Mike
$OpenInNewWindow = "1";
$BLKey = "MFECU-J1BMR-TH1J7";
$QueryString = "LinkUrl=".urlencode((($_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$QueryString .= "&Key=" .urlencode($BLKey);
$QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);
if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) {
@readfile("http://brokerage.linkadage.com/engine.php?".$QueryString);
}
elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
if($content = @file("http://brokerage.linkadage.com/engine.php?".$QueryString))
print @join('', $content);
}
elseif(function_exists('curl_init')) {
$ch = curl_init ("http://brokerage.linkadage.com/engine.php?".$QueryString);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
if(curl_error($ch))
print "Error processing request";
curl_close ($ch);
}
else {
print "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information.";
}
To display this, I need to assign a template value e.g. %%newcode%% to this piece of coding but no matter what I try it will not work. How do you wrap up the above text and assign $template['%%newcode%%'] to it?
This may seem like a basic question, but my programmer quit and I'm stuck until I can find a new one. The list of repairs/edits the last guy never did is huge and it's taking me forever because my PHP knowledge is very limited.
Thanks for your help
Mike