The where, what and how

  1. Login to the moose-x
    1. Press Command ()+k to Connect to Server


    2. Press the Browse button



    3. Select moose-x
      moose.png


    4. Press Connect
      connect.png


    5. Login as you usually do
      login.png


    6. Select moosepublic
      moose.png


    7. Select site
      site.png


    8. From site select moostudents. Navigate to the year you graduate. Open your web folder
      class.png


  2. Use BBEdit to write your text files.


  3. Save the file in your moo-web folder with the .php extension


  4. To access your php page through the browser, follow this path:
    http://192.168.0.5/moostudents/class_of_20year/lastname.firstname/moo-web/file.php



A Structured Document
To create a PHP page start with a text editor.

To properly structure a page, begin and end the document with:
<?php


?>


php Extention
If you have PHP inserted into your HTML and want the web browser to interpret it correctly, then you must save the file with a .php extension. Instead of index.html, it should be index.php if there is PHP code in the file.

Semicolons
Every statement in PHP ends with a semicolon.

Comments
PHP support three kinds of comment tags :
  1. //
    This is a one line comment

  2. #
    This is a Unix shell-style comment. It's also a one line comment

  3. /* ..... */
    Use this multi line comment if you need to.



Variables
A variable is a means of storing a value, such as text string "Hello World!" or the integer value 4. After varibles are initialized they can be reused throughout your code. In PHP you define a variable with the following form:
$variable_name = Value;
If you forget that dollar sign at the beginning, it will not work. Also, variable names are case-sensitive, so use the exact same capitalization when using a variable. The variables $a_number and $A_number are different variables.

There are a few rules that you need to follow when choosing a name for your PHP variables.


echo
The PHP function echo is a means of outputting text to the web browser.
echo "Hello world";


String Creation Heredoc
$my_string=<<<MY_STRING
Saint Anns School<br />
129 Pierrepont Street<br />
Brooklyn, NY 11201
MY_STRING;
There are a few very important things to remember when using heredoc:
Another thing to note is that when you output this multi-line string to a web page, it will NOT span multiple lines. To insert a carriage RETURN you need to use the <br /> tags contained inside the string. Here is the output made from the code above:
heredoc_output.png