Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

Web tags in PHP & other PHP items.

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

duke

Web tags in PHP & other PHP items.

Post by duke »

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
Last edited by duke on Mon 02 Jan 2012 11:06 am, edited 1 time in total.
User avatar
nking
Posts: 813
Joined: Thu 17 Dec 2009 2:03 pm
Weather Station: W-8681
Operating System: Windows 10
Location: Hurstpierpoint, West Sussex, UK
Contact:

Re: Web tags in PHP

Post by nking »

I believe Paul uses php http://www.synewave.co.uk/gcsweather/ (I don't I'm afraid).
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: Web tags in PHP

Post by beteljuice »

Normally speaking you can't see the source of a php page ;)
Image
......................Imagine, what you will KNOW tomorrow !
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Web tags in PHP

Post by steve »

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
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Web tags in PHP

Post by gemini06720 »

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... ;)
duke

Re: Web tags in PHP

Post by duke »

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
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Web tags in PHP

Post by gemini06720 »

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).
User avatar
steve
Cumulus Author
Posts: 26672
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Web tags in PHP

Post by steve »

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
scoobs
Posts: 82
Joined: Mon 23 Mar 2009 2:50 pm
Weather Station: WH3080
Operating System: Windows server
Location: Skegness

Re: Web tags in PHP

Post by scoobs »

Image
duke

Re: Web tags in PHP

Post by duke »

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?
<?php
require_once("cumuluswebtags.php");
echo $time;
echo "<br/>";
Echo "The current forecast is " . $forecast;
?>
User avatar
mcrossley
Posts: 14388
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Web tags in PHP

Post by mcrossley »

Not all of it no.

this bit is required once at the top of the file

Code: Select all

<?php 
require_once("cumuluswebtags.php");
Then whenever you need to reference a tag you just use the variable name $xxxxx

for instance:

Code: Select all

Echo "The current forecast is " . $forecast;
duke

Re: Web tags in PHP

Post by duke »

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
serowe
Posts: 484
Joined: Tue 03 Aug 2010 6:23 am
Weather Station: WM918
Operating System: Win Server 2008 R2
Location: Ferntree Gully, VIC, Oz
Contact:

Re: Web tags in PHP

Post by serowe »

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: Select all

<?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'
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Web tags in PHP

Post by gemini06720 »

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.
duke

Re: Web tags in PHP

Post by duke »

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.
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
Post Reply