201920 IMS222
The Bean by Zichun Yuan

In class on Friday (Week 11)

Project 03 - the final project - HireMe/index.php

Goal Assignment Grading Rubric

On Your Own - Due by Sunday 04-14-2019 at 11:59pm

Goal Assignment Grading Rubric

New material to learn before class on Friday

Video/Transcript: IMS222 42 - Introduction to PHP (Static vs Dynamic)

(watch this video in a new tab or window)

  PHP is a popular general-purpose scripting language that is especially suited to web development.  It is very powerful and is widely used.  Up to now, all of our content has been static, which means you typed something, saved it, and viewed it on the web.  With PHP, you will begin to use dynamically created content.  You can type something like:   
  
<?php   
echo date('Ymd');   
?>   
  
on your web page and when you view it you'll see today's date in year month day format.   

Video/Transcript: IMS222 43 - Introduction to PHP

(watch this video in a new tab or window)

  PHP needs to be installed on your website.  At Miami, it's already been installed.  To create a new PHP document, you can just copy an existing document and change the extension to php.  You can begin and end PHP multiple times in the document if you want to, or you can wrap the whole thing in PHP.  To begin PHP type '<?php' and to end PHP type '?>'.  When you're in PHP, you can still create HTML by using 'echo'.  The following will say 'Hello World':   
  
<?php   
echo 'Hello World';   
?>   
  
Now let's put that in bold:   
  
<?php   
echo '<b>Hello World</b>';   
?>   
  
Now let's make it a header:   
  
<?php   
echo '<h1>Hello World</h1>';   
?>   
  
Now let's make a list:   
  
<?php   
echo '<ul><li>John<li>Bob<li>Bill<li>Rick<li>Steve</ul>';   
?>   
  
Here's the same list a few different ways, all with different code formatting but with the same HTML formatting:   
  
<?php   
  echo '<ul>   
        <li>John   
        <li>Bob   
        <li>Bill   
        <li>Rick   
        <li>Steve   
        </ul>   
       ';   
?>   
  
  
or   
  
  
<?php   
  echo '<ul>   
          <li>John</li>   
          <li>Bob</li>   
          <li>Bill</li>   
          <li>Rick</li>   
          <li>Steve</li>   
        </ul>   
       ';   
?>   
  
  
or   
  
  
<?php   
  echo '<ul>';   
  echo '  <li>John</li>';   
  echo '  <li>Bob</li>';   
  echo '  <li>Bill</li>';   
  echo '  <li>Rick</li>';   
  echo '  <li>Steve</li>';   
  echo '</ul>';   
?>   
  
  
or   
  
  
<?php   
  echo '<ul>';   
  echo '  <li>John</li>';   
  echo '  <li>Bob</li>';   
  echo '  <li>Bill</li>';   
  echo '  <li>Rick</li>';   
  echo '  <li>Steve</li>';   
  echo '</ul>';   
?>   
  
Here's a loop to show you some of the power of PHP.   
  
$ThisManyRounds=3;   
for($round=1;$round<=$ThisManyRounds;$round++){   
  if($round==1){$Topic='American Literature';}   
  if($round==2){$Topic='Mathematics';}   
  if($round==3){$Topic='World History';}   
  echo $round.') '.$Topic.'<br>';   
}   
  
See if you can change the loop to show the dates of the last 180 days in the following format:   
Day of the Week, Month-Day-Year   
Good luck.   
  
Here's code to get you started:   
$ShowThisManyDays=30;   
for($day=-10;$day<=$ShowThisManyDays;$day++){   
  $TheDay=date('F m-d-Y, l',   
               mktime(0,   
                      0,   
                      0,   
                      date('m'),   
                      (date('d')+$day),   
                      date('Y')   
                     )   
              );   
  echo $TheDay.'<br>';   
}   

Assignment due by Sunday 04-14-2019 at 11:59pm

Goal Assignment Grading Rubric