Week 11
In Canvas - Quiz 05 - More CSS Mechanics
Project 03 - the final project - HireMe/index.php
Goal- Create a multiple page website in a HireMe folder with a navigation menu system with a PHP extension (you can use PHP include for the header and footer but that is not required)
- Opportunity for creativity in content and design
- Opportunity to demonstrate learning
- Have a website to use for looking for an internship or summer job
- This project may be used in future IMS classes
- Create HireMe/index.php
- Due by Thursday 04-30-2020 at 11:59pm
- One re-grade request allowed from Thursday 04-30-2020 at 11:59pm until Thursday 05-07-2020 at 11:59pm
- Grade value: 25% of your final grade
- Content should include
- Multiple pages in a new style that tell about your story (why someone would want to hire you)
- You can begin from Kirk's template; you need to modify the css to make it uniquely yours
- Content: Multiple pages in a new style that tell about your story (why someone would want to hire you)
- -50% not multiple pages, I will allow up to a C for a re-grade request
- -50% barely any content, I will allow up to a C for a re-grade request
- -20% not nearly enough content
- -10% not quite enough content
- -05% could use some minor content changes
- Spelling/Grammar:
- -10% spelling/grammar (up to 3 examples will be provided if these issues are found)
- Design: You can begin from Kirk's template; you need to modify the css to make it uniquely yours; some of the items below are common issues
- -50% major color scheme issue - illegible text
- -40% not clearly stating what type of job you are looking for
- -40% did not remove KirksUnusedCSS_RemoveThisIfYouAreStealingMyCSS
- -30% did not change Kirk's color scheme enough
- -20% designs and/or images that don't scale (i.e. not responsive)
- -20% navigation menu system hides page content (responsive design problem)
- -20% dead link to an index or home page
- -20% using an image or PDF of a resume in place of a web page
- -20% webpages, titles, and/or menu navigation should be renamed from "This, That, etc"
- -10% using links that open improperly (links that go away from your site need to open in a new tab/window)
- -10% prominently displaying unrelated information like "Today is ..."
- -10% improperly using KirksPictureGrabber.php
- -10% showing email addresses without creating a mailto links
- -10% poorly named page title
- -10% leaving the navigation menu looking like a file folder when the width is skinny
- -05% minor responsive design changes needed
- -05% spacing between content and the edge of the page
- -05% minor color scheme issue
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 - PHP is not very forgiving
(watch this video in a new tab or window)
People new to PHP find that PHP is not very forgiving, especially compared to HTML. Let's look at a page. Here I have a page with some very basic HTML in PHP. In my web folder I don't have an error log. I'll create an error by adding an extraneous single quote. When I refresh my page, it says 'This page isn't working'. As soon as I create an error and refresh my site (I'm using an FTP client called Cyberduck during this video, if you're connected via WebDAV the error_log file will show up in a little bit). The error_log will show a line number near where the problem is. The problem may be before the number. Make little changes in your code and reload your pages often to make troubleshooting go more quickly than making lots of changes at a time. I'll delete the extra single quote, save the page, and reload it in the browser to verify that it's functioning properly again.
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 Thursday 04-09-2020 at 11:59pm
Goal- Practice PHP
- Show attention to detail
- Demonstrate ability to follow specific instructions (this is a not a creativity exercise)
- Create WebPage11.php
- Due by Thursday 04-09-2020 at 11:59pm
- One re-grade request allowed from Thursday 04-09-2020 at 11:59pm until Thursday 04-16-2020 at 11:59pm
- Grade value: extra credit up to 1% of your final grade
- Content should include (and the words must exactly match as shown below with the text in {} being replaced with the current date/time info)
- Today is {MM-DD-YYYY}
Numeric representation of a month, with leading zeros - Day of the month, 2 digits with leading zeros - A full numeric representation of a year, 4 digits - The time is now {hours:minutes{am or pm}}
hours should be in 12-hour format of an hour with leading zeros and minutes should be minutes with leading zeros - Add an if statement that will either show "The second hand ({SS}) is odd" or "The second hand ({SS}) is even" based on when the page is loaded
SS means Seconds, with leading zeros
- I am completing the project below so you can see exactly what I want
- Today is 11-21-2024
- The time is now 07:57am
- The second hand (58) is even
- -25%: did not include Today is MM-DD-YYYY (where MM-DD-YYYY shows today's date)
- -25%: did not include the time is now hours:minutes (with the current time)
- -25%: did not include an if statement that will either show "The second hand (SS) is odd" or "The second hand (SS) is even" based on when the page is loaded
- Address all concerns identified on Kirk's Pet Peeves
Video/Transcript: IMS222 - WebPage11
(watch this video in a new tab or window)
With WebPage11 we're going to practice some PHP. Ultimately we want to show 'Today is' with the date in month dash day dash year format. 'The time is' in hour colon minute am or pm format. 'The second hand is' odd or even based on the current second. Reloading the class page shows the data updating like your page should update.
Let's look at my code. At the top of the page I have standard HTML. Since I have a favicon, I include it in my HTML. You should have your name in place of mine. Web Page 11 is still a good title to have. The meat of the page is from lines 12 through 27. On line 12 I begin PHP and on line 27 I end PHP. On line 13 I set the timezone. Line 14 is an H1 with a page header hard-coded (i.e. static, it doesn't change automatically). On line 16 I have a break followed by 'Today is'. I can add text, save it, reload my page to see how it changes. Break out of HTML and into PHP with a period. I have a PHP date function in double-quotes, it could also be in single quotes. I have m dash d dash capitol Y to show in the format required for this assignment. When I reload my page, nothing changed, because I forgot to save my changes. I saved my changes now and reload the page to get an updated page.
To find PHP date format information I did a Google search for 'PHP date'. I like to use the PHP manual and W3Schools. I'll use the date manual today. Let's try a capitol D. It shows 'Mon'. A lowercase 'l' shows 'Monday'. I'll set it to m dash d dash capitol Y for this assignment.
The 2nd requirement for the assignment is to say 'The time is now' with the current time. You can't just type the date, the time, and the seconds because they need to be current every time the page is reloaded. That's why we are using PHP. Single quotes and double quotes can often be used interchangeably in PHP but you need to use them in pairs and it's helpful to be consistent.
On line 20 I created a variable called Seconds. The dollar sign in front of the word makes it a variable. A variable is something that can change. This variable will be set equal to the current seconds (in the minute) using PHP's date function with a lowercase s. Line 21 shows 'The second hand is' and displays the current seconds in parenthesis. Reloading the page will show it changing. Line 26 helps determine if the variable is even or odd; using code that I found and modified by doing a Google search for 'PHP odd even'. I used StackOverflow for my example. I modified what I found and added an 'else' to show 'odd' if the variable is odd. Re-running the program (i.e. reloading the page) will show the results.