Author |
Message |
gonehaywire
Worker


Joined: May 20, 2004
Posts: 126
|
Posted:
Tue Sep 21, 2004 6:39 pm |
|
Hello,
I'm trying to get this java code to work for rotating banners I understand the first part goes into my_header.php file? but I dont know how to code it right here is the top part code:
<S C R I P T L A N G UA G E="JavaScript" type="text/javascript">
<!--
//JavaScript Rotating Banners
//copyright daxassist, 2000-2004
//visit http://www.daxassist.com for this and other javascripts with full tutorials.
//specify interval between rotating banners (in mili seconds)
var currentlink = 0;
var currentimage = 0;
var delay = 2000;
var newbrowser = true;
//specify banners
if(document.images) {
banpics = new Array();
banpics[0] = new Image();
banpics[0].src = "http://www.yourdomain.com/banners/banner01.jpg";
banpics[1] = new Image();
banpics[1].src = "http://www.yourdomain.com/banners/banner02.jpg";
banpics[2] = new Image();
banpics[2].src = "http://www.yourdomain.com/banners/banner03.jpg";
banpics[3] = new Image();
banpics[3].src = "http://www.yourdomain.com/banners/banner04.jpg";
banpics[4] = new Image();
banpics[4].src = "http://www.yourdomain.com/banners/banner05.jpg";
banpics[5] = new Image();
banpics[5].src = "http://www.yourdomain.com/banners/banner06.jpg";
//specify banner links
banlinks = new Array();
banlinks[0] = "http://www.domainaddress1.com";
banlinks[1] = "http://www.domainaddress2.com";
banlinks[2] = "http://www.domainaddress3.com";
banlinks[3] = "http://www.domainaddress4.com";
banlinks[4] = "http://www.domainaddress5.com";
banlinks[5] = "http://www.domainaddress6.com";
}
function bannerchanger(from) {
if(document.images) {
document.images[from].src = banpics[currentimage].src;
currentlink = currentimage;
if (currentimage < banpics.length-1)
currentimage = currentimage + 1;
else
currentimage = 0;
setTimeout("bannerchanger('" + from + "')", delay);
}
}
function FollowLink() {
if(document.images) {
if (newbrowser == true) {
window.open(banlinks[currentlink], 'newwindow', '', false);
} else
document.location.href = banlinks[currentlink];
}
}
//-->
</s c r i p t>
then the other part of code goes where you want the banners to appear right now i have a blocked called block-banners.php here is the second part of this code:
a href="javascript:FollowLink();"><img id="banner" name="banner" src="http://www.daxassist.com/banners/rotban1.gif" border=0>
I been trying to figure this for a few days now I dont know if its the top part I'm messing up on i know you have to use echo .= but since it has all that // copy right stuff and where the code where it has a 0; ending would it be like 0\n"; or 0;\n";? Grrr I'm so lost on this please help  |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Tue Sep 21, 2004 10:23 pm |
|
|
|
 |
gonehaywire

|
Posted:
Wed Sep 22, 2004 9:02 pm |
|
Thanks, But even that throws me for a loop guess I'll have to scrap the banner idea lol |
|
|
|
 |
Raven

|
Posted:
Wed Sep 22, 2004 9:09 pm |
|
If you have nothing else in my_header, then replace the skeleton code with your code so that nothing at all is in there except your code. Then place your other code in your block with an echo statement, being sure to escape \ any quotes w/i quotes ( echo "<a href=\"blahblah\">"; ). BTW, you're missing the < sign on your code above, assume that's just a typo  |
|
|
|
 |
gonehaywire

|
Posted:
Wed Sep 22, 2004 9:26 pm |
|
I do have other javascripts in my_header.php file for my image fades and yes i left out the < just incase when i hit Submit i didnt get that error for no html tags allowed lol.. if i add that code into my_header do i do with echo again only thing that throws me off in that code up top i pasted in is these // and these 0;
would i end with 0;\n";? or 0\n";? if i can get those 2 figured out then I met be able to do the code |
|
|
|
 |
Raven

|
Posted:
Wed Sep 22, 2004 9:32 pm |
|
Im not understanding what you mean by Quote: | i pasted in is these // and these 0; |
|
|
|
|
 |
gonehaywire

|
Posted:
Wed Sep 22, 2004 9:35 pm |
|
Well see the code up top with these //
<!--
//JavaScript Rotating Banners
//copyright daxassist, 2000-2004
//visit http://www.daxassist.com for this and other javascripts with full tutorials.
//specify interval between rotating banners (in mili seconds)
and abit further down
has these:
var currentlink = 0;
var currentimage = 0;
or couldnt i just leave out //copyright blah blah and the //visit http part?
sorry if i being a pain for a week or so been trying to get a banner code up now lol |
|
|
|
 |
Raven

|
Posted:
Wed Sep 22, 2004 9:39 pm |
|
Those are comments (//) and won't hurt anything. As far as the var=0; you're just initializing those and frm what I see that will not hurt either. So, if you can't understand the HEREDOC syntax, which I find the easiest because you don't have to worry about escaping anything, then just use echo statements. |
|
|
|
 |
gonehaywire

|
Posted:
Wed Sep 22, 2004 10:14 pm |
|
Getting this error? in my_header.php
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/desert/public_html/includes/my_header.php on line 126 |
|
|
|
 |
Raven

|
Posted:
Wed Sep 22, 2004 10:19 pm |
|
That usually means you have mismatched quotes and the parser is never seeing the end of the string. |
|
|
|
 |
gonehaywire

|
Posted:
Wed Sep 22, 2004 10:21 pm |
|
BLAH i'll have to fiddle with it in abit health isnt to great right now trying to do code while being sick sucks code lay down code lay down day after day |
|
|
|
 |
|