201910 IMS222
Skateboard by Sedrick Kirschman

In class

On Your Own - Due by Wednesday 11-14-2018 at noon

Goal Assignment Grading Rubric

New material

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>';   
}  

Download the zipped/compressed HireMe site template

Video/Transcript: IMS222 HireMe/index.php - Step by step instructions

(watch this video in a new tab or window)


Hi. Your Hire Me site. A culmination of all of the work you've done all semester. This is going to be a PHP website with all of the things that you might want to show for someone to hire you. I have a few examples of some things you might want to talk about so let's look at those.

Let's say you were looking for a photography job. You might want to talk about pricing and samples, testimonials, awards, contact info, things like that.

If you're looking to be a web designer, you may want to include languages, programs you've written with screen shots or things to buy; demo things on the site. You may want to look at plans for your future, and you may want to have your resume on it (no PDFs).

If you want to be a game developer, you may want to include game design, concepts and theory, your favorite games and why, list competitions you've participated in.

Take a look at other people's sites and see what they have. See if they have things that you want to include or exclude.

The hire me site is supposed to tell a potential future employer things about you, the things you're interested in, and the type of work that you're looking to do.

Let's dive in to the hire me site. I have my VPN client open and I'm going to connect. Once connected, I'll go to my Finder window and connect to my disk space. Then I'll go to my IMS222 folder and since I've already done this project, I'll rename the old version. Then I'll download the zip (or compressed) site from our class website, find the file in my downloads, double-click it to uncompress it, and copy it to my IMS222 folder.

While it's copying let's look at the site ( https://www.users.miamioh.edu/hopkinks/IMS222/HireMe/ ). The warnings were because the files had not all been copied. Refreshing the page after it's done takes care of that issue.

Looking at the code starting with the index page. You see that it includes the wwwsiteheader.php file which is similar to what we did on the MyInterest site, but done a different way. All of the wwwsiteheader.php code is included in the index page and can be included in other pages so you don't have to type it into multiple pages over and over. Similarly, each page includes the site footer. Lines 9 through 21 is part of an echo which dumps html to the browser. You should already understand that.

On line 7 I also include Kirk's Picture Grabber. When I reload the page, you can see it randomly grab a new image. It's slow in the video because I'm on VPN. Sadly, VPN slows down your network connection. Let's see how big the image is. It's 443K, which isn't super huge. All images in that folder are below a half of a megabyte, so that's OK. So it was just the VPN slowing me down.

Just because I included the picture grabber doesn't mean you should include the picture grabber. Include it if it makes sense. If there's no good reason to have it on your site, don't include it. The same is true for displaying the date. If there's no good reason to say what the date is, remove that code.

You also don't want to have a page called this, that, the other, and sample page. When I choose this, it takes me to this.php. You should not have a page with the name of this.php. Let's say you're into photography, you probably want to have a home page, and you might want to rename your this.php page to PhotographyGallery.php. Maybe you would have a bids page or a contact me, or samples of your work. Whatever reason you think someone would want to hire you, that's what you should put on your website.

You may be asking yourself how much or how little should I put on my website. The answer is, whatever you think you need. If you think you need a lot of data, put a lot of data/content. If you think only a little bit of information can get it across, just have a little bit, and that's fine too. There's no right or wrong answer. The question is, why would someone want to go to this site to hire you? If they're looking for a photographer and you have no samples of your photos then why would they hire you? They probably wouldn't. If you're a web designer and you have no samples of web design, why would they want to hire you?

I've included the KirksPictureGrabber.php program, a resume (that you may or may not want to have). Please don't put a PDF on your site. Double check the CSS to see if it has everything that you want. It's not super long. You will want to remove Kirks brown M&M ( KirksUnusedCSS_RemoveThisIfYouAreStealingMyCSS ).

I created separate directories for my home page images and my images for that page. If you're not using those, then you should remove them. If you want to put all of your images in one folder (like the img folder), that's fine. If you want to separate them out by page, that's fine too. Just be consistent in whatever you do.

Let's look at the footer for a moment. It's pretty short. I have some inline styling which you may or may not want to do.

Hopefully that is enough to get you started. I look forward to seeing your Hire Me sites.