إعلانيمكن أن تكون علامتك التجارية هناعلامتك التجارية هنافي كل صفحة من Darslab · طلاب وأولياء أمور ومعلمونinfo@darslab.comاسأل عن الأسعارالأسعارinfo@darslab.com
☰ خطة العام · تكنولوجيا المعلومات والاتصالات (بالإنجليزية)

HTML, PHP, publishing and the session

الأسبوع 2 · الوحدة ١ «أساسيات تصميم موقع الويب» (٢): HTML وPHP وبرنامج خادم الويب، نشر الموقع (محليًا أو باستضافة)، لغة SQL ونظام قاعدة البيانات، حزم تطبيقات الويب، الجلسة · 3 دروس
1

HTML, PHP and the program that serves pages

ICT Secondary 2 Term 1, Unit 1, Topic 1: pp. 14–19
GoalSay what HTML, PHP and the web server program each do, and follow a request from the browser to the finished page.
New words
HTML · the markup language that describes the structure of a page with tagsPHP · a free, open-source server-side language whose code sits inside the HTML of a .php fileweb server program · the program that receives requests and sends back pagesbrowser · the program that asks for pages and shows them
Explanation

HTML is the markup language of the web. It uses tags to say what each part of a page is: a heading, a paragraph, a picture, a link. PHP is a different tool for a different job. It is a free, open-source language for the server, and its code is written inside the HTML of a file that ends in .php. (The letters first meant “Personal Home Page”; today they stand for “PHP: Hypertext Preprocessor”. Treat both as just a name.) Who does what? The browser asks for the page. The web server program receives the request, finds the .php file and hands it to the PHP engine, which runs the PHP parts and leaves the HTML parts alone. What comes out is plain HTML, and that is all the browser receives. Note that PHP is run, not “translated” into something else for the browser. To write all this code you need only a plain text editor; fancier code editors just make typing easier.

Worked examples
Html
1<p>The club has <?php echo 3 + 4; ?> new books.</p>
Output
<p>The club has 7 new books.</p>
A club page has one line of PHP inside its HTML. The file on the server is shown on the left. The browser never sees the PHP line, only the text that it printed.
JobTool
write the codeplain text editor
receive the requestweb server program
run the PHP partsPHP engine
show the pagebrowser
Match each job to the tool. Writing the code: a plain text editor. Receiving the request: the web server program. Running the PHP parts: the PHP engine. Showing the finished page: the browser.
Class activity

Draw the journey of one request for books.php on paper: four boxes with arrows. Under each box write who does the work and what moves along the arrow (a request, a file, plain HTML). Mark the box that the visitor never sees.

Practice
1
Which language describes the structure of a page: HTML or PHP?
2
What does the browser receive when the file contains PHP?
3
Which program passes a .php file to the PHP engine?
4
Do you need a special program to write PHP code? Explain.