SlideServe
Menu
Préférences
© SlideServe · v2026

Web Development

finian avatar
16 diapositives · 390 Views · Aug 06, 2014

Web Development. PHP intro. What is it ?. PHP is a server side scripting language It is also a pre-processor as it processes web pages before sending them to the client There are other server side languages out there, but php is open source and therefore free!

Web Development - slide 1
01 / 16Web Development
1 / 17

Télécharger la présentation

Web Development
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Web Development PHP intro

  2. What is it? • PHP is a server side scripting language • It is also a pre-processor as it processes web pages before sending them to the client • There are other server side languages out there, but php is open source and therefore free! • Unicentre (actually Moodle) is written in php

  3. How to get it • Download and set up a portable version of EasyPHP on your USB drive so that you can take the server around with you and use it on any PC • A portable version of an application doesn’t amend the Windows’ registry (and so won’t appear in the Start menu)

  4. How HTML works user types in the URL (.htm) Request sent to server, HTML page returned HTML page parsed by the browser and displayed

  5. How php works user types in the URL (.php) Request sent to server, php processed and HTML page returned HTML page parsed by the browser and displayed

  6. How does it fit in with HTML? • php script is embedded within the HTML • because of this, all php is written inside tags • the php tags are <?php ……… ?> • php uses syntax that is very similar to C (and therefore also like Java) • for example, all php lines end in a semicolon ; • unlike HTML, it is a proper programming language that supports sequence, selection and repetition

  7. First php program <html> <head> <title>My first php program</title> <body> <?php echo “hello world”; ?> </body> </html>

  8. Notes • In html written in PowerPoint I omit the Doctype required by xHTML. • This is purely to keep the code manageable on screen • In the real world, you should use the doctype • echo prints to the html document that will be sent to the browser for parsing, effectively printing it on the screen as it is outside of any tag

  9. Coding Conventions • You should observe normal coding conventions, namely: • indent your code to make it readable • use comments (// or /*…..*/) • use meaningful variable names • Programming is usually a team pursuit and you will make yourself very unpopular if you write code that is illegible

  10. HTML with php <html> <head> <title>My first php program</title> <body> <?php echo “<h1>hello world</h1>”; ?> </body> </html>

  11. Integration Important note: • the phpgoes in the html, not the other way around • remember, php is written inside HTML tags! • the code on the following slide will work, but is incorrect and must be avoided:

  12. Integration <?php echo “<html>”; echo “<head>”; echo “<title>My first php program</title>”; echo “<body>”; echo “<h1>hello world</h1>”; echo “</body>”; echo “</html>”; ?>

  13. Variables • php is a loosely typed language • this means that you do not have to declare variables before using them • neither do you have to declare what type of data you want to store there – this will be sorted out automatically for you • all variables must start with a dollar sign $

  14. Variables • e.g. <?php $txt="Hello World!"; $x=16;?>

  15. Similarities to other languages • php has many built in functions • it will save you a lot of time if you get to know these and get used to looking to see if there is a function to do what you want to do before you write some code to do it! • There’s no point reinventing the wheel!

  16. Similarities to other languages • the loop functions (for, while, do…while) are the same as for C • the selection statements are the same as for C (if…else and case… switch) • arrays are very similar too