Results 1 to 6 of 6

Thread: Refreshing after output sent to browser

  1. #1
    Join Date
    Jun 2004
    Posts
    296
    Rep Power
    0

    Default Refreshing after output sent to browser

    I found a nice little solution to this if you ever need it. If you truly seperate content from functionality you probably wont. Well you might, depending on what you might want to acheive. Anyways I present the code below

    Code:
    1 <?php
    2
    3   function refresh($url='', $timeout=0) {
    4     echo "<meta http-equiv=\"Refresh\" content=\"{$timeout};url={$url}\">";
    5   }
    6
    7   echo '[Demonstrating automatic refresh after output emitted]';
    8   refresh('http://techjamaica.com/forums', 5);
    9 ?>

  2. #2
    Join Date
    Jun 2004
    Posts
    296
    Rep Power
    0

    Default

    actually i prefer to call that function

    http_refresh

    sounds more fitting, dont u think?

  3. #3
    Join Date
    Jan 2005
    Posts
    3,151
    Rep Power
    0

    Default

    Why would you code a function to insert a meta tag that will only be used once per page?

  4. #4
    Join Date
    Jun 2004
    Posts
    296
    Rep Power
    0

    Default

    Quote Originally Posted by pogi_2nr
    Why would you code a function to insert a meta tag that will only be used once per page?
    for many reasons:

    1. promotes better readability, meaning easier maintenance

    2. its easier to type

    3. when one wants to separate content from functionality, the less html the better


    ...

  5. #5
    Join Date
    Feb 2003
    Posts
    3,088
    Rep Power
    0

    Default

    Add a message paramater so that it can tell the user what happening.

  6. #6
    Join Date
    Jun 2004
    Posts
    296
    Rep Power
    0

    Default

    Quote Originally Posted by pogi_2nr
    Why would you code a function to insert a meta tag that will only be used once per page?
    also who said that one has to use this function only once per page. u could use it an indefinite amount of times depending on your conditional logic

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •