Author Topic: Imagecode in Adsense- Script dont work  (Read 10138 times)

0 Members and 1 Guest are viewing this topic.

Offline Sumale.my

  • Addicted member
  • ******
  • Posts: 1.790
  • I ♥ 4I
    • View Profile
Imagecode in Adsense- Script dont work
« on: August 01, 2010, 07:21:44 PM »
Hello this is my code in details.php:

// Image Adsense Start
$image_adsense $config['image_adsense'];
$image_adsense_time $config['image_adsense_time'];
   if(
$config['image_adsense_onoff'] == 1)  {
$image_adsense_show .= "<div align=\"center\">\n";
$image_adsense_show .= "<script type=\"text/javascript\">\n";
$image_adsense_show .= "<!--\n";
$image_adsense_show .= "function fc() {\n";
$image_adsense_show .= "if(c>0){\n";
$image_adsense_show .= "document.getElementById(\"dl\").innerHTML = '".$lang['adsense_sek']."<br />".$lang['adsense_loader']."';\n";
$image_adsense_show .= "c=c-1;\n";      
$image_adsense_show .= "setTimeout(\"fc()\", 1000);\n";
$image_adsense_show .= "} else {\n";
$image_adsense_show .= "var tt = '";
$image_adsense_show .= get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link$detailed_view);
$image_adsense_show .= "';\n";
$image_adsense_show .= "document.getElementById(\"dl\").innerHTML = tt;\n";
$image_adsense_show .= "}\n";
$image_adsense_show .= "}\n";
$image_adsense_show .= "var c=".$image_adsense_time.";\n";         
$image_adsense_show .= "if (window.location.hash == \"#dlt\")\n";
$image_adsense_show .= "c = 0;\n";
$image_adsense_show .= "window.onload = fc;\n";
$image_adsense_show .= "//-->\n";
$image_adsense_show .= "</script>\n";
$image_adsense_show .= "<div id=\"dl\">.</div>";
   } else {
	
   
$image_adsense_show get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link$detailed_view);
   }
$site_template->register_vars(array(
  
"image_adsense" => $image_adsense_show,
  
"image_adsense_time" => $image_adsense_time,
  ));
// Image Adsense Ende


If the advertisement is switched off, the original code is given
   } else {
	
   
$image_adsense_show get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link$detailed_view);
   }


If the advertisement is switched on, the Javascript with the image code should be given, but functioned not.
$image_adsense_show .= "<div align=\"center\">\n";
$image_adsense_show .= "<script type=\"text/javascript\">\n";
$image_adsense_show .= "<!--\n";
$image_adsense_show .= "function fc() {\n";
$image_adsense_show .= "if(c>0){\n";
$image_adsense_show .= "document.getElementById(\"dl\").innerHTML = '".$lang['adsense_sek']."<br />".$lang['adsense_loader']."';\n";
$image_adsense_show .= "c=c-1;\n";      
$image_adsense_show .= "setTimeout(\"fc()\", 1000);\n";
$image_adsense_show .= "} else {\n";
$image_adsense_show .= "var tt = '";
$image_adsense_show .= get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link$detailed_view);
$image_adsense_show .= "';\n";
$image_adsense_show .= "document.getElementById(\"dl\").innerHTML = tt;\n";
$image_adsense_show .= "}\n";
$image_adsense_show .= "}\n";
$image_adsense_show .= "var c=".$image_adsense_time.";\n";         
$image_adsense_show .= "if (window.location.hash == \"#dlt\")\n";
$image_adsense_show .= "c = 0;\n";
$image_adsense_show .= "window.onload = fc;\n";
$image_adsense_show .= "//-->\n";
$image_adsense_show .= "</script>\n";
$image_adsense_show .= "<div id=\"dl\">.</div>";

This line simply does not function
$image_adsense_show .= get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link$detailed_view);
But in the source text everything is right
Code: [Select]
<script type="text/javascript">
<!--
function fc() {
if(c>0){
document.getElementById("dl").innerHTML = 'Noch ' + c + ' Sekunden<br /><img src="./templates/default/images/loader.gif" width="16" height="16" />';
c=c-1;
setTimeout("fc()", 1000);
} else {
var tt = '<img src="./data/media/1/1-7be2c989ee4267f4.jpg" border="1" alt="test" width="200" height="266" />
';
document.getElementById("dl").innerHTML = tt;
}
}
var c=2;
if (window.location.hash == "#dlt")
c = 0;
window.onload = fc;
//-->
</script>

Edit://
This work:
$image_adsense_show .= "var tt = '";
$image_adsense_show .= "<img src=\"".MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file']."\" border=\"1\" alt=\"".$image_row['image_name']."\"".$width_height." />";
$image_adsense_show .= "';\n";

But is this conform

and
".$width_height."
dont work
« Last Edit: August 01, 2010, 07:49:18 PM by Sumale.nin »
Beste Grüße
Sumale.my

Offline webmasterforum

  • Pre-Newbie
  • Posts: 9
    • View Profile
    • webmaster forum
Re: Imagecode in Adsense- Script dont work
« Reply #1 on: November 21, 2010, 07:00:52 PM »
I think you should better directly include adsense at seperate html file.

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: Imagecode in Adsense- Script dont work
« Reply #2 on: November 21, 2010, 07:12:54 PM »
Hi,

you should read that or similar in google, it's forbidden by
the rules to display adsense only for seconds and placing the
adsense code on a single html file...

http://www.quickonlinetips.com/archives/2005/05/15-common-mistakes-by-google-adsense-publishers/

auf Deutsch: Benny pass auf, ein adsense account der einmal weg ist, ist es für immer!
Ich mach das auch nicht anders, aber die Adsense Bots besuchen dich und finden das
für google heraus ;) das geht schneller als man denkt...


Gruß Jens

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline Sumale.my

  • Addicted member
  • ******
  • Posts: 1.790
  • I ♥ 4I
    • View Profile
Re: Imagecode in Adsense- Script dont work
« Reply #3 on: November 21, 2010, 08:03:01 PM »
Ach den Mist nutze ich so oderso nicht mehr. Kaum Vergütung und genrell einfach nur Mist es gibt extrem viele bessere Anbieter!
Beste Grüße
Sumale.my

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: Imagecode in Adsense- Script dont work
« Reply #4 on: November 21, 2010, 08:33:13 PM »
Ach den Mist nutze ich so oderso nicht mehr. Kaum Vergütung und genrell einfach nur Mist es gibt extrem viele bessere Anbieter!

Hi,

die wären?
Erzähl mal von deinen Erfahrungen bitte.


Gruß Jens

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Imagecode in Adsense- Script dont work
« Reply #5 on: November 21, 2010, 09:17:07 PM »
You probably are getting javascript error, because JS doesn't allow multiline text.

replace
Code: [Select]
$image_adsense_show .= get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view);

with:
Code: [Select]
$image_adsense_show .= str_replace("\n", " ", str_replace("'", "\'", get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view)));
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

 

Post your comments here