Elxis CMS Forum
Support => Elxis 4.x/5.x DEV => Topic started by: michalis1984 on October 05, 2012, 16:19:05
-
Advertisments module does not work with adsense. I paste adsense code and the ads does not appear at the site. When i view the source at the live website i see the adsense code like this..
<div class="module">
<script type="text/javascript"><!--
<br />google_ad_client = "ca-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
<br />/* glwsses.gr - Right Top Adv */
<br />google_ad_slot = "xxxxxxxxxxxxx";
<br />google_ad_width = 120;
<br />google_ad_height = 600;
<br />//-->
<br /></script>
<br /><script type="text/javascript"
<br />src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<br /></script></div>
So, something adds <br /> tag at each line and this breaks the google ads.
-
I have the similar issue.
However instead of "<br />" tags it breaks the script with "///////////" characters here and there.
???
-
Hmm! This is quite interesting... :o
-
Write the ad-sense code in one line and it will work!
<script type="text/javascript">google_ad_client = "ca-pub-xxx"; google_ad_slot = "xxx"; ...</script>
-
Nope!
<script type=\\\"text/javascript\\\"><!--google_ad_client = \\\"ca-pub-5078467753617240\\\";/* v728x90 */google_ad_slot = \\\"3819279798\\\";google_ad_width = 728;google_ad_height = 90;//--></script><script type=\\\"text/javascript\\\"src=\\\"http://pagead2.googlesyndication.com/pagead/show_ads.js\\\"></script>
As you can see, something weird is happening to my code.
It never worked as you suggested. I thought I should wait for the advertisement elements to become active.
What to do?
Is this something related to quotes characters?
-
This is the clean code (write it in one line):
<script type="text/javascript">
google_ad_client = 'ca-pub-5078467753617240'; google_ad_slot = '3819279798'; google_ad_width = 728; google_ad_height = 90;
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
As for the quotes I guess you must disable magic quotes (http://php.net/manual/en/security.magicquotes.php) (which is OK as they are deprecated).
-
magic_quotes_gpc are set to OFF
But I noticed a slight difference from your code to the way I get it from google.
I corrected the code and it works.
Brilliant!!!
Thank you!
@michalis1984 Should we mark this [Solved]?