LIS 4365 Web Design Technologies: Working with PHP and Animating in JavaScript

This week I started learning PHP, I like the consistency and simplicity of the language. Also covered this week was how to make simple animations using sprites and JavaScript.

Writing PHP

The first thing I worked on this week was a couple of small scripts that worked together to make an HTML page. The first simply generated some variables, and then the second script is actually HTML with PHP embedded into it. The second script accessed the variables contained in the first to generate new HTML code on the server and send that to the client. You can see the page on my Sandbox website here, or follow the link at the bottom of this page.

PHP Mini Quiz

The second part to this weeks assignment is to answer some quick questions about PHP syntax.

  1. PHP server scripts are surrounded by what kind of delimiters?
    • A: <?php>...</?>
  2. How do you write “Hello World” in PHP?
    • A: echo "Hello World";
  3. All variables in PHP start with which symbol?
    • $
  4. What is the correct way to end a PHP statement?
    • ;

Animating Sprites with JavaScript

Animated graphics when used appropriately can add to the aesthetic of a website. To make them work is a little bit a combination of JavaScript and CSS. I made another page for my Sandbox Website that has a simple repeating animation. The animation is actually a single PNG image known as a sprite sheet. The sprite sheet has 6 frames drawn on it, by cropping the image, only a single frame is displayed at a time. I can then change the position to create the effect of having many images played in series. You can see the animation on my Sandbox Website here, or follow the link at the bottom of this page.

Links

Module 6A Page with working PHP script: http://simon-liles.epizy.com/Module6A.php

Module 6B Page with JavaScript Animation: http://simon-liles.epizy.com/Module6B.html