|
Due
Submit on D2L.
For this homework, you'll submit three files:
utils.php,
utils-test.php,
and
silly.php.
The files silly.php does not need to be viewable via the web.
Notes:
Note that this is just a regular ol' function that takes in strings and returns strings!
The fact that the strings happen to have angle-brackets in them means that the result might
be useful to people generating html, but the function itself doesn't really care.
(You don't need to come up with additional test cases, but you do need to actually include these tests or their equivalent. You can assume that neither string is ever empty.)
Note how the input strings don't contain any quote-characters, but the returned result does (since HTML attributes must be quoted). I recommend that your generated html uses single quote marks around attributes, but you'll get full credit for either single- or double-quote marks, as long as it is valid HTML. Make sure your test case(s) express exactly what the ideal, desired result is!
Make a runnable test-case: your answer for (b) should be the expected-result from calling thumbnail("http://imgur.com/Qv2wl56.png",300).
You don't need further test-cases for this problem. Do, however, pay close attention to the exact spacing you want to have. I recommend using single-quotes (') around the attribute-values (for reasons that follow from php strings).
For full credit, your function should call hyperlink as already written!
If you like: You can run your program, and to make sure what it printed is valid xhtml, you can redirect (or, paste) your output into a file, and then open that local-file via a browser's File » Open…. But observe that in this process, we are not actually accessing/using the web at all.
Let me know if you have a better name for the function; an ibuck awarded if I accept it.
↩thumbnail. In that case, you are free to name it
imageOfGivenWidthWhichWhenClickedOnGivesYouTheOriginalFullSizeImageinstead. In general though, it's not unreasonable to name a task after its most common use-case, and also realize that it can be used in mildly-counterintuitive ways as well.
Let me know if you have a better name for the function; an ibuck awarded if I accept it.
↩This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |