Adsense广告显示问题

Adsense ads display issue

本文关键字:问题 显示 Adsense      更新时间:2023-09-26

广告没有出现在与2个类别相关的特定2个页面中,这些类别包含最新文章和阅读量最高的文章,其他类别使用管理面板添加,只有在撰写文章时指定了类别(或从数据库),文章才会链接php代码中的内容可能会使广告不会只出现在这两个类别中。请列出php和javascript等冲突的可能原因。或者可能是需要从主机加载一些php或apache扩展。。

//Update//广告显示在localhost中,但不显示在远程服务器上//但请注意,只有这两个动态类别没有显示广告;加载了php,如下所示:
热门文章

// Popular articles link
    $popular_li_class = '';
    if ($show_popular)
    {
        $popular_li_class = ' class="selectedcat" ';
    }
    if (_SEOMOD)
    {
        $output = '<li '. $popular_li_class .'><a href="'. _URL .'/articles/popular-01.'. _FEXT .'">'.$lang['articles_mostread'].'</a></li>'. $output;
    }
    else
    {
        $output = '<li '. $popular_li_class .'><a href="'. _URL .'/article.php?show=popular">'.$lang['articles_mostread'].'</a></li>'. $output;
    }

最新文章类别:

//  wrapper
    $output = '<li><a href="'. _URL .'/article.'. _FEXT .'">'.$lang['articles_latest'].'</a></li>'. $output;
    //  wrapper
    if ($ul_wrapper)
    {
        $output = "<ul id='ul_categories'>'n$output'n</ul>";
    }   
    return $output;
}

任何帮助都将不胜感激。谢谢

Adsense代码只是包含在<script></script>标记中的javascript代码。如果您的php代码生成包含此代码的html,则它会正确加载到客户端的浏览器上,并显示广告。检查php代码是否包含任何阻止javascript代码输出的错误。您可以检查生成的源代码。

显示adsense代码就像在php代码中写以下内容一样简单:

include_once("adsense1.php");

其中adsense1.php包含:

<script type="text/javascript"><!--
google_ad_client = "ca-pub-";
google_ad_slot = "xxx";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

或者,你甚至可以这样做:

<?php
print '<script type="text/javascript"><!--
    google_ad_client = "ca-pub-";
    google_ad_slot = "xxx";
    google_ad_width = 728;
    google_ad_height = 90;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>';
?>