If you use Cumulus, please donate Image

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

Vote for the next article - PHP or Javascript

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

Moderators: daj, TNETWeather

Next website development article?

Poll ended at Sat Jun 25, 2011 10:57 am

PHP
11
52%
Javascript
10
48%
 
Total votes: 21

User avatar
daj
Posts: 2041
Joined: Tue Jul 29, 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Vote for the next article - PHP or Javascript

Postby daj » Wed Jun 15, 2011 10:57 am

Folks,

Following on from my articles introducing Stylesheets and Web page layout.....

http://wiki.sandaysoft.com/a/Stylesheets
http://wiki.sandaysoft.com/a/Webpage_layout

I'm trying to decide on my next topic -- Javascript or PHP. Both are equally useful to the modern website developer!

Please take a moment to vote -- I will let it run for a week or so and then do which ever one is most popular.
David
kippfordweather.uk
Cumulus MX & Raspberry Pi

User avatar
mcrossley
Posts: 4968
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Vote for the next article - PHP or Javascript

Postby mcrossley » Wed Jun 15, 2011 11:04 am

David, how about adding JQuery and JSON to your ToDo list?

User avatar
daj
Posts: 2041
Joined: Tue Jul 29, 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Vote for the next article - PHP or Javascript

Postby daj » Wed Jun 15, 2011 11:08 am

TBH, the Javascript would include jQuery as it makes things much simpler than 'raw' Javascript. I could certainly write something on JSON too but not in an intro article, but maybe on its own.

I think each of these two topics (PHP and JS) spawn a few sub-topics like MySQL, JSON, AJAX techniques. I could be busy :lol:
David
kippfordweather.uk
Cumulus MX & Raspberry Pi

User avatar
mcrossley
Posts: 4968
Joined: Thu Jan 07, 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Jessie Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Vote for the next article - PHP or Javascript

Postby mcrossley » Wed Jun 15, 2011 11:17 am

Its funny but the other day I wondered how JQuery performed against raw JavaScript, after Googling for a while it seems it is about 500-600 times slower processing 'large' pages. So the convenience comes at a cost - as ever. Now I really must learn JQuery... :lol:

Graham64
Posts: 74
Joined: Mon Aug 23, 2010 5:04 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows XP
Location: Cornwall, England
Contact:

Re: Vote for the next article - PHP or Javascript

Postby Graham64 » Wed Jun 15, 2011 10:17 pm

David
I, for one, would find it very helpful if you could add to the excellent articles that you have already written for the Wiki. I have voted for PHP, however what about a brief general article on the what/why/whens of PHP and Javascript?

From reading many of the messages on the forum I can just about understand the programs listed and it seems as though they both can do similar things but I can't find out which is best to use for which purpose.

For example:
    PHP has the advantage that it is all on the server side - so what?
    Javascript has the ability to do timings, does PHP?

Sorry if these are all very basic questions but I would like to know when to use PHP, when to use Javascript and what are the advantages/disadvantages of both.

These questions could also be applied, it seems, to other choices, for example the different graphing methods that have been quoted on the message board.

Thanks for all your work on the Wiki - very useful.

Graham

bnwrx
Posts: 448
Joined: Wed Feb 25, 2009 12:01 am
Weather Station: Ambient WS2095 (Fine/Offset)
Operating System: Windows 10 64bit
Location: Woodland Park, Colorado USA
Contact:

Re: Vote for the next article - PHP or Javascript

Postby bnwrx » Wed Jun 15, 2011 11:12 pm

Graham64 wrote:David
I, for one, would find it very helpful if you could add to the excellent articles that you have already written for the Wiki. I have voted for PHP, however what about a brief general article on the what/why/whens of PHP and Javascript?

From reading many of the messages on the forum I can just about understand the programs listed and it seems as though they both can do similar things but I can't find out which is best to use for which purpose.

For example:
    PHP has the advantage that it is all on the server side - so what?
    Javascript has the ability to do timings, does PHP?

Sorry if these are all very basic questions but I would like to know when to use PHP, when to use Javascript and what are the advantages/disadvantages of both.

These questions could also be applied, it seems, to other choices, for example the different graphing methods that have been quoted on the message board.

Thanks for all your work on the Wiki - very useful.

Graham


I second Graham64 ideas. David is so knowledgable on these subjects. I am still trying to understand so much :o
I now have a paid webhost that offers MySql data bases, but I have no idea how to send data to them.... :oops: !!

User avatar
daj
Posts: 2041
Joined: Tue Jul 29, 2008 8:00 pm
Weather Station: WH1081
Operating System: Pi & MX
Location: SW Scotland
Contact:

Re: Vote for the next article - PHP or Javascript

Postby daj » Thu Jun 16, 2011 9:18 am

Ok, here are some basics on the different technologies. Broadly speaking (before anyone starts chipping in with the , "Ah, but..." comments) !!


HTML
All web pages are written using the HTML language -- this describes the content of the page and how a page is laid out. HTML is sent from a web server and the browser then displays it.

CSS (Stylesheet)
This is used in conjunction with HTML to style your page (colour, position, etc). Again this is sent from the webserver and the browser uses it to display the page

Javascript
This is a language used by your browser to manipulate the page being displayed on screen. It is always executed on the browser (so all the work is done on the users machine -- pc/mac/phone, etc). JavaScript is supported by all modern browsers, incudling some mobile phones (iPhone, Andriod, etc). The user does have the option to turn off Javascript (some consider it a security risk) however by default it is turned on and most modern sites rely heavily on Javascript. IE has one of the worst iplementations of Javascript (mostly for speed) but is much better in IE8/9

PHP
This is loosely based on the Javascript language (for syntax). It's major difference is that it is run on the webserver BEFORE the HTML page is sent to the users browser. It never runs on the browser. PHP is typically used to add logic/intelligent to a web page. (example,you have data from a Cumulus webtag to say it is raining, so show a picture of a cloud) Whatever output PHP produces must be in HTML. So, when you request a web page from the server containing PHP the web server will execute this, build the resultant page (in HTML), and send the result to the browser. PHP must be enabled on the webserver. Most good hosting firms enable it by default. Most free hosts do not.

When to use JS (Javascript) or PHP ?

Using PHP is much faster (usually) as all the work is done on the webserver (which is fast) and the result is sent to you
Javascript is slower as all the JS code is sent to the browser, then executed on the PC, and the page updated
A user may have JS disabled, so you might need to consider that your page will not work
If you do not have PHP on your webserver you need to use JS!

To be honest, you will probably use both.

If you look at this page...http://www.grantownweather.co.uk/realtime it starts off as PHP so that I can use logic on the web server to build the page and send the results. I then use Javascript to update the page every 30 seconds and highlight changes in yellow.

What about Ajax?
Ajax is, in essence, a concept not a new language. It's basically JavaScript and it works in the background while you are viewing a page on the browser. In the above example, I am actually using Ajax methods to go back to the webserver and get data every 30 seconds; I then use Javascript to update the page layout/content

and jQuery?
This is simply a library of Javascript code (functions). Using jQuery I can use simple commands to do tasks that would take several lines of Javascript. jQuery is Javascript.

any questions? LOL Hope that helped ;)
David
kippfordweather.uk
Cumulus MX & Raspberry Pi

User avatar
nking
Posts: 804
Joined: Thu Dec 17, 2009 2:03 pm
Weather Station: WH1081
Operating System: Windows 10
Location: Hurstpierpoint, West Sussex, UK
Contact:

Re: Vote for the next article - PHP or Javascript

Postby nking » Thu Jun 16, 2011 10:36 am

Thanks David - CRYSTAL! :)

Graham64
Posts: 74
Joined: Mon Aug 23, 2010 5:04 pm
Weather Station: Davis Vantage Pro 2
Operating System: Windows XP
Location: Cornwall, England
Contact:

Re: Vote for the next article - PHP or Javascript

Postby Graham64 » Thu Jun 16, 2011 12:22 pm

David
Thanks very much, that is just what I wanted - a concise summary in one place. I, for one, will find it very useful.

What about putting it on the Wiki as a good starting point that can easily be found for those of us new to a lot of the languages etc?

Graham

User avatar
JennyLeez
Posts: 283
Joined: Wed Dec 16, 2009 2:32 am
Weather Station: La Crosse WS3083
Operating System: Windows XP, Win7 & Win 10
Location: Wairoa, Hawkes Bay. New Zealand.
Contact:

Re: Vote for the next article - PHP or Javascript

Postby JennyLeez » Thu Jul 14, 2011 10:38 pm

Thanks for the summary David.

I see php won the poll so now I wait for my php lessons :)
Wairoa, Hawkes Bay, New Zealand Weather Station:
http://wairoa.net/weather/index.htm
Cumulus Topsites:
http://cumulussites.net/
Image

User avatar
duke
Posts: 845
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Vote for the next article - PHP or Javascript

Postby duke » Sat Dec 17, 2011 11:02 am

Does the PHP article exist yet? I need to start somewhere :D

Duke
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
steve
Cumulus Author
Posts: 26199
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: On tour in France
Contact:

Re: Vote for the next article - PHP or Javascript

Postby steve » Sat Dec 17, 2011 11:35 am

David seems to be taking a sabbatical. Hopefully he'll be back before long.
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Like Cumulus and want to support it? Please donate! Image

User avatar
duke
Posts: 845
Joined: Sun Jul 03, 2011 6:23 pm
Weather Station: Davis VP2 Plus - 24hr FARS
Operating System: Windows 10 - 64 bit
Location: Eastleigh, Hampshire, UK
Contact:

Re: Vote for the next article - PHP or Javascript

Postby duke » Sun Dec 18, 2011 5:17 pm

In it's abscence can anyone suggest a good place to start?

Duke
Duke

Nightingale Weather
Eastleigh, Hampshire, UK
------------------------------------------------------
Validate your pages - often!

User avatar
steve
Cumulus Author
Posts: 26199
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: On tour in France
Contact:

Re: Vote for the next article - PHP or Javascript

Postby steve » Sun Dec 18, 2011 6:37 pm

php.net is a good place for information on PHP. There's a getting started tutorial here - http://php.net/manual/en/tutorial.php
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Like Cumulus and want to support it? Please donate! Image

gemini06720
Posts: 1700
Joined: Mon Aug 10, 2009 10:16 pm
Weather Station: No weather station
Operating System: No operating system
Location: World...

Re: Vote for the next article - PHP or Javascript

Postby gemini06720 » Mon Dec 19, 2011 3:25 pm

Another good Internet location would be W3Schools' PHP Tutorial...


Return to “Web site - General”

Who is online

Users browsing this forum: Yahoo [Bot] and 6 guests