Welcome to the Cumulus Support forum.

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

Cumulus MX V4 beta test release 4.0.0 (build 4018) - 28 March 2024

Legacy Cumulus 1 release v1.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

How technically difficult is PHP for a web site?

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

How technically difficult is PHP for a web site?

Post by RayProudfoot »

At some point I would like to learn PHP as it appears a powerful language. However, having seem a few snippets of code pasted on these pages the syntax does appear quite complex.

I come from a programming background - Cobol, bit of VB6 and lots of VBA in Access and Excel. Those to me seem more straight-forward than PHP but I can remember relational database design confusing me until the penny dropped.

Is PHP harder to learn than those? Is it on a par with C or C+? Those are pretty frightening languages! And is PHP any more difficult because of how it's used with weather sites?

Grateful for any guidance.
Cheers,
Ray, Cheshire.

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: How technically difficult is PHP for a web site?

Post by saratogaWX »

Hi Ray,

PHP has it's base in Perl which has it's base in C for a programming language construct. So it is not like Cobol, but has a fairly uniform syntax. Since PHP runs on a webserver (and processes any page with type of .php), it's code structure is reasonably simple:

1) inside a .php page, PHP code is marked with a <?php and ends with the next ?> enountered
2) the stuff inside a <?php ... ?> will be replaced by the webserver with a 'null' unless that PHP code does a 'print' or 'echo' statement to emit output into the page.
3) PHP has variable names beginning with a $ and followed by alpha-numeric (and underscore) characters, and case is important.
4) PHP has a powerful set of built-ins to allow you to match/slice/dice character string, perform arithmetic/logical operations, group code into functions/subroutines, include code from other files, manipulate files in the webserver's filesystem, etc.

If you learn by example, may I suggest the AJAX/PHP template set as a starting point -- it uses PHP to great advantage to produce a easily maintainable weather website and includes scripts to gather data from external sources for forecasts, metar-conditions, alerts, etc.

If you can 'read' C-type code, PHP will be very readable, but knowing C is not a prerequisite to using PHP.
If you learn best from books, I recommend the O'Reilly series on PHP such as Learning PHP 5 or Sitepoint's PHP & MySQL: Novice to Ninja


I hope this helps...

Best regards,
Ken
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: How technically difficult is PHP for a web site?

Post by RayProudfoot »

Hi Ken,

Thanks very much for that background. I'm not surprised it's sourced from C given some examples I've seen here. It is quite different to VB but will still include IF..ELSE I guess otherwise you can't make any decisions. :D

Variable names don't sound too scary. If it has equivalents to Left, Mid, Len etc. then I'm sure I can cope with those.

I think a good book is absolutely essential despite the excellent w3schools website. Sometimes you just need to read something and absorb it without the distraction of the web. So thanks for those recommends.

I will look at the AJAX/PHP template as a starting point. Actually, I have modified my PHP signature banner which I think you designed for us so thank you for that. I did take my time on that as it was quite unlike anything I have done before. Is that what you meant by the AJAX/PHP template?

My current (free) webhost only allows me a monthly bandwidth of 4Gb but I'm not complaining. I will at some point switch to a commercial provider with a higher allowance and PHP and MySQL capability.
Cheers,
Ray, Cheshire.

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: How technically difficult is PHP for a web site?

Post by saratogaWX »

Hi Ray,

By the AJAX/PHP template set I meant the ones from http://saratoga-weather.org/wxtemplates/index.php .. the templates do not require mySQL for operation, although some add-ons like WordPress Blog or the whos-online do need mySQL. Free webhosts generally don't offer mySQL, and may tend to add content to .php/.html pages (which can make image creation PHP scripts malfunction). Definitely a good idea to get paid Linux/Apache hosting to avoid issues with free hosters :)

Best regards,
Ken
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: How technically difficult is PHP for a web site?

Post by RayProudfoot »

Hi Ken,

Ah I see. What you're providing is the PHP equivalent of Steve's HTML documents. If I understand correctly I would need your template plus the Cumulus plugin for a functioning weather website.

So instead of uploading multiple HTML documents I upload a single PHP file which is processed (parsed?) and the viewer sees the results. Is that the jist of how it works?

My current webhost is run by David Jamieson who used to frequent these pages. Because my webpages are reasonably undemanding his free bandwidth is more than sufficient. I would move to a paid host for PHP and David was looking at this one when we last discussed my options. http://orchardhosting.com/shared-hosting They seem to cover all the points you mentioned.

Thanks for your help.
Cheers,
Ray, Cheshire.

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: How technically difficult is PHP for a web site?

Post by saratogaWX »

RayProudfoot wrote:Hi Ken,

Ah I see. What you're providing is the PHP equivalent of Steve's HTML documents. If I understand correctly I would need your template plus the Cumulus plugin for a functioning weather website.
Correct.
RayProudfoot wrote: So instead of uploading multiple HTML documents I upload a single PHP file which is processed (parsed?) and the viewer sees the results. Is that the jist of how it works?
Again correct.. The main PHP data file uploaded by Cumulus is the CUtags.php file. Also expected are the standard images (graphs) of data produced by Cumulus. The realtime.txt file is also used for AJAX updates to some of the data. You wouldn't need to upload the Cumulus HTML template files any more after cutover to the PHP version. In the meantime, the PHP version can exist alongside the current HTML version since there are no page-name collisions to worry about. The main page is wxindex.php for the PHP site, and when you cutover to using the PHP version, simply rename it to index.php and remove the existing index.html and the PHP site will be live :)
RayProudfoot wrote: My current webhost is run by David Jamieson who used to frequent these pages. Because my webpages are reasonably undemanding his free bandwidth is more than sufficient. I would move to a paid host for PHP and David was looking at this one when we last discussed my options. http://orchardhosting.com/shared-hosting They seem to cover all the points you mentioned.

Thanks for your help.
I couldn't find mention of PHP version (hopefully 5+) but otherwise, their hosting appears reasonably priced.

Best regards,
Ken
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: How technically difficult is PHP for a web site?

Post by RayProudfoot »

Hi Ken,

Thanks for confirmation and the additional info. Being able to run the two (HTML and PHP) in parallel will be useful before the switch-over.

Nearer the time I'll check the version of PHP they support. Hopefully it will be 5 or higher.
Cheers,
Ray, Cheshire.

Image
Karv
Posts: 40
Joined: Sun 16 Dec 2012 11:19 pm
Weather Station: WH-1080
Operating System: Windows XP / 7, Ubuntu, Centos
Location: South Gloucestershire

Re: How technically difficult is PHP for a web site?

Post by Karv »

Hi Ray, when I originally learned PHP a few years ago, the biggest single thing I found of use while learning, was textpad - a very nice text editor(and the best 15 quid I ever spent I think), also on the textpad site, you can also download a PHP syntax highlighter, this was worth its weight in gold as it made my newbie coding errors stand out like a sore thumb.

www.textpad.com

and php sntax http://textpad.com/add-ons/synn2t.html

Good luck, and if in doubt, Ask ;)

K
RayProudfoot
Posts: 3372
Joined: Wed 06 May 2009 6:29 pm
Weather Station: Davis VP2 with Daytime FARS
Operating System: Windows XP SP3
Location: Cheadle Hulme, Cheshire, England
Contact:

Re: How technically difficult is PHP for a web site?

Post by RayProudfoot »

Hi Karv,

Thanks for the recommends. I have DreamWeaver v4 which I appreciate is a heavyweight app but I've become used to it for a while now. It too highlights PHP syntax.

I probably should have used something simpler when I started tweaking my web pages but in my ignorance thought DW4 was the answer to all my dreams.

I will certainly cry for help when it becomes necessary, thanks. :)
Cheers,
Ray, Cheshire.

Image
User avatar
saratogaWX
Posts: 1170
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: How technically difficult is PHP for a web site?

Post by saratogaWX »

I'd started using Dreamweaver back in the Macromedia days (with V1.0) .. now after many upgrades, I'm using Adobe Dreamweaver CS6 -- I totally agree that a highlighting editor (and even one with a built-in syntax checker like Dreamweaver) can help avoid common errors in code structure. Even the free Notepad++ has a nice highlighter for PHP, HTML, CSS and JavaScript.
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: How technically difficult is PHP for a web site?

Post by water01 »

WeBuilder is great for working with HTML, PHP, Javascript, Ruby, VBasic, C# and many other types!!
David
Image
gemini06720
Posts: 1700
Joined: Mon 10 Aug 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: How technically difficult is PHP for a web site?

Post by gemini06720 »

water01 wrote:WeBuilder is great for working with HTML, PHP, Javascript, Ruby, VBasic, C# and many other types!!
Indeed (probably one of the best editor, at an affordable price) - and a project being worked on can easily be previewed with the built-in Internet Explorer or Google Chrome engine (without the need to call an external browser). ;)
water01
Posts: 3215
Joined: Sat 13 Aug 2011 9:33 am
Weather Station: Ecowitt HP2551
Operating System: Windows 10 64bit
Location: Burnham-on-Sea
Contact:

Re: How technically difficult is PHP for a web site?

Post by water01 »

I also forgot to say that if you give WeBuilder the path to your PHP exe, it will run PHP in preview (i.e. run the code locally) without the need for for a Web Server like Apache etc.
David
Image
Post Reply