Auto-Refresh From Body

I use the wiki to display lots of data that is updated constantly. I use actions to generate pages that retrieve data from various places, almost like monitoring software. I needed to be able to find a way to cause specific pages to refresh once a minute. I was inspired by JasonHuebel MetaRefresh hack, but his didn't allow for the flexibility I needed. I updated my themes to include this php code, and I place a specific tag in the body of my pages when I want them to refresh, which follows after the code.

    if ( $this->GetHandler() != 'edit' || $this->GetHandler() != 'clone'|| $this->GetHandler() != 'addcomment' || $this->GetHandler() != 'acls')
    $mrtablepref = $this->config['table_prefix'];
    $mrtag = $this->page["tag"];

    $mrsearch="<!--- REFRESH --->";
    $mrsql = "SELECT body from $mrtable where tag='$mrtag' ORDER BY id DESC LIMIT 1";

        if ($mrresult = mysql_query($mrsql)) {
            while ($mrlist = mysql_fetch_array($mrresult)) {
                if ( preg_match("/".$mrsearch."/","$mrlist[body]")) {

            if ($BOB=="2") {
               echo "       <meta http-equiv='Refresh' content='60'/>\n";
               echo "       <meta http-equiv='Expires' content='0'/>\n";




""<!--- REFRESH --->""

You can of course adjust the timing by changing the value in the Refresh tag. Although if I have more time to work on this, I may also make it so that it is adjustable via the tag placed in the body of the page.

Please feel free to comment, and help me make this better, I'm willing to learn better ways of doing things if someone sees it. This was the first time I've ever contributed to an Open Source Project.

There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki