PHP Banner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • infoseekar
    New Member
    • Mar 2008
    • 34

    PHP Banner

    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
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    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_locati on.ext" /> ?

    Maybe I'm missing the problem :P

    Comment

    • infoseekar
      New Member
      • Mar 2008
      • 34

      #3
      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_locati on.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

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        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?

        Comment

        • infoseekar
          New Member
          • Mar 2008
          • 34

          #5
          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

          Comment

          • infoseekar
            New Member
            • Mar 2008
            • 34

            #6
            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_locati on.ext" /> is working when I replace it with <IMG SRC="img_locati on.ext" />..

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              I dont believe this is a php problem - more suited to HTML/CSS

              Regards

              Comment

              • harshmaul
                Recognized Expert Contributor
                • Jul 2007
                • 490

                #8
                Originally posted by infoseekar
                this script <img src="img_locati on.ext" /> is working when I replace it with <IMG SRC="img_locati on.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.

                Comment

                • infoseekar
                  New Member
                  • Mar 2008
                  • 34

                  #9
                  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.

                  Comment

                  • harshmaul
                    Recognized Expert Contributor
                    • Jul 2007
                    • 490

                    #10
                    post the generated markup... or a link in the html forums and i'll see what i can do to help.

                    Comment

                    • TheServant
                      Recognized Expert Top Contributor
                      • Feb 2008
                      • 1168

                      #11
                      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.

                      Comment

                      • infoseekar
                        New Member
                        • Mar 2008
                        • 34

                        #12
                        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.

                        Comment

                        • coolsti
                          Contributor
                          • Mar 2008
                          • 310

                          #13
                          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.

                          Comment

                          • dlite922
                            Recognized Expert Top Contributor
                            • Dec 2007
                            • 1586

                            #14
                            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:
                             
                            <html>
                            <head>
                            <!--
                            This file retrieved from the JS-Examples archives
                            [url="http://www.js-examples.com/"]http://www.js-examples.com[/url]
                            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/javascripts....html?view=666

                            Comment

                            Working...