PHP Banner
Question posted by: infoseekar
(Member)
on
May 7th, 2008 09:29 AM
Hi
I am trying to create a banner in PHP and I don't know where to start from. I have a picture to put as banner but I dont know how to write a php script/code for it. It would be great if someone can teach or put me in right direction.
Thanks
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Re: PHP Banner
Quote:
Originally Posted by infoseekar
Hi
I am trying to create a banner in PHP and I don't know where to start from. I have a picture to put as banner but I dont know how to write a php script/code for it. It would be great if someone can teach or put me in right direction.
Thanks
|
Hm, what does the banner do? If it's a simple image then why not just display it using <img src="img_location.ext" /> ?
Maybe I'm missing the problem :P
Re: PHP Banner
Quote:
Originally Posted by markusn00b
Hm, what does the banner do? If it's a simple image then why not just display it using <img src="img_location.ext" /> ?
Maybe I'm missing the problem :P
|
Thanks for replaying.. you are right it's a simple image. I want that picture on the top. and what about if that banner going to be animated. Will i be using same script or different.
thanks
Re: PHP Banner
Quote:
Originally Posted by infoseekar
Thanks for replaying.. you are right it's a simple image. I want that picture on the top. and what about if that banner going to be animated. Will i be using same script or different.
thanks
|
How will the banner be animated?
Re: PHP Banner
Quote:
Originally Posted by markusn00b
How will the banner be animated?
|
The script you gave me is working but instead of a picture i only see a box.
Banner would be just flashing text or images..
thanks
Re: PHP Banner
Quote:
Originally Posted by infoseekar
The script you gave me is working but instead of a picture i only see a box.
Banner would be just flashing text or images..
thanks
|
this script <img src="img_location.ext" /> is working when I replace it with <IMG SRC="img_location.ext" />..
Re: PHP Banner
I dont believe this is a php problem - more suited to HTML/CSS
Regards
Re: PHP Banner
Quote:
Originally Posted by infoseekar
this script <img src="img_location.ext" /> is working when I replace it with <IMG SRC="img_location.ext" />..
|
WOW.. have you got a proper doctype declaration in there? also out of curiosity what browser are you using. most browsers start crying if the element's attributes are in uppercase.
Re: PHP Banner
Quote:
Originally Posted by harshmaul
WOW.. have you got a proper doctype declaration in there? also out of curiosity what browser are you using. most browsers start crying if the element's attributes are in uppercase.
|
i am using Internet Explorer.
|
|
May 7th, 2008 11:01 AM
# 10
|
Re: PHP Banner
post the generated markup... or a link in the html forums and i'll see what i can do to help.
|
|
May 7th, 2008 10:18 PM
# 11
|
Re: PHP Banner
Do you want to generate an image using php? I don't believe that you can do this animation you are trying to do with php. Once an image is generated and sent to the user from his page request, that script will not execute again until the page is refreshed. If that is what you want, that's fine, but if you want to be constantly generating new images, you will definately need either Javascript or AJAX.
If it is simply an image you have made in photoshop which is animated, then the code given above is all you need ( <img src=... alt="..." /> ). If that is not working, then it is your code that is buggy. Just confirm that you already have your animated image and you're not trying to generate one on the fly.
|
|
May 9th, 2008 07:56 AM
# 12
|
Re: PHP Banner
Quote:
Originally Posted by TheServant
Do you want to generate an image using php? I don't believe that you can do this animation you are trying to do with php. Once an image is generated and sent to the user from his page request, that script will not execute again until the page is refreshed. If that is what you want, that's fine, but if you want to be constantly generating new images, you will definately need either Javascript or AJAX.
If it is simply an image you have made in photoshop which is animated, then the code given above is all you need ( <img src=... alt="..." /> ). If that is not working, then it is your code that is buggy. Just confirm that you already have your animated image and you're not trying to generate one on the fly.
|
Sorry Guys I didnt tell you that I am a beginner. I dont know anything about Java or AJAX. I am going to stick with ( <img src=... alt="..." /> ) for the time. Yes, I have a gif image. I am going try that.. Thansk for all your help.
|
|
May 9th, 2008 10:25 PM
# 13
|
Re: PHP Banner
Since you are rather new to all of this, something I would like to point out:
You do not need Ajax to make your page dynamically update an image. So you should not be concerned that you need to learn Ajax in order to do this. Ajax is just a way of doing something that was already available to you before Ajax was born. If you do indeed decide to have a page update its image dynamically, you just need some Javascript scripting to change the src attribute of your image tag.
That may make things seem less of a struggle to get started with something like this, in case you need it. And here we mean Javascript, not Java. Javascript is considerably easier to implement, it fits right in there with your HTML on your page, and is not all that difficult to get into.
|
|
May 10th, 2008 07:46 AM
# 14
|
Re: PHP Banner
Quote:
Originally Posted by coolsti
Since you are rather new to all of this, something I would like to point out:
You do not need Ajax to make your page dynamically update an image. So you should not be concerned that you need to learn Ajax in order to do this. Ajax is just a way of doing something that was already available to you before Ajax was born. If you do indeed decide to have a page update its image dynamically, you just need some Javascript scripting to change the src attribute of your image tag.
That may make things seem less of a struggle to get started with something like this, in case you need it. And here we mean Javascript, not Java. Javascript is considerably easier to implement, it fits right in there with your HTML on your page, and is not all that difficult to get into.
|
I think i know what your getting at. This is the simplest solution for him to implement:
Code: ( text )
<html> <head> <!-- This file retrieved from the JS-Examples archives 1000s of free ready to use scripts, tutorials, forums. Author: Doug Popeney - 0 --> </head> <body> <script language="JavaScript"> <!-- Hide from old browsers var imagenumber = 5 ; var randomnumber = Math.random() ; var rand1 = Math.round( (imagenumber-1) * randomnumber) + 1 ; images = new Array images[1] = "/js/pic1.gif" images[2] = "/js/pic2.gif" images[3] = "/js/pic3.gif" images[4] = "/js/pic4.gif" images[5] = "/js/pic1.gif" var image = images[rand1] links = new Array links[1] = "/" links[2] = "/" links[3] = "/" links[4] = "/" links[5] = "/" var link = links[rand1] // -- End Hiding Here --> </script> <script language="JavaScript"> <!-- Hide this script from old browsers --> document.write("<center><b>Reload this page</b></center><br><br>") document.write('<A HREF="' + link + '"><IMG SRC="' + image + '" border="0"></a>') <!-- End Hiding Here --> </script> <BR><center><a href='http://www.js-examples.com'>JS-Examples.com</a></center> </body> </html>
Let me know if you have questions customizing the above.
First set number of images (its currently set to 5)
Then edit the lines that start with images[*number*]. If you have 4 images then you need to change these so its 1 through 4.
After the equal sign set where the image is located just like the <img src="image/path/here.jpg" />
Then the links is easy to do. Link[1] will be for images[1], linke[2] is for image [2].
If you don't want the image to link to anything set the link to "/" or "#".
Good luck,
-Dan
Source: http://www.js-x.com/page/javascript...e.html?view=666
 |
Not the answer you were looking for? Post your question . . .
174,849 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).
|
|
|
Top PHP Forum Contributors
|