Webtiryaki Bulut Themes!

The simplest and fastest way to build great UI for your community.

How to insert Google Adsense Code in PHP script?

  • Thread starter Thread starter El Bachir Argoub
  • Start date Start date
E

El Bachir Argoub

Guest
How to echo AdSense code with PHP? Here is the sample of my code which I am working for a codeigniter php.

Code:
$adsence = " 

<div class=\"right-inner\">
            <center width=\"96% class=\"img-responsive center-block\">
                            <script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>

<!-- quiz_net -->
              <ins class=\"adsbygoogle\"
                 style=\"display:block\"
                 data-ad-client=<?php echo $client ?>
                 data-ad-slot=<?php echo $slot ?>
                 data-ad-format=\"auto\"></ins>
              <script>
              (adsbygoogle = window.adsbygoogle || []).push({});
              </script>
            </center>     
</div>";

echo $adsence;

All I want to insert adsense code inside a div with PHP. I also tried with htmlentities along with stripslashes but ad in not getting displayed.
<p>How to echo AdSense code with PHP? Here is the sample of my code which I am working for a codeigniter php.</p>

<pre><code>$adsence = "

<div class=\"right-inner\">
<center width=\"96% class=\"img-responsive center-block\">
<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>

<!-- quiz_net -->
<ins class=\"adsbygoogle\"
style=\"display:block\"
data-ad-client=<?php echo $client ?>
data-ad-slot=<?php echo $slot ?>
data-ad-format=\"auto\"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>
</div>";

echo $adsence;
</code></pre>

<p>All I want to insert adsense code inside a div with PHP. I also tried with htmlentities along with stripslashes but ad in not getting displayed.</p>
Continue reading...
 
Top