[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Meta Refresh a Div section only --> Not the entire page

Posted on 2007-09-28
10
Medium Priority
?
1,614 Views
Last Modified: 2013-11-19
Hi everyone hope u are well :>)

You guys have shown me how to metarefresh an entire page which is great and thank you.

What I really need to do however is to metarefresh just a div section of a page, because my pages are quite long and contain a lot of images.

My page is a php page.

The div section that needs to be refreshed every x seconds is:

<div id="gumax-site-logo">
    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'mr_rhino_1.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</div>

Thank you :>)
0
Comment
Question by:Simon336697
  • 5
  • 5
10 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19977230
Meta refresh is like telling the server to reload the page.
It does not work on anything but a comeplete page.

What you want is either Ajax. To execute a script that gets some data from the server at intervals and replaces some part of the page with the result.

Alternatively (and easier for you to implement and understand), is to use an iframe and have that iframe reload (using meta refresh if you so wish)

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19977291
So instead of

<div id="gumax-site-logo">
    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'mr_rhino_1.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</div>

have

<iframe id="gumax-site-logo" src="refereshing.php"></iframe>

and have refreshing.php be something like





<?php
// connect to the DB and get the styepath and stylename hrefs and messages

$sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'mr_rhino_1.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
<html>
<head>
<meta http-equiv="refresh" content"5; url=http://www.yourserver.com/refreshing.php" />
</head>
<body>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</body>
</html>
0
 
LVL 1

Author Comment

by:Simon336697
ID: 19977295
Okay mp understand.

Would it be easy to change the div section into an iframe?

<div id="gumax-site-logo">
    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'mr_rhino_1.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</div>
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 2000 total points
ID: 19977312
See my previous post :)

I forgot to mention that you probably want to do

<body topmargin="0" leftmargin="0" margin="0"><a href=....
0
 
LVL 1

Author Comment

by:Simon336697
ID: 19977844
Hi mp thank you mate.

There is a weird thing going on with this new testing versions.

Files involved are:
(2) - for the WORKING PRE-TESTING VERSION
Gumax.php
poll_images.pl
(3) - for the TESTING VERSION (current changes)
GuMax.php
refreshing.php
poll_images.pl

In both cases:
- poll_images.pl is correctly finding GuMax.php to load a random image into the div section, or load an image into the iframe of refreshing.php

All the working version does is basically load a random image into the div of GuMax.php.
What as you know we're trying to do is to do it from an iframe.

In the working version, the page layout is as follows......
Note the space on either side of the <div id="gumax-site-logo">. The space exists the whole vertical length of the page, so the page looks like 3 columns :>)

                                             Page
<---------------------------------------------------------------------------------->
                <Single row menu eg.I think it is div id="gumax-p-login:>
<space> <-------------<div id="gumax-site-logo">-------------->  <space>
                             
etc etc

In the testing version, the page looks like as follows.......

                                             Page
<---------------------------------------------------------------------------------->
                <Single row menu eg.I think it is div id="gumax-p-login:>
<space> <iframe<space><------------- Nothing here.....as if it has been chopped off -->

Also, in the above, in the iframe, it looks like it is loading multiple copies of the same page, so in the iframe area, it looks like there is a cascading list of pages inside it like the following.......
               <iframe><space>
                      <Single Row menu>
                            <Single Row menu>
                                     <Single Row menu>
                                                on and on.
                                                then text as if a page inside, saying
                                                Skins/Refreshing.php
Really weird..
                             
etc etc


If its okay, I will post the WORKING VERSION (without any changes, and without the refreshing.php file, and without refreshing of the iframe etc etc)  followed by the TESTING VERSION we are currently working on.

The WORKING VERSION (GuMax.php) = this just updates the <div id="gumax-site-logo"> every minute by a perl script called poll_images.pl.

================================================================= GuMax.php (WORKING)

<?php
/*
 * ----------------------------------------------------------------------------
 * 'GuMax' style sheet for CSS2-capable browsers.
 *       Loosely based on the monobook style
 *
 * @Version 3.1.1
 * @Author Paul Y. Gu, <gu.paul@gmail.com>
 * @Copyright paulgu.com 2006 - http://www.paulgu.com/
 * @License: GPL (http://www.gnu.org/copyleft/gpl.html)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * ----------------------------------------------------------------------------
 */

if( !defined( 'MEDIAWIKI' ) )
    die( -1 );

/** */
require_once('includes/SkinTemplate.php');

/**
 * Inherit main code from SkinTemplate, set the CSS and template filter.
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class SkinGuMax extends SkinTemplate {
    /** Using GuMax. */
    function initPage( &$out ) {
        SkinTemplate::initPage( $out );
        $this->skinname  = 'gumax';
        $this->stylename = 'gumax';
        $this->template  = 'GuMaxTemplate';
    }
}

/**
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class GuMaxTemplate extends QuickTemplate {
    /**
     * Template filter callback for GuMax skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    function execute() {
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
    foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
        ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
    } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">

<head>
    <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />    
    <?php $this->html('headlinks') ?>
    <title><?php $this->text('pagetitle') ?></title>
    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/gumax_main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style>
    <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
    <link rel="stylesheet" type="text/css" media="handheld" href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/handheld.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
    <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->

    <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>

    <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
    <?php    if($this->data['jsvarurl'  ]) { ?>
        <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl'  ) ?>"><!-- site js --></script>
    <?php    } ?>
    <?php    if($this->data['pagecss'   ]) { ?>
        <style type="text/css"><?php $this->html('pagecss'   ) ?></style>
    <?php    }
        if($this->data['usercss'   ]) { ?>
        <style type="text/css"><?php $this->html('usercss'   ) ?></style>
    <?php    }
        if($this->data['userjs'    ]) { ?>
        <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
    <?php    }
        if($this->data['userjsprev']) { ?>
        <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
    <?php    }
    if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
    <!-- Head Scripts -->
    <?php $this->html('headscripts') ?>
</head>

<body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload'    ]) { ?>onload="<?php     $this->text('body_onload')     ?>"<?php } ?>
 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">

    <!-- =================== gumax-page =================== -->
    <div id="gumax-page">
    <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>

    <!-- Header -->
    <div id="gumax-header">
        <a name="top" id="contentTop"></a>

        <!-- Site Logo -->
        <div id="gumax-p-logo">
            <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
                ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
                ?>title="<?php $this->msg('mainpage') ?>"></a>
        </div>
        <!-- end of Site Logo -->

        <!-- Login -->
        <div id="gumax-p-login">
            <ul>
              <?php $lastkey = end(array_keys($this->data['personal_urls'])) ?>
              <?php foreach($this->data['personal_urls'] as $key => $item) {
              ?><li id="gumax-pt-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
               echo htmlspecialchars($item['href']) ?>"<?php
              if(!empty($item['class'])) { ?> class="<?php
               echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
               echo htmlspecialchars($item['text']) ?></a>
               <?php if($key != $lastkey) echo "|" ?></li>
             <?php } ?>
            </ul>
        </div> <!-- end of gumax-p-login DIV -->
        <!-- end of Login -->

<div id="gumax-site-logo">
    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'Panorama-AussieStadium-Oct2005.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</div>
    </div> <!-- end of header DIV -->
    <!-- end of Header -->

    <!-- navigation menu -->
    <table id="gumax-p-navigation-table"><tr><td class="gumax-navigation-table-left">
        <!-- Navigation Menu -->
<!--         <div id="gumax-p-navigation-wrapper"> -->
        <div id="gumax-p-navigation">
        </div>
        <!-- end of Navigation Menu -->
        </td><td class="gumax-navigation-table-right">
        <!-- Search -->


         <!-- end of gumax-p-search DIV -->
        <!-- end of Search -->
    </td></tr></table>
    <!-- end of navigation menu -->
   
                 <!-- show back to top link only if the body is longer than the window height -->



    <!-- Main Content -->
    <div id="content">
        <a name="top" id="top"></a>
        <!-- BACK TO TOP LINK ############################################################################# -->
        <!--     <script type="text/javascript"> -->
        <!--             document.write('<div class="backToTop"><a href="#" onclick="window.scrollTo(0,0);return false;" title="Back to the top of the page">&nbsp;</a></div>'); -->
        <!--    </script> -->
       
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
        <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
        <div id= "bodyContent" class="gumax-bodyContent">
            <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
            <div id="contentSub"><?php $this->html('subtitle') ?></div>
            <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php     $this->html('undelete') ?></div><?php } ?>
            <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
            <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
            <!-- start content -->
            <?php $this->html('bodytext') ?>
            <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
            <!-- end content -->

             <!-- show back to top link only if the body is longer than the window height -->
            <script type="text/javascript">
                var winheight = parseInt(document.documentElement.clientHeight)
                var boheight = parseInt(document.body.scrollHeight)
                if(winheight <= boheight) {
                    document.write('<div class="backToTop"><a href="#" onclick="window.scrollTo(0,0);return false;" title="Back to the top of the page">&nbsp;</a></div>');
                }
            </script>
           

            <div class="visualClear"></div>
        </div>
    </div> <!-- end of gumax-content DIV -->
    <!-- end of Main Content -->

    </div> <!-- end of gumax-page DIV -->
    <!-- =================== end of gumax-page =================== -->

    <!-- =================== gumax-page-actions =================== -->
    <!-- gumax-page-actions -->
    <div id="gumax-page-actions">
        <div id="gumax-content-actions">
        <ul>
            <?php $lastkey = end(array_keys($this->data['content_actions'])) ?>
            <?php foreach($this->data['content_actions'] as $key => $action) {
               ?><li id="ca-<?php echo Sanitizer::escapeId($key) ?>"
               <?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
               ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
               echo htmlspecialchars($action['text']) ?></a>
               <?php if($key != $lastkey) echo "|" ?></li>
               <?php } ?>
        </ul>
        </div>
    </div> <!-- end of gumax-page-actions DIV -->
    <!-- =================== end of gumax-page-actions =================== -->

    <!-- =================== gumax-page-footer =================== -->
    <div id="gumax-page-footer">

        <!-- personal tools  -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <div id="gumax-personal-tools">
            <ul>
              <?php if($this->data['notspecialpage']) { foreach( array( 'whatlinkshere', 'recentchangeslinked' ) as $special ) { ?>
              <li id="t-<?php echo $special?>"><a href="<?php
                echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
                ?>"><?php echo $this->msg($special) ?></a> | </li>
              <?php } } ?>
              <?php if($this->data['feeds']) { ?><li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
                ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
                echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
                <?php } ?> | </li><?php } ?>
              <?php foreach( array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) { ?>
              <?php if($this->data['nav_urls'][$special]) {?><li id="t-<?php echo $special ?>"><a href="<?php
                echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
                ?>"><?php $this->msg($special) ?></a>
                <?php if($special != 'specialpages') echo "|" ?></li>
                <?php } ?>
              <?php }

                if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
                        <li id="t-permalink"> | <a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
                        ?>"><?php $this->msg('permalink') ?></a> | </li><?php
                } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
                        <li id="t-ispermalink"> | <?php $this->msg('permalink') ?></li><?php
                }

                wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); ?>
<!-- Enter new links here to be seen on the same line as What links here, Related changes etc. -->
<li><a href="/mediawiki/index.php/Special:Categories">Categories</a> | </li>
<li><a href="/mediawiki/index.php/Category:Templates">Templates</a> | </li>
<li><a href="/mediawiki/index.php/Special:Allpages">All Pages</a></li>
            </ul>
           
        </div> <!-- end of personal-tools DIV -->
        <!-- end of personal tools  -->

        <!-- gumax-footer -->
        <div id="gumax-footer">
            <div id="gumax-f-message">
                <?php if($this->data['lastmod'   ]) { ?><span id="f-lastmod"><?php    $this->html('lastmod')    ?></span><?php } ?>
                <?php if($this->data['viewcount' ]) { ?><span id="f-viewcount"><?php  $this->html('viewcount')  ?> </span><?php } ?>
            </div>
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
           
            <ul id="gumax-f-list">
                <?php if($this->data['about'     ]) { ?><li id="f-about"><?php      $this->html('about')      ?> | </li><?php } ?>
                <li><a href="/mediawiki/index.php/Change_Log">Change Log</a> | </li>
                <li><a href="/mediawiki/index.php/Site_Extensions">Site Extensions</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_HOWTOs">MediaWiki HOWTOs</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_Links">MediaWiki Links</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_Maintenance">Maintenance</a> | </li>
                <?php if($this->data['disclaimer']) { ?><li id="f-disclaimer"><?php $this->html('disclaimer') ?> | </li><?php } ?>              
                <li><a href="http://mediawiki.org">Powered by MediaWiki</a> | </li>
                <li><a href="http://paulgu.com">Design by Paul Gu</a></li>
            </ul>
        </div> <!-- end of gumax-footer DIV -->
        <!-- end of gumax-footer -->

        <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>

    </div> <!-- end of gumax-page-footer DIV -->
    <!-- =================== end of gumax-page-footer =================== -->

    <?php $this->html('reporttime') ?>

</body></html>
<?php
      wfRestoreWarnings();
      } // end of execute() method
} // end of class
?>

================================================================= poll_images.pl (WORKING)

#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;


sub PollImages      {
my $ImageDir = '/var/www/html/mediawiki/skins/gumax/images/header';
my $PHPFile = '/var/www/html/mediawiki/skins/GuMax.php';
my @Files=glob("$ImageDir/*");
@Files = grep(!/thumbs.db/i, @Files);
my $logo=$Files[int(rand(scalar @Files))];
$logo =~ s/^.*[\/\\]//;

open(IN,"<$PHPFile") or die "Could not open file: $!\n";
local $/;
my $php = <IN>;
close(IN);
$php =~ s|(/\* CHANGE_LOGO_IMAGE_HERE__BEGIN \*/ ).*?( /\* CHANGE_LOGO_IMAGE_HERE__END \*/)|$1'$logo'$2|;

open(OUT,">$PHPFile") or die "Could not open file for write: $!\n";
print OUT $php;
close(OUT);
}

PollImages();

================================================================ GuMax.php (TESTING)

<?php
/*
 * ----------------------------------------------------------------------------
 * 'GuMax' style sheet for CSS2-capable browsers.
 *       Loosely based on the monobook style
 *
 * @Version 3.1.1
 * @Author Paul Y. Gu, <gu.paul@gmail.com>
 * @Copyright paulgu.com 2006 - http://www.paulgu.com/
 * @License: GPL (http://www.gnu.org/copyleft/gpl.html)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * ----------------------------------------------------------------------------
 */

if( !defined( 'MEDIAWIKI' ) )
    die( -1 );

/** */
require_once('includes/SkinTemplate.php');

/**
 * Inherit main code from SkinTemplate, set the CSS and template filter.
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class SkinGuMax extends SkinTemplate {
    /** Using GuMax. */
    function initPage( &$out ) {
        SkinTemplate::initPage( $out );
        $this->skinname  = 'gumax';
        $this->stylename = 'gumax';
        $this->template  = 'GuMaxTemplate';
    }
}

/**
 * @todo document
 * @package MediaWiki
 * @subpackage Skins
 */
class GuMaxTemplate extends QuickTemplate {
    /**
     * Template filter callback for GuMax skin.
     * Takes an associative array of data set from a SkinTemplate-based
     * class, and a wrapper for MediaWiki's localization database, and
     * outputs a formatted page.
     *
     * @access private
     */
    function execute() {
        // Suppress warnings to prevent notices about missing indexes in $this->data
        wfSuppressWarnings();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="<?php $this->text('xhtmldefaultnamespace') ?>" <?php
    foreach($this->data['xhtmlnamespaces'] as $tag => $ns) {
        ?>xmlns:<?php echo "{$tag}=\"{$ns}\" ";
    } ?>xml:lang="<?php $this->text('lang') ?>" lang="<?php $this->text('lang') ?>" dir="<?php $this->text('dir') ?>">

<head>
    <meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />    
    <?php $this->html('headlinks') ?>
    <title><?php $this->text('pagetitle') ?></title>
    <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/gumax_main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style>
    <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
    <link rel="stylesheet" type="text/css" media="handheld" href="<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/handheld.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
    <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
    <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
    <meta http-equiv="imagetoolbar" content="no" /><![endif]-->

    <?php print Skin::makeGlobalVariablesScript( $this->data ); ?>

    <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
    <?php    if($this->data['jsvarurl'  ]) { ?>
        <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl'  ) ?>"><!-- site js --></script>
    <?php    } ?>
    <?php    if($this->data['pagecss'   ]) { ?>
        <style type="text/css"><?php $this->html('pagecss'   ) ?></style>
    <?php    }
        if($this->data['usercss'   ]) { ?>
        <style type="text/css"><?php $this->html('usercss'   ) ?></style>
    <?php    }
        if($this->data['userjs'    ]) { ?>
        <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('userjs' ) ?>"></script>
    <?php    }
        if($this->data['userjsprev']) { ?>
        <script type="<?php $this->text('jsmimetype') ?>"><?php $this->html('userjsprev') ?></script>
    <?php    }
    if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
    <!-- Head Scripts -->
    <?php $this->html('headscripts') ?>
</head>

<body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
<?php if($this->data['body_onload'    ]) { ?>onload="<?php     $this->text('body_onload')     ?>"<?php } ?>
 class="mediawiki <?php $this->text('nsclass') ?> <?php $this->text('dir') ?> <?php $this->text('pageclass') ?>">

    <!-- =================== gumax-page =================== -->
    <div id="gumax-page">
    <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>

    <!-- Header -->
    <div id="gumax-header">
        <a name="top" id="contentTop"></a>

        <!-- Site Logo -->
        <div id="gumax-p-logo">  
           <a style="background-image: url(<?php $this->text('logopath') ?>);" <?php
               ?>href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" <?php
                ?>title="<?php $this->msg('mainpage') ?>"></a> -->
       </div>
        <!-- end of Site Logo -->
       

       
       
       
       
       

        <!-- Login -->
        <div id="gumax-p-login">
            <ul>
              <?php $lastkey = end(array_keys($this->data['personal_urls'])) ?>
              <?php foreach($this->data['personal_urls'] as $key => $item) {
              ?><li id="gumax-pt-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
               echo htmlspecialchars($item['href']) ?>"<?php
              if(!empty($item['class'])) { ?> class="<?php
               echo htmlspecialchars($item['class']) ?>"<?php } ?>><?php
               echo htmlspecialchars($item['text']) ?></a>
               <?php if($key != $lastkey) echo "|" ?></li>
             <?php } ?>
            </ul>
        </div> <!-- end of gumax-p-login DIV -->
        <!-- end of Login -->

<!-- <div id="gumax-site-logo"> -->
<!--    <?php $sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'death_valley_flowers_panorama.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?> -->
<!--     <a style="background-image: url(<?php echo $sitelogo ?>);" -->
<!--        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>" -->
<!--        title="<?php $this->msg('mainpage') ?>"></a> -->
<!-- </div> -->

<!--  ################################### IFRAME REPLACEMENT LINE FOR DIV ID GUMAX-SITE-LOGO ABOVE ############################ -->

<iframe id="gumax-site-logo" src="skins/refreshing.php"></iframe>

<!--  ################################### IFRAME REPLACEMENT LINE FOR DIV ID GUMAX-SITE-LOGO ABOVE ############################ -->


    </div> <!-- end of header DIV -->
    <!-- end of Header -->

    <!-- navigation menu -->
    <table id="gumax-p-navigation-table"><tr><td class="gumax-navigation-table-left">
        <!-- Navigation Menu -->
<!--         <div id="gumax-p-navigation-wrapper"> -->
        <div id="gumax-p-navigation">
        </div>
        <!-- end of Navigation Menu -->
        </td><td class="gumax-navigation-table-right">
        <!-- Search -->


         <!-- end of gumax-p-search DIV -->
        <!-- end of Search -->
    </td></tr></table>
    <!-- end of navigation menu -->
   
                 <!-- show back to top link only if the body is longer than the window height -->



    <!-- Main Content -->
    <div id="content">
        <a name="top" id="top"></a>
        <!-- BACK TO TOP LINK ############################################################################# -->
        <!--     <script type="text/javascript"> -->
        <!--             document.write('<div class="backToTop"><a href="#" onclick="window.scrollTo(0,0);return false;" title="Back to the top of the page">&nbsp;</a></div>'); -->
        <!--    </script> -->
       
        <?php if($this->data['sitenotice']) { ?><div id="siteNotice"><?php $this->html('sitenotice') ?></div><?php } ?>
        <h1 class="firstHeading"><?php $this->data['displaytitle']!=""?$this->html('title'):$this->text('title') ?></h1>
        <div id= "bodyContent" class="gumax-bodyContent">
            <h3 id="siteSub"><?php $this->msg('tagline') ?></h3>
            <div id="contentSub"><?php $this->html('subtitle') ?></div>
            <?php if($this->data['undelete']) { ?><div id="contentSub2"><?php     $this->html('undelete') ?></div><?php } ?>
            <?php if($this->data['newtalk'] ) { ?><div class="usermessage"><?php $this->html('newtalk')  ?></div><?php } ?>
            <?php if($this->data['showjumplinks']) { ?><div id="jump-to-nav"><?php $this->msg('jumpto') ?> <a href="#column-one"><?php $this->msg('jumptonavigation') ?></a>, <a href="#searchInput"><?php $this->msg('jumptosearch') ?></a></div><?php } ?>
            <!-- start content -->
            <?php $this->html('bodytext') ?>
            <?php if($this->data['catlinks']) { ?><div id="catlinks"><?php $this->html('catlinks') ?></div><?php } ?>
            <!-- end content -->

             <!-- show back to top link only if the body is longer than the window height -->
            <script type="text/javascript">
                var winheight = parseInt(document.documentElement.clientHeight)
                var boheight = parseInt(document.body.scrollHeight)
                if(winheight <= boheight) {
                    document.write('<div class="backToTop"><a href="#" onclick="window.scrollTo(0,0);return false;" title="Back to the top of the page">&nbsp;</a></div>');
                }
            </script>
           

            <div class="visualClear"></div>
        </div>
    </div> <!-- end of gumax-content DIV -->
    <!-- end of Main Content -->

    </div> <!-- end of gumax-page DIV -->
    <!-- =================== end of gumax-page =================== -->

    <!-- =================== gumax-page-actions =================== -->
    <!-- gumax-page-actions -->
    <div id="gumax-page-actions">
        <div id="gumax-content-actions">
        <ul>
            <?php $lastkey = end(array_keys($this->data['content_actions'])) ?>
            <?php foreach($this->data['content_actions'] as $key => $action) {
               ?><li id="ca-<?php echo Sanitizer::escapeId($key) ?>"
               <?php if($action['class']) { ?>class="<?php echo htmlspecialchars($action['class']) ?>"<?php } ?>
               ><a href="<?php echo htmlspecialchars($action['href']) ?>"><?php
               echo htmlspecialchars($action['text']) ?></a>
               <?php if($key != $lastkey) echo "|" ?></li>
               <?php } ?>
        </ul>
        </div>
    </div> <!-- end of gumax-page-actions DIV -->
    <!-- =================== end of gumax-page-actions =================== -->

    <!-- =================== gumax-page-footer =================== -->
    <div id="gumax-page-footer">

        <!-- personal tools  -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <!-- What Links Here  |  Related Changes  |  Upload File  |  Special Pages   |  Permanent Link   -->
        <div id="gumax-personal-tools">
            <ul>
              <?php if($this->data['notspecialpage']) { foreach( array( 'whatlinkshere', 'recentchangeslinked' ) as $special ) { ?>
              <li id="t-<?php echo $special?>"><a href="<?php
                echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
                ?>"><?php echo $this->msg($special) ?></a> | </li>
              <?php } } ?>
              <?php if($this->data['feeds']) { ?><li id="feedlinks"><?php foreach($this->data['feeds'] as $key => $feed) {
                ?><span id="feed-<?php echo Sanitizer::escapeId($key) ?>"><a href="<?php
                echo htmlspecialchars($feed['href']) ?>"><?php echo htmlspecialchars($feed['text'])?></a>&nbsp;</span>
                <?php } ?> | </li><?php } ?>
              <?php foreach( array('contributions', 'blockip', 'emailuser', 'upload', 'specialpages') as $special ) { ?>
              <?php if($this->data['nav_urls'][$special]) {?><li id="t-<?php echo $special ?>"><a href="<?php
                echo htmlspecialchars($this->data['nav_urls'][$special]['href'])
                ?>"><?php $this->msg($special) ?></a>
                <?php if($special != 'specialpages') echo "|" ?></li>
                <?php } ?>
              <?php }

                if(!empty($this->data['nav_urls']['permalink']['href'])) { ?>
                        <li id="t-permalink"> | <a href="<?php echo htmlspecialchars($this->data['nav_urls']['permalink']['href'])
                        ?>"><?php $this->msg('permalink') ?></a> | </li><?php
                } elseif ($this->data['nav_urls']['permalink']['href'] === '') { ?>
                        <li id="t-ispermalink"> | <?php $this->msg('permalink') ?></li><?php
                }

                wfRunHooks( 'MonoBookTemplateToolboxEnd', array( &$this ) ); ?>
<!-- Enter new links here to be seen on the same line as What links here, Related changes etc. -->
<li><a href="/mediawiki/index.php/Special:Categories">Categories</a> | </li>
<li><a href="/mediawiki/index.php/Category:Templates">Templates</a> | </li>
<li><a href="/mediawiki/index.php/Special:Allpages">All Pages</a></li>
            </ul>
           
        </div> <!-- end of personal-tools DIV -->
        <!-- end of personal tools  -->

        <!-- gumax-footer -->
        <div id="gumax-footer">
            <div id="gumax-f-message">
                <?php if($this->data['lastmod'   ]) { ?><span id="f-lastmod"><?php    $this->html('lastmod')    ?></span><?php } ?>
                <?php if($this->data['viewcount' ]) { ?><span id="f-viewcount"><?php  $this->html('viewcount')  ?> </span><?php } ?>
            </div>
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
            <!-- About Sime's Wiki |  Change Log  |  Site Extensions |  MediaWiki HOWTOs   |  etc etc   -->
           
            <ul id="gumax-f-list">
                <?php if($this->data['about'     ]) { ?><li id="f-about"><?php      $this->html('about')      ?> | </li><?php } ?>
                <li><a href="/mediawiki/index.php/Change_Log">Change Log</a> | </li>
                <li><a href="/mediawiki/index.php/Site_Extensions">Site Extensions</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_HOWTOs">MediaWiki HOWTOs</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_Links">MediaWiki Links</a> | </li>
                <li><a href="/mediawiki/index.php/MediaWiki_Maintenance">Maintenance</a> | </li>
                <?php if($this->data['disclaimer']) { ?><li id="f-disclaimer"><?php $this->html('disclaimer') ?> | </li><?php } ?>              
                <li><a href="http://mediawiki.org">Powered by MediaWiki</a> | </li>
                <li><a href="http://paulgu.com">Design by Paul Gu</a></li>
            </ul>
        </div> <!-- end of gumax-footer DIV -->
        <!-- end of gumax-footer -->

        <?php $this->html('bottomscripts'); /* JS call to runBodyOnloadHook */ ?>

    </div> <!-- end of gumax-page-footer DIV -->
    <!-- =================== end of gumax-page-footer =================== -->

    <?php $this->html('reporttime') ?>

</body></html>
<?php
      wfRestoreWarnings();
      } // end of execute() method
} // end of class
?>

========================================================================= refreshing.php (TESTING)

<?php
// connect to the DB and get the styepath and stylename hrefs and messages

$sitelogo = $this->data['stylepath'] . '/' . $this->data['stylename'] . '/images/header/' . /* CHANGE_LOGO_IMAGE_HERE__BEGIN */ 'roadofnoreturn2.jpg' /* CHANGE_LOGO_IMAGE_HERE__END */; ?>
<html>
<head>
<meta http-equiv="refresh" content"30" />
</head>
<body>
    <a style="background-image: url(<?php echo $sitelogo ?>);"
        href="<?php echo htmlspecialchars($this->data['nav_urls']['mainpage']['href'])?>"
        title="<?php $this->msg('mainpage') ?>"></a>
</body>
</html>

?>
============================================================================ poll_images.pl (TESTING)

#!/usr/bin/perl -w
use strict;
use warnings;
use Data::Dumper;


sub PollImages      {
my $ImageDir = '/var/www/html/mediawiki/skins/gumax/images/header';
my $PHPFile = '/var/www/html/mediawiki/skins/refreshing.php';
my @Files=glob("$ImageDir/*");
@Files = grep(!/thumbs.db/i, @Files);
my $logo=$Files[int(rand(scalar @Files))];
$logo =~ s/^.*[\/\\]//;

open(IN,"<$PHPFile") or die "Could not open file: $!\n";
local $/;
my $php = <IN>;
close(IN);
$php =~ s|(/\* CHANGE_LOGO_IMAGE_HERE__BEGIN \*/ ).*?( /\* CHANGE_LOGO_IMAGE_HERE__END \*/)|$1'$logo'$2|;

open(OUT,">$PHPFile") or die "Could not open file for write: $!\n";
print OUT $php;
close(OUT);
}

PollImages();

===========================================================================

0
 
LVL 1

Author Comment

by:Simon336697
ID: 19977973
mp!

I noticed another thing with the TESTING version.

When i go to my main page:

http://localhost/mediawiki/index.php

In the status bar I have:

http://localhost/mediawiki/index.php/skins/skins/skins/skins/skins/skins/skins/refreshing.php

And every refresh, it seems to add another /skins folder...
0
 
LVL 1

Author Comment

by:Simon336697
ID: 19978228
mp!

Im going to read up on ajax...I think this might be a better option, because it looks like mediawiki has very little support (if any that i can see) for iframes.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19981531
I cannot comment on the skin/skin/skin

I cannot guess wht is happening with the refresh. Perhaps if you refresh with a full url it will not do that ...
0
 
LVL 1

Author Comment

by:Simon336697
ID: 19988292
mp!
Points are yours.
Thanks so much for your great help.
Will allocate points here as its overdue :>)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 19989441
Great. Glad you fixed it
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month18 days, 2 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question