We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10529
    • 73 Posts
    Hi I have a page that calls in a number of images and then an IFrame calling in a large text file.

    http://www.anotherharddayattheoffice.co.uk/weatherarchive.html

    <h2>Another Hard Day at the Office Weather Stats</h2>
      <table width="960" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="400" height="200" valign="middle" align="center"><img src="/weather/WindSpeedHistory.gif" width="320" height="200"></td>
          <td width="400" valign="middle" align="center"><img src="/weather/HiWindSpeedHistory.gif" width="320" height="200"></td>
          <td width="400" valign="middle" align="center"><img src="/weather/WindDirectionHistory.gif" width="320" height="200"></td>
        </tr>
        <tr align="center" valign="middle"> 
          <td colspan="3" height="19"> </td>
        </tr>
        <tr> 
          <td height="200" valign="middle" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/WindChillHistory.gif" width="320" height="200"></td>
          <td valign="top" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/BarometerHistory.gif" width="320" height="200"></td>
          <td valign="top" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/OutsideTempHistory.gif"></td>
        </tr>
        <tr> 
          <td height="19" colspan="3" valign="top"> </td>
        </tr>
        <tr> 
          <td height="19" colspan="3" valign="top"> </td>
        </tr>
        <tr> 
          <td valign="top" height="71" > 
            <p>High monthly outside Temperature, 
              <!--hiMonthlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              Low monthly outside Temperature, 
              <!--lowMonthlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              High yearly outside Temperature, 
              <!--hiYearlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              Low yearly outside Temperature, 
              <!--lowYearlyOutsideTemp-->
              , 
              <!--tempUnit-->
            </p>
          </td>
          <td valign="top" >
    	<p>Low monthly barometer, 
            <!--lowMonthlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            High monthly barometer, 
            <!--hiMonthlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            Low yearly barometer, 
            <!--lowYearlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            High yearly barometer 
            <!--hiYearlyBarometer-->
            , 
            <!--barUnit-->
    </p>
          </td>
          <td valign="top" > 
            <p>High wind speed, 
              <!--hiWindSpeed-->
              , 
              <!--windUnit-->
              <br>
              Time of High wind speed, 
              <!--hiWindSpeedTime-->
              , 
              <!--windUnit-->
              <br>
              High monthly wind speed, 
              <!--hiMonthlyWindSpeed-->
              , 
              <!--windUnit-->
              <br>
              High yearly wind speed, 
              <!--hiYearlyWindSpeed-->
              , 
              <!--windUnit-->
            </p>
          </td>
        </tr>
      </table>
    </div>
    <div align="center"><iframe name="archive" width=1500 height=20000 src="http://www.anotherharddayattheoffice.co.uk/weather/downld02.txt"  frameborder=0></iframe>
    <a href="#" onclick="refreshIframe('archive'); return false">click</a> 
    </div>



    The text file http://www.anotherharddayattheoffice.co.uk/weather/downld02.txt as you can see appears ok - only issue is that it will not refresh even though I have tried some code.

    I have also tried bringing the same txt file in using a snippet

    <?php
    include("weather/downld02.txt");
    ?>


    #archive {
         background-color: #ECECEC;
         font-size: 11px;
         width:2000px;
         min-height: 20000px;
         padding: 01px 01px 01px 01px;
    }
    
    P {font-family:Arial, Tahoma, Verdana;
    	font-size:12px;
    	margin:0 auto;
    	padding:0;
    	color:#656253;
    	line-height:20px;
    }
    
    H2 {  font-family: Arial, Tahoma, Verdana; font-size: 14px; color: #330066; background-color: #FFFFFF}
    </style>
    <script type="text/javascript">
    function refreshIframe(el) {
    var f = document.getElementById(el)
    var rsrc = f.src
    f.src="about:blank"
    f.src=rsrc
    }
    </script>
    </head>
    <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <div align="center">
    <h2>Another Hard Day at the Office Weather Stats</h2>
      <table width="960" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="400" height="200" valign="middle" align="center"><img src="/weather/WindSpeedHistory.gif" width="320" height="200"></td>
          <td width="400" valign="middle" align="center"><img src="/weather/HiWindSpeedHistory.gif" width="320" height="200"></td>
          <td width="400" valign="middle" align="center"><img src="/weather/WindDirectionHistory.gif" width="320" height="200"></td>
        </tr>
        <tr align="center" valign="middle"> 
          <td colspan="3" height="19"> </td>
        </tr>
        <tr> 
          <td height="200" valign="middle" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/WindChillHistory.gif" width="320" height="200"></td>
          <td valign="top" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/BarometerHistory.gif" width="320" height="200"></td>
          <td valign="top" align="center"><img src="http://www.anotherharddayattheoffice.co.uk/weather/OutsideTempHistory.gif"></td>
        </tr>
        <tr> 
          <td height="19" colspan="3" valign="top"> </td>
        </tr>
        <tr> 
          <td height="19" colspan="3" valign="top"> </td>
        </tr>
        <tr> 
          <td valign="top" height="71" > 
            <p>High monthly outside Temperature, 
              <!--hiMonthlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              Low monthly outside Temperature, 
              <!--lowMonthlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              High yearly outside Temperature, 
              <!--hiYearlyOutsideTemp-->
              , 
              <!--tempUnit-->
              <br>
              Low yearly outside Temperature, 
              <!--lowYearlyOutsideTemp-->
              , 
              <!--tempUnit-->
            </p>
          </td>
          <td valign="top" >
    	<p>Low monthly barometer, 
            <!--lowMonthlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            High monthly barometer, 
            <!--hiMonthlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            Low yearly barometer, 
            <!--lowYearlyBarometer-->
            , 
            <!--barUnit-->
            <br>
            High yearly barometer 
            <!--hiYearlyBarometer-->
            , 
            <!--barUnit-->
    </p>
          </td>
          <td valign="top" > 
            <p>High wind speed, 
              <!--hiWindSpeed-->
              , 
              <!--windUnit-->
              <br>
              Time of High wind speed, 
              <!--hiWindSpeedTime-->
              , 
              <!--windUnit-->
              <br>
              High monthly wind speed, 
              <!--hiMonthlyWindSpeed-->
              , 
              <!--windUnit-->
              <br>
              High yearly wind speed, 
              <!--hiYearlyWindSpeed-->
              , 
              <!--windUnit-->
            </p>
          </td>
        </tr>
      </table>
    <div id="archive">
            [!archive!]
    </div>
    


    But I loose all the formatting
    http://www.anotherharddayattheoffice.co.uk/index.php?id=127

    What is the best way to bring this in to a page please, so that it refreshes and has a degree of formatting!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I would probably just use an uncached snippet with a PHP readfile() function, and load it into <pre>...</pre> tags.

      Tested the idea with your .txt file and it comes out pretty nice. Just uncached snippet tags inside <pre>...</pre> tags, and this snippet code:
      return readfile('assets/files/test.txt');
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 10529
        • 73 Posts
        Thanks a lot that’s done the trick - have a very embarrassing admission to make here - never knew about pre tags !!!! :’(

        All seems to be working http://www.anotherharddayattheoffice.co.uk/weatherarchive.html

        Also put the .htm file in using similar code

        [!archivepage!] 
        <div id="archive">
              <pre>  [!archive!] </pre>
        </div>