Php webtags: Difference between revisions

820 bytes added ,  20:05, 26 June 2020
m
no edit summary
mNo edit summary
Line 470: Line 470:
See [[Sensor_Contact_PHP]] for another example script that uses this file.
See [[Sensor_Contact_PHP]] for another example script that uses this file.


==Debugging==
==Viewing the PHP==
 
Any PHP only exists on the web server, all a browser can see is the generated HTML, so this is what you see if you use the web browser's View Source option. As explained in [[PHP]] article not showing PHP has security advantages protecting content that might include stuff you don't want the public to see and preventing unauthorised changing of the script file. (Javascript files can be seen normally and most browsers provide an option to edit them).
 
Some authors when writing a script using PHP do include a downloading option at the start of the script before any other output. These downloaders allow you to see the actual PHP script. Unfortunately, there is no rule on how you invoke this downloader. I tried hard to get standardisation; see [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=16425 Source Listing suggestion] in the forum. Another problem my suggestion addressed was the possibility that a web page includes multiple PHP scripts, and the downloader may list a different one to that you wanted to see.
 
Here are some querystrings you might try, in the brandon script download the PHP by appending the querystring <tt>?source=view</tt> to the end of the URL. Other templates might expect you to add the querystring <tt>?parse=source</tt>, <tt>download=source</tt>, <tt>sce=view</tt>,  or reversing the first idea <tt>?view=source</tt>. There are several other variants including <tt>"?view=getorfmiland</tt>.
 


If you wish to view all the values contained within a template file , some files (e.g. the brandon script) let you do this by appending the querystring <tt>?source=view</tt> to the end of the URL. Other templates expect you to add the querystring <code>?parse=source</code> and still others use <tt>?view=source</tt>. There may even be other variants. I tried hard to get standardisation see [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=16425 Source Listing suggestion] in the forum, but I know of at least five other variants, source is abbreviated to 'sce' or 'src', and as well as parse, people use 'download'.


Example
Example
5,838

edits