如何在dwt或lib模板中插入php?

2016-07-07 15:02 来源:www.chinab4c.com 作者:ecshop专家

我想在footer中加入backlinks(卖链接赚美元的那个)的php代码,却不知道该如何添加,请各位大神指点~
代码如下
  1. <?php
  2. // THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION.
  3. // PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED.

  4. // MODIFY THE VARIABLES BELOW:
  5. // The following variable defines whether links are opened in a new window
  6. // (1 = Yes, 0 = No)
  7. $OpenInNewWindow = "1";

  8. // # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE!
  9. // ----------------------------------------------
  10. $BLKey = "FTBG-41SD-68GJ";

  11. if(strlen($_SERVER['SCRIPT_URI'])){
  12. $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_URI'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
  13. }

  14. if(!strlen($_SERVER['REQUEST_URI'])){
  15. $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:'');
  16. }

  17. $QueryString= "LinkUrl=".urlencode((($_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
  18. $QueryString .= "&Key=" .urlencode($BLKey);
  19. $QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow);


  20. if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) {
  21. @readfile("http://www.backlinks.com/engine.php?".$QueryString);
  22. }
  23. elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) {
  24. if($content = @file("http://www.backlinks.com/engine.php?".$QueryString))
  25. print @join('', $content);
  26. }
  27. elseif(function_exists('curl_init')) {
  28. $ch = curl_init ("http://www.backlinks.com/engine.php?".$QueryString);
  29. curl_setopt ($ch, CURLOPT_HEADER, 0);
  30. curl_exec ($ch);

  31. if(curl_error($ch))
  32. print "Error processing request";

  33. curl_close ($ch);
  34. }
  35. else {
  36. 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.";
  37. }
  38. ?>
复制代码

回答:
模板和代码是分开的
你需要在模板引用PHP代码或者返回值

这对于我来说难度太大了,对php一窍不通

http://bbs.ecshop.com/thread-111614-1-1.html