我知道对于具有良好 PHP 知识的人来说,这将是一个非常简单的问题。
我有一个自托管的 WordPress 网站。我为移动设备设计了它,我想在其中安装 Millennial Media 广告。Millennial Media 并没有真正提供详细的说明,而且奇怪的是没有网络资源!
我有 HTML、CSS 和 JavaScript 方面的知识,但 PHP 很差 :( 。任何方式我都可以对 PHP 进行一些更改以实现我想要的,但我不能从零开始编写它们并自行集成它们。
好的长话短说这是千禧媒体提供的代码:
<?php
/*--------------------------------------------------------------*/
/* Millennial Media PHP Ad Coding, v.7.4.20 */
/* Copyright Millennial Media, Inc. 2006 */
/* */
/* The following code requires PHP >= 4.3.0 and */
/* allow_url_fopen 1 set in php.ini file. */
/* */
/* NOTE: */
/* It is recommended that you lower the default_socket_timeout */
/* value in the php.ini file to 5 seconds. */
/* This will prevent network connectivity from affecting */
/* page loading. */
/*--------------------------------------------------------------*/
/*------- Publisher Specific Section -------*/
$mm_placementid = 123456;
$mm_adserver = "ads.mp.mydas.mobi";
/* The default response will be echo'd on the page */
/* if no Ad is returned, so any valid WML/XHTML string */
/* is acceptable. */
$mm_default_response = "";
/*------------------------------------------*/
/*----------- BEGIN AD INITIALIZATION ----------*/
/*----- PLEASE DO NOT EDIT BELOW THIS LINE -----*/
$mm_id = "NONE";
$mm_ua = "NONE";
@$mm_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_USER_AGENT'] )){
$mm_ua = $_SERVER['HTTP_USER_AGENT'];
}
if (isset($_SERVER['HTTP_X_UP_SUBNO'])) {
$mm_id = $_SERVER['HTTP_X_UP_SUBNO'];
} elseif (isset($_SERVER['HTTP_XID'])) {
$mm_id = $_SERVER['HTTP_XID'];
} elseif (isset($_SERVER['HTTP_CLIENTID'])) {
$mm_id = $_SERVER['HTTP_CLIENTID'];
} else {
$mm_id = $_SERVER['REMOTE_ADDR'];
}
$mm_url = "http://$mm_adserver/getAd.php5?apid=$mm_placementid&auid="
. urlencode($mm_id) . "&uip=" . urlencode($mm_ip) . "&ua="
. urlencode($mm_ua);
/*------------ END AD INITIALIZATION -----------*/
?>
<?php
/* Place this code block where you want the ad to appear */
/*------- Reusable Ad Call -------*/
@$mm_response = file_get_contents($mm_url);
echo $mm_response != FALSE ? $mm_response : $mm_default_response;
/*--------- End Ad Call ----------*/
?>
我希望广告出现在页脚区域(我将在 21 个主题中编辑 footer.php)但我想知道我应该将这些代码放在 wordpress 文件中的什么位置,或者我应该创建一个新的以及命名什么他们?
有人可以帮我解决这个问题,并为我提供需要编辑的文件名以及它们最终的样子吗?
谢谢