English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to be able to display an HTML page according to the contents of a folder on the server. Is this possible with PHP or Javascript? What's the difference when programming a serverside Javascript as opposed to a client side? Aren't they the same, except that one is in the HTML document and the other is a separate file that is submitted to?

2006-09-23 06:23:04 · 2 answers · asked by Rockstar 6 in Computers & Internet Programming & Design

2 answers

"I want to be able to display an HTML page according to the contents of a folder on the server. Is this possible with PHP or JavaScript?"

PHP is how you would do it. It can be used to check the contents of a folder and output the result as you want it to be displayed in HTML

php is interpreted by a php parser on the server. When a browser (client) is pointed at the php page on the server the parser executes the php instructions and spits out the output (If there is any) back to the client usually in HTML. That also means that the client gets only the output and not the php code itself. It is very powerful and not that difficult to learn.

I would recommend PHP and MySQL Dummies by Janet Valade.

"What's the difference when programming a serverside Javascript as opposed to a client side? Aren't they the same, except that one is in the HTML document and the other is a separate file that is submitted to?"

JavaScript is only interpreted by the client i.e. browser. JavaScript can be imbedded in the HTML or linked via a file. But it needs to be downloaded first for the browser to use it.

JavaScript can be used to make a page more functional once it is loaded. Though people might turn off JavaScript and you can't control that. Also there can be variations how the JavaScript is interpreted from browser to browser.

The benefit of server side script is it is interpreted by the one server. So however you have set it up if you get it how you want it will output the same.

JavaScript is not too difficult but I would say PHP is a bit more straightforward. However it is also a bit stricter.

Hope that helps,

Paul

2006-09-23 13:46:51 · answer #1 · answered by dt01pqt_pt 2 · 1 0

PHP and Javascript while they have several similarities run in two entirely different ways. PHP is a server-side script and the server processes and anything that is given inside of an ECHO command is forwarded onto your browser. That is why PHP is perfect for web based databases because the PHP is processed on the server where the database is likely stored.

Javascript is processed by your browser and is useful for changing the way a web page appears on the fly. PHP changes require a reload of the page. I wouldn't say that one is necessarily harder than the other, they are just different depending on the intended function.

2006-09-23 06:26:15 · answer #2 · answered by nick2600ii 2 · 0 0

fedest.com, questions and answers