News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

trying to add image to top of forum with a javascript...HELP

Started by SN95Forums, December 03, 2008, 10:10:56 PM

Previous topic - Next topic

SN95Forums

My forum is here:
http://sn95forums.com/index.php

Im trying to add this javascript in:
http://sn95forums.com/banners/randomcarimage.js

I want it to go where the current banner is, its a random image java script.  I cant find where to enter the code, index template?  Its kind of an odd script.

Also I tried to test load the script with the following code in a html page:
<SCRIPT language="JavaScript" SRC="http://sn95forums.com/banners/randomcarimage.js"></SCRIPT>

But it doesn't load, what am I doing wrong, the only way I can get it to load is to paste the entire script in the html page and I would perfer not to have to do that.

Thanks!

SN95Forums


Kermit

I can suggest you an another way

with a little random image script,you should put the attached file rotate.php in http://sn95forums.com/banners directory

and to show your banners randomly

you should use this code

echo'
<div align="center">
<img src="http://sn95forums.com/banners/rotate.php" alt="" />
</div><br />';



banners and rotate.php should be in the same directory

My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SN95Forums

humm cool, ill try that.  So i upload that php file into my banners directory and it will load the banners within that directory?

also where in my index template would i insert that code?

Kermit

yup, by every refresh of the page you will see an another banner
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SN95Forums

Quote from: Duncan85 on December 05, 2008, 04:14:57 AM
yup, by every refresh of the page you will see an another banner

so where do I insert that in my index template, I keep getting Template Parse Errors.

????

Thanks

Kermit

in index.template.php

Code (find) Select

</head>
<body>';


Code (add after) Select

echo'
<div align="center">
<img src="http://sn95forums.com/banners/rotate.php" alt="" />
</div><br />';

My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SN95Forums

ok I got a error:

Quote"Template Parse Error!
There was a problem loading the /Themes/morestyle/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/morestyle/index.template.php on line 203

194:
195:             current_header_ic = mode;
196:          }
197:       // ]]></script>';
198:
199:    echo '
200: </head>
201: <body>
202: echo'

203: <div align="center">

204: <img src="http://sn95forums.com/banners/rotate.php" alt="" />
205: </div><br />';
206:    <div id="header">';
207:          echo '

The thing is I couldnt find
</head>
<body>';


I could only find:

echo '
</head>
<body>
<div id="header">';


I attached my index template a few posts up if you dont mind taking a quick look.

Thanks again,
Matt

Kermit

My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SN95Forums

Quote from: Duncan85 on December 07, 2008, 03:57:38 PM
how about this   ::)


btw don't forget to move rotate.php in http://sn95forums.com/banners directory

Ok that works but it doesnt refresh on each click in the forums.  I used to have it setup like that before.  Right now it will only change if you physcially click refresh.

also any chance of having it where the current logo is, below the line?
http://www.sn95forums.com

Kermit

Quote from: SN95Forums on December 07, 2008, 08:06:45 PM


Ok that works but it doesnt refresh on each click in the forums.  I used to have it setup like that before.  Right now it will only change if you physcially click refresh.


This is the problem just with firefox,i've tested with internet explorer & opera,it works fine,but i don't know,why firewoks needs to be clicked on refresh button

Quote from: SN95Forums on December 07, 2008, 08:06:45 PM
also any chance of having it where the current logo is, below the line?
http://www.sn95forums.com

I will take a look at that

Edit: I need your style.css for that
My Mods
Please don't PM/mail me for support,unless i invite you
Formerly known as Duncan85
Quote
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

A. Einstein

SN95Forums

weird, any other script maybe? because everyone seems to use firefox these days. I tried some other scripts but they wouldnt load up.

I have attached a style.css (there are 5 colors so let me know what you did and ill change the others)

Thanks,
Matt


Rumbaar

For the original question you might not have been echoing it or putting it in the correct location try:
echo '
<SCRIPT language="JavaScript" SRC="http://sn95forums.com/banners/randomcarimage.js"></SCRIPT>
';


Also be sure to run repair_settings.php tool as your paths are incorrect for your current domain URL.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Advertisement: