Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.3
Author Message
gonehaywire
Worker
Worker



Joined: May 20, 2004
Posts: 126

PostPosted: Tue Sep 21, 2004 6:39 pm Reply with quote

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 Crying or Very sad
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Tue Sep 21, 2004 10:23 pm Reply with quote

Javascript is most easily added by using what's called the HEREDOC (or sometimes WHEREDOC) syntax. See this http://www.ravenphpscripts.com/postt28.html
 
View user's profile Send private message
gonehaywire







PostPosted: Wed Sep 22, 2004 9:02 pm Reply with quote

Thanks, But even that throws me for a loop guess I'll have to scrap the banner idea lol
 
Raven







PostPosted: Wed Sep 22, 2004 9:09 pm Reply with quote

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 Wink
 
gonehaywire







PostPosted: Wed Sep 22, 2004 9:26 pm Reply with quote

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







PostPosted: Wed Sep 22, 2004 9:32 pm Reply with quote

Im not understanding what you mean by
Quote:
i pasted in is these // and these 0;
 
gonehaywire







PostPosted: Wed Sep 22, 2004 9:35 pm Reply with quote

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







PostPosted: Wed Sep 22, 2004 9:39 pm Reply with quote

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







PostPosted: Wed Sep 22, 2004 10:14 pm Reply with quote

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







PostPosted: Wed Sep 22, 2004 10:19 pm Reply with quote

That usually means you have mismatched quotes and the parser is never seeing the end of the string.
 
gonehaywire







PostPosted: Wed Sep 22, 2004 10:21 pm Reply with quote

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
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.3

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©