Lecture 2

Design document

Structure of HTML

<html>
<head>
  <title>Sample HTML Pag Structure</title>
</head>
<body>

  <h1>Heading 1</h1>

  <p><b>Welcome</b> to <i>HTML</i>!</p>

</body>
</html>

Adding CSS

<head>
  <title>Common HTML Tags</title>
  <style>
    h1 {
      color: purple;
    }

    .rounded-border {
      border: 2px solid purple;
      border-radius: 8px;
    }
  </style>
</head>

<body>

  <h1>Heading 1</h1>

  <p><b>Welcome</b> to <i>HTML</i>!</p>

Why cascading?

Advantages of Classless CSS Frameworks:

<a> Href tag

Simple form

Forms – method Get vs Post

GET Method

POST Method

Details and summary

• The <details> and <summary> tags are HTML elements used together to create an interactive widget that users can click to hide or show more content. • This feature is particularly useful for implementing FAQs, collapsible lists, or any content that benefits from a hide/show interaction to keep the page clean and improve user experience by not overwhelming them with information all at once.

PHP

What is PHP?

Basic syntax

PHP - Variables

Alt text Alt text

String concatenation

Alt text

PHP – Control Structures – If statements

if Statement:

Alt text

Loops

PHP supports while, for and foreach loops

Alt text

Alt text

Alt text

PHP operators

Working with forms

Alt text

PHP - Built-in SuperGlobals

PHP – Forms – Get vs Post

Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and has limits on the amount of information to send.

Alt text

When to use Get

Alt text

Function in PHP

• A function will be executed by a call to the function. • The PHP script defines a function showName that takes two parameters, $given_name and $family_name, and echoes them with a space in between and an exclamation mark, followed by a break (<br>).

Alt text

PHP - functions

Alt text

Classes - visibility

Creating Objects

To create an instance of a class (i.e., an object), use the new keyword followed by the class name: Accessing Properties and Methods

Once you have an object, you can access its properties and methods using the arrow operator ->. Here's how to use the setColor and getColor methods:

Alt text

PHP – Classes – Constructor Method

Alt text

UQCloud & NGINX Web Server

Elements of a Web Server

The basic elements of a web server includes

Alt text

Web server software

Top five open source web server

UQCloud gives each student a Zone, which is a server that runs NGINX where various services can be enabled eg PHP, databases, etc…

NGINX Web server – Basic config file

This specifies the default files that Nginx should look for when a directory is requested.