CVS: phpweather-1.x demo.php,1.5,1.6
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-06-28 15:51:53
|
Update of /cvsroot/phpweather/phpweather-1.x In directory usw-pr-cvs1:/tmp/cvs-serv16551 Modified Files: demo.php Log Message: I've expanded some explanations and indented some HTML code. Index: demo.php =================================================================== RCS file: /cvsroot/phpweather/phpweather-1.x/demo.php,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- demo.php 17 May 2002 22:13:22 -0000 1.5 +++ demo.php 28 Jun 2002 15:51:48 -0000 1.6 @@ -37,7 +37,7 @@ <h1>Your version: <?php echo $version ?></h1> -<p>You can download new version from <a +<p>You can download new versions from <a href="http://sourceforge.net/projects/phpweather/">this page</a>. I'm currently working on the next version of <a href="http://www.sourceforge.net/projects/phpweather/">PHP @@ -251,20 +251,30 @@ <h1>Caching the METARs</h1> -<p>But you'll soon start to look for a way to improve the -response-time of your script. To do this, you first have to decide -what database you want to use. You have a number of options at this -time:</p> +<p>You'll soon start to look for a way to improve the response-time of +your script. The problem is, that it takes about a second to retrieve +a METAR report from the NWS. It would be a waste if your page had to +do this every time it's accessed.</p> + +<p>To decrease the time it takes for the script to access the METARs, +you can cache the retrieved METARs locally. You will have to decide +what database you want to use. You do this by copying the file +<code>config-dist.inc</code> to <code>config.inc</code> - the name is +important. Now change <code>config.inc</code> so suit your preferences +by changing <i>one</i> of the <code>$useXXX</code> variables to +<code>1</code>. You'll find more instructions in the comments in the +file.</p> + +<p>You have a number of different databases to choose from:</p> <dl> + + <dt><b>A MySQL database</b></dt> + <dd> + <p>Set <code>$useMySQL</code> to 1, and then create a table with + the following SQL statement:</p> -<dt><b>A MySQL database</b></dt> -<dd> - -<p>Set <code>$useMySQL</code> to 1, and then create a table with the -following SQL statement:</p> - -<pre> + <pre> CREATE TABLE metars ( metar VARCHAR(255) NOT NULL, timestamp TIMESTAMP(14), @@ -273,31 +283,32 @@ UNIQUE station (station) ); </pre> - -</dd> - -<dt><b>A PostgreSQL database</b></dt> - -<dd><p>Set <code>$usePSQL</code> to 1 and create a table with the -following SQL statement:</p> - -<pre> + + </dd> + + <dt><b>A PostgreSQL database</b></dt> + + <dd> + <p>Set <code>$usePSQL</code> to 1 and create a table with the + following SQL statement:</p> + + <pre> CREATE TABLE metars ( metar VARCHAR(255) NOT NULL, timestamp TIMESTAMP, station VARCHAR(4) PRIMARY KEY NOT NULL ); </pre> - -</dd> - -<dt><b>An Oracle 8 database</b></dt> - -<dd> -<p>Set <code>$useOCI</code> to 1 and create a table with this SQL -statement:</p> - -<pre> + + </dd> + + <dt><b>An Oracle 8 database</b></dt> + + <dd> + <p>Set <code>$useOCI</code> to 1 and create a table with this SQL + statement:</p> + + <pre> create table metars ( metar varchar2(255) not null, timestamp date, @@ -305,29 +316,25 @@ ); alter table metars add primary key (station); </pre> -</dd> - -<dt><b>A DBM database</b></dt> - -<dd> -<p>Set <code>$useDBM</code> to 1 and make make sure that the user -running the webserver has write-permission to the current -directory.</p> -</dd> - -<dt><b>An XML file</b></dt> - -<dd> -<p>Set <code>$useXML</code> to 1 and make sure that the webserver has - read/write permission to the file <code>cache.xml</code>.</p> -</dd> - + </dd> + + <dt><b>A DBM database</b></dt> + + <dd> + <p>Set <code>$useDBM</code> to 1 and make make sure that the user + running the webserver has write-permission to the current + directory.</p> + </dd> + + <dt><b>An XML file</b></dt> + + <dd> + <p>Set <code>$useXML</code> to 1 and make sure that the webserver + has read/write permission to the file <code>cache.xml</code>.</p> + </dd> + </dl> -<p>If you use a database that requires you to log on, then please -remember to do so. There's already some code at the top of -<code>phpweather.inc</code> that should serve as a guide.</p> - <p>If you don't connect to your database, you'll recieve a lot of errors, saying things like: "<code>MySQL Connection Failed: Access denied for user: 'nobody@localhost' (Using password: NO) in @@ -336,7 +343,9 @@ errors are trying to tell you, that PHP Weather couldn't store the METAR in the <a href="http://www.mysql.com">MySQL</a>-database, because you didn't supply a valid username and password. The errors -will be similar for other databases.</p> +will be similar for other databases. Go back to +<code>config.inc</code> and make sure that the code in that file does +establish a connection to the database.</p> <p>If you've configured <a href="http://www.sourceforge.net/projects/phpweather/">PHP Weather</a> |