Author Topic: Making Scripts Smaller  (Read 1615 times)

0 Members and 1 Guest are viewing this topic.

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Making Scripts Smaller
« on: January 21, 2013, 01:31:11 PM »
I know in html to make an image smaller, you use WIDTH="..."and the height the same, but how do you do this for php????
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #1 on: January 21, 2013, 02:37:27 PM »
Hi Joseph,

Look at this:http://saratoga-weather.org/resize-nexstorm-image.php?sce=view  It is used for resizing .jpgs.  Can be used for any .jpg

John
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #2 on: January 21, 2013, 02:43:15 PM »
Looks like this will work! Where do I insert it on my page?
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #3 on: January 21, 2013, 02:46:59 PM »
I would make the script its own .php file, then use an "include" on the page with the image.  Like this:

<?php include("yourimagefile.php") ; ?>

John
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #4 on: January 21, 2013, 02:52:54 PM »
What if I were trying to do this on an already existing page? I am wanting to put Ken's Advforecast2 script on there, which I have ready to go, it's already on there, it's just too big with the template that I am using.

Here's what I am referring to:

www.fitzweather.com/index.php
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #5 on: January 21, 2013, 03:02:14 PM »
In that case, you don't need the resize script.  Looks like the size of the space you are wanting to use is about 550px wide or so, I believe.  Check me on that, please.  Let me see what I can do on this.  Back in a few.

John
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #6 on: January 21, 2013, 03:15:10 PM »
If you could just cut the forecast to the cutoff on the page at Wednesday, that would be fine too, I just don't know how to do this. I ordered a PHP and CSS book in the mail the other day, but haven't received it yet.
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #7 on: January 21, 2013, 03:26:29 PM »
I'll try, Joseph. Ken is on here and will probably beat me to a solution.  I 'think' this will work.  Copy and paste what is below.

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
?>

 <?php
  if ($useEXTf) {  //  Show Short Term Extended Forecast Data
?>
<table class="center" style="width:500px; text-align:center; vertical-align:middle;">
       <tr>
         <td style="text-align: left" class="datahead">&nbsp;<? print $fcstorg; ?> 4 Day Weather Forecast</td>
       </tr>
       </table>
        <table class="center" style="width:500px; text-align:center; vertical-align:middle; border: 1px solid #FFF;">
              <tr>
               <td>
                      <div style="text-align:center; vertical-align:middle;"><?php echo $forecasticons[0]; ?><br/>
                        <?php echo $forecasttemp[0]; ?>
                 </div></td>
               <td>
                      <div style="text-align:center; vertical-align:middle;"><?php echo $forecasticons[1]; ?><br/>
                        <?php echo $forecasttemp[1]; ?>
                 </div></td>
             <td>
                      <div style="text-align:center; vertical-align:middle;"><?php echo $forecasticons[2]; ?><br/>
                        <?php echo $forecasttemp[2]; ?>
                 </div></td>
               <td>
                      <div style="text-align:center; vertical-align:middle;"><?php echo $forecasticons[3]; ?><br/>
                        <?php echo $forecasttemp[3]; ?>
                 </div></td>
             </tr>
       </table>
<?php } // end $useEXTf  ---------------------------------------- ?>


John

GR2AE, GR3, Cumulus

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #8 on: January 21, 2013, 03:45:45 PM »
Not quite there, but working it.  At the top of what I sent you change the following from:

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
?>

to:

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
$fcstby = isset($_REQUEST['fcstby'])?strtoupper($_REQUEST['fcstby']):'';
if ($fcstby == 'NWS') {
$SITE['fcstscript']      = 'advforecast2.php';  // USA-only NWS Forecast script
$SITE['fcstorg']      = 'NWS';    // set to 'NWS' for NOAA NWS
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
?>

Also, you can remove the include for the image resize script.
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #9 on: January 21, 2013, 03:56:14 PM »
The layout looks like it is going to be perfect, but the information is not displaying :?:
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #10 on: January 21, 2013, 04:00:44 PM »
We'll get this eventually.

Change this:

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
$fcstby = isset($_REQUEST['fcstby'])?strtoupper($_REQUEST['fcstby']):'';
if ($fcstby == 'NWS') {
$SITE['fcstscript']      = 'advforecast2.php';  // USA-only NWS Forecast script
$SITE['fcstorg']      = 'NWS';    // set to 'NWS' for NOAA NWS
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
?>

to:

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
$fcstby = isset($_REQUEST['fcstby'])?strtoupper($_REQUEST['fcstby']):'';
if ($fcstby == 'NWS') {
$SITE['fcstscript']      = 'advforecast2.php';  // USA-only NWS Forecast script
$SITE['fcstorg']      = 'NWS';    // set to 'NWS' for NOAA NWS
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
print "<!-- fcstby='$fcstby' fcstscript='" . $SITE['fcstscript'] . "' fcstorg='". $SITE['fcstorg'] . "' -->\n";
  include_once($WXtags);   // for the bulk of our data
  $doPrintNWS = false; // suppress printing of forecast by advforecast2.php
  $doPrint    = false; // suppress printing of ec-forecast.php
  $doPrintWU  = false; // suppress printing of WU-forecast.php
  include_once($fcstscript); // for the forecast icon stuff
?>

Try that, and see what happens, please.
GR2AE, GR3, Cumulus

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #11 on: January 21, 2013, 04:02:36 PM »
Also,

You can change this to what you need in red:

<td style="text-align: left" class="datahead">&nbsp;<? print $fcstorg; ?> 4 Day Weather Forecast</td>
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #12 on: January 21, 2013, 04:17:14 PM »
It's looking great now! The only thing wrong is that it says I have done something wrong on line 63, but I don't see anything (?)
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #13 on: January 21, 2013, 04:21:18 PM »
It's a server issue.  Change the following in red from:  include to require

<?php
$fcstscript = 'advforecast2.php';
$useEXTf   = true;
$fcstby = isset($_REQUEST['fcstby'])?strtoupper($_REQUEST['fcstby']):'';
if ($fcstby == 'NWS') {
$SITE['fcstscript']      = 'advforecast2.php';  // USA-only NWS Forecast script
$SITE['fcstorg']      = 'NWS';    // set to 'NWS' for NOAA NWS
$fcstorg = $fcstby;
$fcstscript = $SITE['fcstscript'];
}
print "<!-- fcstby='$fcstby' fcstscript='" . $SITE['fcstscript'] . "' fcstorg='". $SITE['fcstorg'] . "' -->\n";
  include_once($WXtags);   // for the bulk of our data
  $doPrintNWS = false; // suppress printing of forecast by advforecast2.php
  $doPrint    = false; // suppress printing of ec-forecast.php
  $doPrintWU  = false; // suppress printing of WU-forecast.php
  include_once($fcstscript); // for the forecast icon stuff  change from include to require
?>

GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #14 on: January 21, 2013, 04:58:07 PM »
Hmm..Now I have this error showing up:

Warning: include_once(): Filename cannot be empty in /hsphere/local/home/c347285/fitzweather.com/index.php on line 62 Warning: include_once(): Failed opening '' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php5ext/php/') in /hsphere/local/home/c347285/fitzweather.com/index.php on line 62
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com

Offline Maumelle Weather

  • Forecaster
  • *****
  • Posts: 1827
    • Maumelle Weather
Re: Making Scripts Smaller
« Reply #15 on: January 21, 2013, 05:02:11 PM »
Hmmm.... Could you .zip me your index.php and email it to me, please?  I'll look at it.  I wonder if it is because the atom-top-warning.php is no longer there.
GR2AE, GR3, Cumulus

Offline Farmtalk

  • Fitzweather
  • Forecaster
  • *****
  • Posts: 4745
    • WV Waterfalls
Re: Making Scripts Smaller
« Reply #16 on: January 21, 2013, 05:10:03 PM »
Sure thing, one minute..

Sent it to your yahoo.
Joe Fitzwater
Chief Meteorologist for WVNS-TV 59 in Beckley, WV

Work Page on Facebook -> www.facebook.com/meteojoe
Work Page on Twitter -> https://twitter.com/meteojoe
Waterfalls -> www.wvfalls.com