Sandaysoft

Support forum for Cumulus weather station software
It is currently Wed Jun 19, 2013 1:22 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Web tags in PHP & other PHP items.
PostPosted: Wed Dec 28, 2011 9:45 am 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 326
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
I think I've just about got my head around assembling a web page but I would prefer to use PHP tags from the start.

Could some one post a link to a site that uses PHP tags so I (and probably others) can view the source to help me get my head around it?

Thanks,

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Last edited by duke on Mon Jan 02, 2012 11:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 9:51 am 
Offline
User avatar

Joined: Thu Dec 17, 2009 2:03 pm
Posts: 787
Location: Hurstpierpoint, West Sussex, UK
Weather Station: WH1081
Operating System: Windows XP & 7 Pro
I believe Paul uses php http://www.synewave.co.uk/gcsweather/ (I don't I'm afraid).

_________________
Neil
Hurstpierpoint Weather

Image


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 10:03 am 
Online
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1887
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Normally speaking you can't see the source of a php page ;)

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 10:08 am 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17827
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
Didn't someone produce an equivalent of the 'standard' pages, but using PHP? I can't find a sticky or a download link, or anything in the wiki. If something like that exists, I could try to make it more visible.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 12:39 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1698
Location: World...
Weather Station: No weather station
Operating System: No operating system
steve wrote:
Didn't someone produce an equivalent of the 'standard' pages, but using PHP?
I did... :oops:

That was a very very long time ago (in Internet time), more than a year ago... :)

Unfortunately, the pages are no longer online and cannot be put back online either - too many modifications/updates are required. :(

As indicated by beteljuice, the source code of a PHP page cannot be seen/viewed. Why? According to the PHP manual, "...the PHP code is executed on the server, generating HTML which is then sent to the client. The client receives the results of running the PHP script, but would not know what the underlying code was. The web server can even be configured to process all the HTML files with PHP, and then there's really no way that users can tell what the operator has up his/her sleeve..."

Duke, it might be time, in the absence of David, to start an online course... ;)


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 3:46 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 326
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
I've been looking at the courses @ W3S and I will get around to it but I feel I need to do quite a bit of reading first to give myself a better insight to start with.

I see what you mean about the PHP not being visible and now I've thought about it I was asking for the wrong example.

What I should have asked for was a cut and paste from a page using PHP webtags when being edited with notepad++ or similar.

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 4:05 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1698
Location: World...
Weather Station: No weather station
Operating System: No operating system
duke wrote:
What I should have asked for was a cut and paste from a page using PHP webtags when being edited with notepad++ or similar.
Well Duke, that is quite a different request... :mrgreen:

Duke, reading about PHP is a good thing, but the best thing is to put into practice the examples usually supplied with most tutorials. What you will need to do to be able to write and test PHP scripts directly on your computer will be to install a local (as on your computer) server. There are quite a few server software available on the Internet but only two that I have using on a regular basis: XAMPP for Windows (large download size but the package includes everything that is needed - ie: Apache Web Server, MySQL, PHP, Perl) and Aprelium Abyss Web Server (smaller download size but only the Apache Web Server is included - MySQL, PHP, Perl have to be downloaded separately).


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 4:15 pm 
Offline
Site Admin
User avatar

Joined: Mon Jun 02, 2008 6:49 pm
Posts: 17827
Location: Sanday, Orkney
Weather Station: Davis VP2
Operating System: Windows Home Server 2011
There's a basic 'using PHP web tags' guide that David wrote, here: http://wiki.sandaysoft.com/a/Php_webtags

It's just enough to show how they are used; combined with a more general PHP tutorial, it may be of use in producing Cumulus PHP pages.

_________________
Steve
Sanday Weather
----------------------------------------------------------------------------------------------------------------------------------
Like Cumulus and want to support it? Please donate! Image


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 4:16 pm 
Offline

Joined: Mon Mar 23, 2009 2:50 pm
Posts: 72
Location: Skegness
Weather Station: WH3080
Operating System: Win XP SP3
I tend to use http://www.wampserver.com/en/

_________________
Image
Image
Skegness PWS Data
Skegness Wunderground


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 4:39 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 326
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Quote:
There's a basic 'using PHP web tags' guide that David wrote, here: http://wiki.sandaysoft.com/a/Php_webtags


I have read that, but for clarification, am I correct in thinking you enter all the code (below) for each webtag, obviously changing the name of the tag?

Quote:
<?php
require_once("cumuluswebtags.php");
echo $time;
echo "<br/>";
Echo "The current forecast is " . $forecast;
?>

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 4:49 pm 
Offline
User avatar

Joined: Thu Jan 07, 2010 9:44 pm
Posts: 2595
Location: Wilmslow, Cheshire, UK
Weather Station: Davis VP2
Operating System: XP SP3, Win 7
Not all of it no.

this bit is required once at the top of the file
Code:
<?php
require_once("cumuluswebtags.php");


Then whenever you need to reference a tag you just use the variable name $xxxxx

for instance:
Code:
Echo "The current forecast is " . $forecast;

_________________
Mark
Wilmslow Astro Weather


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 6:23 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 326
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Quote:
this bit is required once at the top of the file

Code:

<?php
require_once("cumuluswebtags.php");


1/ Just once on each page the tags are referenced?

2/ Now I am changing my index.html to use PHP do I now save it as index.php?

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 10:31 pm 
Offline

Joined: Tue Aug 03, 2010 6:23 am
Posts: 484
Location: Ferntree Gully, VIC, Oz
Weather Station: WM918
Operating System: Win Server 2008 R2
One way is to develop the layout of the page you want and then start looking through the webtags to see what is available to provide the informaiton you want.

One site I have set up for a Cumulus user only requires Cumulus generating the cumuluswebtags file and nothing else. The remainder of the display pages are all PHP code which uses the #include functions to pull in the cumuluswebtags file so reference to tags such as $showthetemp, $lowestnighttemp etc etc (not real tags of course for the picky ones out there!) are all translated when the page is displayed. The benefit of doing this is that you don;t have to maintain Cum,ulus template files and then hope that all the relevant pages are transferred to your web site every time you upload (especially helpful if you want 1 minute uploading of the data).

The other benefit of doiong this is that you can use general files for things such as menu's, footers, heading and so on - so instead of having, say, 10 diferent pages and having to code the menu system in all 10, you have a single #include for the menu.php, footer,php, header.php (or whatever you want to call them) in each web page you display.

This is an example of the header.php I sometimes use:

Code:
<?php
require ("cumuluswebtags.php");
?>

<h1><?php $stationlocation ?></h1>
<h2 style="text-align: center; text-transform: none;" >
    &nbsp;Latitude&nbsp;<?php echo $latitude; ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $longitude; ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $altitude; ?>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://maps.google.com/maps/api/staticmap?center=<?php $stationlat ?>,<?php $stationlong ?>&markers=color:red|label:A|-37.870572,145.275324&maptype=hybrid&zoom=10&size=640x640&sensor=false">(Where is this?)</a><br /></h2>
<table width="60%" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
     <?php
        include "config/menu.php";
   ?>
  </tr>
</table>


Don't try to pick bones on this as I have changed some of the informaiton just to show how it can work. The first require pulls in the cumuluswebtags file; the latter include pulls in the standard menuing system. So, if this was, say, a basic current weather display, I would have the format of the display page all coded up (less menu's, header, footer) and then, where I need the header, simply use a include "config/header.php"; call and, because this also includes a call to the menu system, I don;t have to worry about it (because wherever I want a header, I also want a menu so the two go hand in hand all the time).

If this makes sense :)

If you want further help or better code examples/web site example, drop me a PM.

_________________
Punctuation is the difference between 'Let's eat, grandma' and 'Let's eat grandma'


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Wed Dec 28, 2011 11:50 pm 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1698
Location: World...
Weather Station: No weather station
Operating System: No operating system
serowe wrote:
If this makes sense :)
Indeed, Ray, it/that makes perfect sense... :mrgreen:

Duke, what I would suggest is that you start with a clean template, meaning with a page with nothing on it and then add the information you would like to display. One procedure Ray demonstrated was the use of multiple templates to create one final page.

For each of my web pages, I use five different templates: a global setting template (which contains values/variables used throughout the site), a top template with the WC3 information, a header template with what appears at the top of each pages and the menus, and the footer template with the copyright notices. Yes, that was just four templates ... the fifth template contains the data (code, tags) that will be appearing on that page.

Duke, I have attached a modified version of the default 'main' template I use to create the pages - just to give you an idea. This is just one of the five templates used.


Top
 Profile  
 
 Post subject: Re: Web tags in PHP
PostPosted: Thu Dec 29, 2011 8:27 am 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 326
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Thanks very much for the examples, seeing it written can save a lot of reading time. I got quite a bit to be going on with now.

Quote:
One site I have set up for a Cumulus user only requires Cumulus generating the cumuluswebtags file and nothing else.


I really like the idea of just SFTP one little file. Any chance you could provide a link to that site?

Duke

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 43 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group