how to refresh my page every ten seconds?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hemavathi
    New Member
    • Mar 2008
    • 3

    how to refresh my page every ten seconds?

    can someone help me with code to refresh my PHP pages every ten seconds?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Originally posted by Hemavathi
    can someone help me with code to refresh my PHP pages every ten seconds?
    There are no PHP pages, just HTML pages, 'constructed' by PHP and send to the client.

    You could use statement[code=html]<meta http-equiv="refresh" content="10">[/code]at the top of your html page.

    This is a HTML and (maybe later) JavaScript question, so I will move it to that form.

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      Originally posted by Hemavathi
      can someone help me with code to refresh my PHP pages every ten seconds?
      Either use the meta tag[html]<meta http-equiv="refresh" content="10" />
      <meta http-equiv="cache-control" content="no-cache" />[/html]Or use setTimeout to call a function which refreshes your page.[CODE=javascript]function refreshAfter10( ) {
      window.setTimeo ut("refreshPage ()",10000); //10000micro sec = 10 sec
      }
      function refreshPage() {
      window.location .replace('http://www.yoursite.co m');
      }[/code]Call refreshAfter10( ) onload of body.

      Comment

      • Hemavathi
        New Member
        • Mar 2008
        • 3

        #4
        [QUOTE=hsriat]Either use the meta tag[html]<meta http-equiv="refresh" content="10" />
        <meta http-equiv="cache-control" content="no-cache" />[/html]Or use setTimeout to call a function which refreshes your page.[CODE=javascript]function refreshAfter10( ) {
        window.setTimeo ut("refreshPage ()",10000); //10000micro sec = 10 sec
        }
        function refreshPage() {
        window.location .replace('http://www.yoursite.co m');
        }[/code]Call refreshAfter10( ) onload of body.[/QUOte

        How could I check whether it is refreshed?????

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Originally posted by Hemavathi
          How could I check whether it is refreshed?????
          Display your screen and see it flicker every 10 seconds. How else do you suggest you can/want to check that?

          Ronald

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            Originally posted by ronverdonk
            Display your screen and see it flicker every 10 seconds. How else do you suggest you can/want to check that?

            Ronald
            I think that the refresh goes too fast that she's not able to find out if its refreshed.

            @Hemavathi
            Add alert('I\'m Refreshed'); in the onload of the body. And see if its displayed after 10 sec.

            Comment

            • ronverdonk
              Recognized Expert Specialist
              • Jul 2006
              • 4259

              #7
              My screen is probably too slow. I notice a refresh being done. Time to buy a faster one.

              Ronald

              Comment

              • hsriat
                Recognized Expert Top Contributor
                • Jan 2008
                • 1653

                #8
                Originally posted by ronverdonk
                My screen is probably too slow. I notice a refresh being done. Time to buy a faster one.

                Ronald
                :D
                Even mine is not that fast. I just guessed that may be her screen is, along with her server.

                Comment

                • susee
                  New Member
                  • Mar 2008
                  • 10

                  #9
                  is thr any equivalent statement in php to refresh the content like meta tag(<meta http-equiv="refresh" content="10">) in HTML?

                  Comment

                  • Hemavathi
                    New Member
                    • Mar 2008
                    • 3

                    #10
                    yeah i too look for the same....

                    Comment

                    • ronverdonk
                      Recognized Expert Specialist
                      • Jul 2006
                      • 4259

                      #11
                      Originally posted by susee
                      is thr any equivalent statement in php to refresh the content like meta tag(<meta http-equiv="refresh" content="10">) in HTML?
                      Not really. PHP is a server side language, HTML and JavaScript run client side. And the latter has to be refreshed. So if you could force PHP to send a new HTML page to the client, you could. But I'd stick with HTML/JavaScript solution if I were you.

                      Ronald

                      Comment

                      • susee
                        New Member
                        • Mar 2008
                        • 10

                        #12
                        Originally posted by ronverdonk
                        Not really. PHP is a server side language, HTML and JavaScript run client side. And the latter has to be refreshed. So if you could force PHP to send a new HTML page to the client, you could. But I'd stick with HTML/JavaScript solution if I were you.

                        Ronald
                        Let me explain in detail, I ve a HTML page in which I display some values reading from an XML which change dynamically.I have used PHP to read from the xml. Now my problem is to get the xml entries whenever i refresh my page. How can i do this?

                        Comment

                        • hsriat
                          Recognized Expert Top Contributor
                          • Jan 2008
                          • 1653

                          #13
                          Originally posted by susee
                          Let me explain in detail, I ve a HTML page in which I display some values reading from an XML which change dynamically.I have used PHP to read from the xml. Now my problem is to get the xml entries whenever i refresh my page. How can i do this?
                          Please tell in details how are you doing it... with some code.

                          Comment

                          • ronverdonk
                            Recognized Expert Specialist
                            • Jul 2006
                            • 4259

                            #14
                            Let me explain in detail, I ve a HTML page in which I display some values reading from an XML which change dynamically.I have used PHP to read from the xml. Now my problem is to get the xml entries whenever i refresh my page. How can i do this?
                            You are not talking about an RSS feed, are you?

                            Ronald

                            Comment

                            • susee
                              New Member
                              • Mar 2008
                              • 10

                              #15
                              Originally posted by ronverdonk
                              You are not talking about an RSS feed, are you?

                              Ronald

                              may be similar to that. Help me out in tis...
                              Last edited by susee; Mar 6 '08, 03:47 AM. Reason: reply is not complete

                              Comment

                              Working...