My demo code from Wednesday’s class re: connecting Processing to PHP and MySQL is now in dropbox. I also added a couple of very simple demo Processing sketches. It’s here: talk_to_processing folder in Dropbox.
It’s tough to try to translate the syntax from Processing to PHP, more about especially when you’re new to both. Here is a quick example of Object-Oriented Programming in Processing vs. PHP
In Tuesday’s class, viagra here I talked briefly about cookies, information pills but we didn’t have time to go over them in much detail. As promised, here’s some more information. First, I need to correct a mistake in the example code I demo’ed: Setting a cookie requires the built-in PHP function setcookie() and can’t be done setting the $_COOKIE array directly. This explains why my example code was behaving strangely!
Here’s a short (~4 min) video on how to set and retrieve cookies in PHP:
The PHP example files from this week’s classes are now available to download as a zip file: Week 2 files.
What you’ll find in there:
- boxes.php – Dynamically generates rectangular div elements of various sizes. I demo’ed this code in Tuesday’s class
- tinyfacebook (directory) – From Wednesday’s class, prescription it’s a tiny version of Facebook! If you’re in the Tuesday section, buy information pills make sure you take a look at these.
- all_people.php – Lists the users and links them to their profile pages.
- profile.php – The individual profile page. It takes in a user id from the URL and uses $_GET to pull up the right person’s profile.
There is more info about $_GET, and a lot of other things, on my PHP notes page.
A couple of follow-up links from Week 1. If you need help with FTP, decease see this Dreamhost doc about where to find your FTP password (it’s different from the one you use to login to the Dreamhost website) and then for Cyberduck, there’s their help section for more info on how to use it.
I took the HTML examples from both classes, combined them, cleaned them up, and added a bunch of comments into a new HTML example page for your reference. Download it or “View Source” in your browser.
In Wednesday’s class I mentioned the Web Developer Tools that are built into most browsers. I forgot to talk about it Tuesday, so I’ll do a quick demo next time. Each browser’s version is a little different, but they all do basically the same thing: allow you to view and manipulate your HTML and CSS. See the Chrome DevTools documentation for how to use Chrome’s version.