wxcanada.php RESOLVED

Hi All,

I have an unusual problem with my wxcanada.php page. Nothing shows on the page except the heading and menu. I have updated ec-radar and ec-forecast and even setup a new page. It must be something stupid but I’ll be barn if I can figure it out. :oops:

Any help would be appreciated.

Thanks,

John


code.txt (2.82 KB)

Your missing the ajax-dahsboard.php In your coding. Your dashboard works fine here…

http://www.johnsnhweather.com/ajax-dashboard.php

try adding this to your main index file that you posted

<?php include_once("ajax-dashboard.php"); ?>

Hi Mark.

The dashboard is working on the index page. The problem is on my wxcanada page. The Canadian radar and forecast are not showing up.

Thanks,

John

You have some testtags errors. Take a look here for that page. May not be the fix, But i’d take a look at that those.

http://www.johnsnhweather.com/wxcanada.php?sce=view

Hi Mark,

I’m not sure about those errors, I’m not a real techie, they seem to be on every page? The wxcanada page is the only one not working.

Thanks,

John

the top part of your testtags.php file has this…



if ( isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
//--self downloader --
   $filenameReal = __FILE__;
   $download_size = filesize($filenameReal);
   header('Pragma: public');
   header('Cache-Control: private');
   header('Cache-Control: no-cache, must-revalidate');
   header("Content-type: text/plain");
   header("Accept-Ranges: bytes");
   header("Content-Length: $download_size");
   header('Connection: close');
   
   readfile($filenameReal);
   exit;
}



Mine looks like this…




if ( $_REQUEST['sce'] == 'view' ) {
//--self downloader --
   $filenameReal = $_SERVER["PATH_TRANSLATED"];
   $filenameLcl = substr($PHP_SELF,1);
   $download_size = filesize($filenameReal);
   header('Pragma: public');
   header('Cache-Control: private');
   header('Cache-Control: no-cache, must-revalidate');
   if ($mode == 'download' ) {
     header("Content-type: application/x-download");
     header("Content-Disposition: attachment; filename=$filenameLcl;");
   } else {
     header("Content-type: text/plain");
   }
   header("Accept-Ranges: bytes");
   header("Content-Length: $download_size");
   header('Connection: close');
   
   readfile($filenameReal);
   exit;
}



Not sure If you try and change yours, that It may fix those errors your getting. Thats also the area your errors are coming from

Hi Mark,

Most unusual — I made the changes you suggested and I still get the errors. 8O

I’m really confused, I don’t understand how the wxcanada page would just stop working. 8O

Thanks,

John

Mark,
Your self-downloader script is an earlier version that may not work on all PHP installations … the current one is what he had

if ( isset($_REQUEST['sce']) && strtolower($_REQUEST['sce']) == 'view' ) {
//--self downloader --
   $filenameReal = __FILE__;
   $download_size = filesize($filenameReal);
   header('Pragma: public');
   header('Cache-Control: private');
   header('Cache-Control: no-cache, must-revalidate');
   header("Content-type: text/plain");
   header("Accept-Ranges: bytes");
   header("Content-Length: $download_size");
   header('Connection: close');
   
   readfile($filenameReal);
   exit;
}

John, your wxcanda.php page probably has a PHP error in it somewhere after

<div id="main-copy">
<div class="column-dark">   

which are the last HTML bits rendered on the page. From your wxcanada.php page, copy all the stuff between

and the
and paste it into a

 ... 

in a new post on this thread … then we can spot what might be in error.

PHP is funny sometimes … it will just stop executing when it encounters a syntax error in an included file, but may not cough up an error message into the HTML page.

Best regards,
Ken

#-o oops. Thanks Ken.

No problem, Mark! There has been much evolution of the code over time as new issues were encountered with different PHP installations. The $_SERVER[‘PATH_TRANSLATED’] worked fine on *nix servers, and not on ISS servers (thanks M$).

The change to FILE accommodated all installations as it always returned the real file name to be used.
Also, the global $PHP_SELF isn’t automatically set in PHP5 installations, so more recent code has a

if (!isset($PHP_SELF)) { $PHP_SELF = $_SERVER['PHP_SELF']; }

in it to handle that.

Best regards,
Ken

Hi Ken,

I have included the code below,


<div id="main-copy">
<div class="column-dark">   
<?php 
$site = 'NAT';
$lang = 'fr';
if (isset($_REQUEST['site'])) { $site = $_REQUEST['site']; }
if (isset($_REQUEST['lang'])) { $lang = $_REQUEST['lang']; }
include("http://www.johnsnhweather.com/ec-radar.php?inc=Y&site=$site&lang=$lang&linkto=$PHP_SELF");
?>
<?php
$doIncludeWU = true;
include("ec-forecast.php"); ?> 
    <p> </p>
 </div><!-- end column-dark -->   
</div><!-- end main-copy -->
?>
<?php
############################################################################
include("footer.php");
############################################################################
# End of Page
############################################################################
?>

John

Hi Ken,

I made two changes but still no go.

New code below


<div id="main-copy">
<div class="column-dark">   
<?php 
$site = 'NAT';
$lang = 'fr';
if (isset($_REQUEST['site'])) { $site = $_REQUEST['site']; }
if (isset($_REQUEST['lang'])) { $lang = $_REQUEST['lang']; }
include("http://www.johnsnhweather.com/ec-radar.php?inc=Y&site=$site&lang=$lang&linkto=$PHP_SELF");
?>

<?php
$doIncludeWU = true;
include("ec-forecast.php"); ?> 
</div><!-- end column-dark -->   
</div><!-- end main-copy -->
<?php
############################################################################
include("footer.php");
############################################################################
# End of Page
############################################################################
?>

John

John,

I’d use a slightly different method to include the EC radar by using


			<?php // fetch fresh national radar image if needed
			  $_REQUEST['site'] = 'NAT';
			  $doPrint = false;
			  include_once("ec-radar.php");
			?>
			<img src="<?php echo $radarDir . 'radar-' . $_REQUEST['site'] . '-0.png'; ?>" 
			alt="Radar, courtesy of Environment Canada"
			title="Radar, courtesy of Environment Canada" /> 

then for the ec-forecast, use

         <?php 
		 $doInclude	   = true; // handle ec-forecast and WXSIM include also
		 $doPrint	   = true; //  ec-forecast.php setting
		 include_once('ec-forecast.php'); ?>

That should put the national radar image (static) and the current ec-forecast on the same page.

Best regards,
Ken

Thanks Ken,

That took care of the problem, all is good at johnsnhweather. :smiley:

John