Forum Moderators: coopster
Here is the original JS that I am attempting to rewrite: (This is most of the way translated to PHP)
<?php
// if no usr or project set then display visibile
// if usr=="someuser" then display visibile
if($sc_error==1) {
echo("Code corrupted. Insert fresh copy.");
}
else if($sc_remove==1) {
echo("<b>StatCounter cannot track a high volume website like yours for free. This was stated several times during the sign up process. Please remove the code ASAP.</b>");
}
else if ($sc_text) {
echo("<scr" + "ipt language=\"JavaScript\"" + " src=" + $sc_tracking_url + "></scr" + "ipt>");
}
else if ($sc_invisible) {
if($sc_invisible==1) {
//This is the part I am having trouble with
sc_img = new Image();
sc_img.src = sc_tracking_url;
}
else {
echo("<A HREF=\"http://www.StatCounter.com\" TARGET=\"_blank\"><IMG SRC=\""+sc_tracking_url+"\" ALT=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\"><\/A>");
}
}
else {
echo("<A HREF=\"http://www.StatCounter.com\" TARGET=\"_blank\"><IMG SRC=\""+sc_tracking_url+"\" ALT=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\"><\/A>");
}
?>
ss_tracking_url is the image retrieved from statcounter.com's website.
The below is taken from php.net but I could not see a way of making the width and height attributes to say whatever the image that I am putting on the page is.
resource imagecreate ( int x_size, int y_size)
imagecreate() returns an image identifier representing a blank image of size x_size by y_size.
This is the very last part on this conversion... Any help would be greatly appreciated... Thank you in advance.
Wayne
This JavaScript has references to http:// so I cannot use it on our https pages otherwise it throws up a warning. I have rewritten the whole thing in PHP with the hopes that the browser will not care about the port 80 references since they are not be rendered in the HTML code.
The last part that I have is that image() function. I have to keep the code exactly, or at least as close to the statcounter code as I can for it to function properly.
What that function does is if certain conditions do not apply then it will put an image from the statcounter website and place it on your webpage. The image that it pulls is depending on what image you have selected in your administrative control panel at the statcounter website.
is this feasible
<?php
$sc_tracking_url= '<script language=\"javaScript\">
sc_img = new Image();
sc_img.src = sc_tracking_url;
</script>'
?>
Then I would be able to make references to the $sc_tracking_url anytime I would like within the PHP file as long as whatever I am trying to reference is after that code... is that correct?