IPB

Welcome Guest ( Log In | Register )

 

Outline · [ Standard ] · Linear+

 Just A Simple Question... ^_^, in search of Html knowledge

DarkSykes
post Dec 18 2003, 06:52 PM
Post #1


Jedi


Group: Members
Posts: 64
Joined: 4-November 03
From: in the shadows..
Member No.: 72



Hi.. I was looking at the Pretty RJ site once again.. and was watching the little banner you have created at the top of the page.. with the changing pictures which so happen to be screen shots off the server.. i was just wondering how one might create somthing like that.. What code would need to be enter where the images would need to be placed etc... Im not a pro.. but i know all the basics of Html so.. i think i can understand the explainations given if anyone is willing to give one.. thx.. alot... cya guys on server soon happy.gif


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
TheLizardKing
post Dec 19 2003, 01:35 AM
Post #2


Secretive Rodian Lover Hater


Group: Admin
Posts: 93
Joined: 13-June 03
From: Orlando, Florida, United States of America
Member No.: 1



CODE

function OutputBanner() {
   if ($handle = opendir('./images/banners/')) {
       while (false !== ($file = readdir($handle))) {
           if ($file != '.' && $file != '..') {
               $file_array[] = $file;
           }
       }
   closedir($handle);
   }
   return $file_array[array_rand($file_array)];
}


A php function, simply put it enters the directory in the opendir function and copies all file names not . or .. into $file_array[] it then simply returns a random array value consistong on "./images/banners/FILENAME.FILEEXTENSION"


--------------------
AS;LDJFA;LSKFADS
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
DarkSykes
post Dec 19 2003, 02:51 PM
Post #3


Jedi


Group: Members
Posts: 64
Joined: 4-November 03
From: in the shadows..
Member No.: 72



Anyone care to elaberate just a tad?


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
InfiniteWarrior
post Dec 19 2003, 05:04 PM
Post #4


Emperor


Group: Members
Posts: 726
Joined: 21-June 03
Member No.: 20



Very loosely translated, I think it means that you first have to be running a PHP site (like this one). Create a directory for the various images you want to use, place your images there and then use the code he's provided to call them randomly on the PHP-driven page. (Programmers. rolleyes.gif)

If you don't have PHP, there are also many javascript snippets and CGI programs that will allow you to rotate images on a page. They're just not nearly as clean or efficient.

I never see those banners at RJ myself, as they are being gobbled up by an ad blocker. I'll have to remember to turn that off one day and take a gander.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
TheBeast
post Dec 19 2003, 07:05 PM
Post #5


Master


Group: -=RJ=-Clan
Posts: 438
Joined: 18-June 03
From: Quebec...woohoo !!!
Member No.: 12



One other way to do it... in a PHP page or not (you have to use a 'dynamic' web page language though) is this:

- Name your screenshot all like this

topbanner1.jpg
topbanner2.jpg
topbanner3.jpg
topbanner4.jpg
etc...

- Then with a 'random' function create a number that is between 0 and the last screenshot you have
- Make the filename with the random number (for example: topbanner56.jpg)
- And use a simple IMG HTML tag with the filename as a variable.

Pro
- Faster than Liz's function (I think)

Cons
- You have to change the code everytime you add new screenshots

- Beast


--------------------
"Separately, woman and alcohol can be quite fun... but when you mix them, they can make you a dumbass"

- Red, That's 70's Show :)
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
DarkSykes
post Dec 20 2003, 01:14 AM
Post #6


Jedi


Group: Members
Posts: 64
Joined: 4-November 03
From: in the shadows..
Member No.: 72



i understand a lil of what ur saying but i dont know what function to use in the style sheet.. i dont wanna take up anymore of u guys time asking questions.. cuz i know someones probably annoyed that i havnt figured it out yet.. sad.gif i suppose its not meant to be.. Thanks for having patience with me.. and.. offering ur help much appreciated.. sad.gif


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
TheLizardKing
post Dec 21 2003, 12:31 AM
Post #7


Secretive Rodian Lover Hater


Group: Admin
Posts: 93
Joined: 13-June 03
From: Orlando, Florida, United States of America
Member No.: 1



well HMM, i suppose the first question we should ask you is do you have PHP on your site? You can test by making a file called somethingstupid.php and inside typing this

CODE

<?php phpinfo(); ?>


if something pops up that looks completely different from what you've enetered, you have php. If you know you don't have php find out if you have perl or... well thats all I remember for the serverside languages in that case we are gonna have to use javascript and WOOO doggy you don't want to do that.


--------------------
AS;LDJFA;LSKFADS
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
DarkSykes
post Dec 21 2003, 10:41 PM
Post #8


Jedi


Group: Members
Posts: 64
Joined: 4-November 03
From: in the shadows..
Member No.: 72



no no php.. wink.gif unsure.gif sad.gif


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
TheLizardKing
post Dec 25 2003, 01:04 AM
Post #9


Secretive Rodian Lover Hater


Group: Admin
Posts: 93
Joined: 13-June 03
From: Orlando, Florida, United States of America
Member No.: 1



well then you will have to try to get php, use perl (if you have it) or use javascript, the last two options i have little to no experiance with. sorry sad.gif


--------------------
AS;LDJFA;LSKFADS
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
InfiniteWarrior
post Dec 29 2003, 12:27 AM
Post #10


Emperor


Group: Members
Posts: 726
Joined: 21-June 03
Member No.: 20



Hey, Sykes. Here's a little JS you can try. Pretty clean; works well. This one actually rotates the images w/o a refresh of the page. Not sure if that's what you want. But, if you want to give it a try, put the following in the header of your page:

CODE
<script LANGUAGE="JavaScript" TYPE="text/javascript">
<!--


gImages = new Array(gNumberOfImages);
gImages[0] = "image_path/image1.gif";
gImages[1] = "image_path/image2.gif";
gImages[2] = "image_path/image3.gif";

function canManipulateImages() {
if (document.images)
 return true;
else
 return false;
}
function loadSlide(imageURL) {
if (gImageCapableBrowser) {
 document.slide.src = imageURL;
 return false;
}
else {
 return true;
}
}
function nextSlide() {
gCurrentImage = (gCurrentImage + 1) % gNumberOfImages;
loadSlide(gImages[gCurrentImage]);gSlideshowInterval = 5;
gNumberOfImages = 3;
}
gImageCapableBrowser = canManipulateImages();
gCurrentImage = 0;
setInterval("nextSlide()",gSlideshowInterval * 1000);
// -->
</SCRIPT>


Put this where you want the images to appear:

CODE
<IMG SRC="image_path/image.gif" BORDER=0 ALT="" NAME="slide">


If you want to raise or lower the no. of images you use, change "gNumberOfImages" to the number you want. To change the speed, play with "gSlideshowInterval".
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
DarkSykes
post Dec 29 2003, 09:25 AM
Post #11


Jedi


Group: Members
Posts: 64
Joined: 4-November 03
From: in the shadows..
Member No.: 72



Thank you ... So kind.. happy.gif Hopfully another one of you angels can solve the problem i posted on the jedi help desk.. wub.gif wub.gif


--------------------
user posted image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Topic Options
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:
 

Lo-Fi Version Time is now: 22nd September 2019 - 05:41 PM