PHP: Difference between revisions

8 bytes added ,  16:01, 2 November 2018
m
Text replacement - "http://sandaysoft.com/forum/" to "https://cumulus.hosiene.co.uk/"
m (Changing sequence of existing content)
m (Text replacement - "http://sandaysoft.com/forum/" to "https://cumulus.hosiene.co.uk/")
Line 28: Line 28:
== Using PHP Hypertext Pre-processor ==
== Using PHP Hypertext Pre-processor ==


Original material by DAJ, but moved to this new page; on a former web-site he used PHP to generate his page, JavaScript to update his page frequently making use of information gathered using AJAX method and the jQuery library of JavaScript code to actually make his script browser independent - see [http://sandaysoft.com/forum/viewtopic.php?f=14&t=5306 support forum].
Original material by DAJ, but moved to this new page; on a former web-site he used PHP to generate his page, JavaScript to update his page frequently making use of information gathered using AJAX method and the jQuery library of JavaScript code to actually make his script browser independent - see [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=5306 support forum].


Update by [[User:Sfws|Sfws]] ([[User talk:Sfws|talk]]) 17:18, 22 April 2015 (PDT) based on material formerly on Customised templates page.
Update by [[User:Sfws|Sfws]] ([[User talk:Sfws|talk]]) 17:18, 22 April 2015 (PDT) based on material formerly on Customised templates page.
Line 45: Line 45:
However, below is a basic introduction to understanding and writing your own PHP to generate your web-page. This Wiki article cannot teach you PHP because it includes a very large number of functions, nor can I tell you if your web server supports PHP, but the examples below give a brief hint of how PHP could be used and should help you to get started.
However, below is a basic introduction to understanding and writing your own PHP to generate your web-page. This Wiki article cannot teach you PHP because it includes a very large number of functions, nor can I tell you if your web server supports PHP, but the examples below give a brief hint of how PHP could be used and should help you to get started.


One possible advantage of this type of script is that by default the script cannot be seen (unless the developer has added some code ([http://sandaysoft.com/forum/viewtopic.php?f=14&t=16425 see this forum topic]) allowing a query-string to be added to the url asking for some or all of the PHP source to be shown to the browser). This makes for a more secure script, because it only runs on the web site server.  For instance if information is read from a database or in another way involves a password of some kind, all that code can be hidden, the end-user then has no way to modify the script to get information that should not be seen by others. A disadvantage is that it can be more complicated to update information on a page, requiring the whole page to be regenerated. (Consequently, a mix of scripts may be used with updating by AJAX or JSON, added to the PHP that generates the basic page. That is beyond the scope of this article).
One possible advantage of this type of script is that by default the script cannot be seen (unless the developer has added some code ([https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=16425 see this forum topic]) allowing a query-string to be added to the url asking for some or all of the PHP source to be shown to the browser). This makes for a more secure script, because it only runs on the web site server.  For instance if information is read from a database or in another way involves a password of some kind, all that code can be hidden, the end-user then has no way to modify the script to get information that should not be seen by others. A disadvantage is that it can be more complicated to update information on a page, requiring the whole page to be regenerated. (Consequently, a mix of scripts may be used with updating by AJAX or JSON, added to the PHP that generates the basic page. That is beyond the scope of this article).




Line 174: Line 174:


The support forum includes many ideas for using PHP code, here are just a couple of them that are easy to implement:
The support forum includes many ideas for using PHP code, here are just a couple of them that are easy to implement:
#[http://sandaysoft.com/forum/viewtopic.php?f=14&t=8631&p=71770 compare yesterday with one year ago page]
#[https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=8631&p=71770 compare yesterday with one year ago page]
#[http://sandaysoft.com/forum/viewtopic.php?f=14&t=10755 Top Ten Records page]
#[https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=10755 Top Ten Records page]