Goal: Keep making Silex apps which allow you to create, save and delete objects, while using Twig templates. Don't forget to make regular Git commits and include a README in your project.
Let's go and improve your car dealership app now that you know how to save objects and use Twig! You and your pair can decide whose version of the app you want to work on. Then you are going to get the code from your github repository onto your computer for you to work on, and then you can continue making commits as usual and push the finished version of the project to both your github accounts.
To continue to work on an existing repository:
git remote addcommand.
cdinto your new folder as if you were creating a new repository.
git clone https://github.com/dianedouglas/TicTacToe.git .replacing my URL with your own. The
.at the end of the command means "put the project into the current directory."
git paircommands to assign you both as authors.
git add .and
git commit -m "My message"as you work.
git push origin master.
git remote add name [URL]and
git push name mastercommands just like we've been doing.
Add Twig templates to your app instead of outputting HTML directly.
Then add a page to your Car Dealership app to let users selling cars post an add on your page by creating a
Car object. They should fill out a form with the car's price, mileage, make / model, and a URL to a picture of it.
Add the code to save all the
Car objects inside of the session when they are created. Display all the saved cars instead of creating them yourself beforehand by writing
$porsche = new Car("2014 Porsche 911", 114991, 7864, "images/porsche.jpg");.
Remember CDs? Make a program for users to catalog and organize their CDs. They should be able to create a new CD, enter the CD title, and list out all of their CDs.
After your program can create and list CDs, add a feature that allows a user add an artist to the application and its database. Then, each time a new CD is created, the user should be able to choose an existing artist to associate the CD with. Keep it simple, and assume each CD is just by a single artist.
After that, let users list out all the artists, and choose an artist to see which CDs are by that artist.
Don't forget to make regular Git commits and include a README in your project.
After that, create another link on the home page to take the user to a "/search_by_artist" page. Here, users should be able to fill out a form with an artist name to search for their collection. After submitting the form the user should be taken to a page listing out all the CDs they own by that artist.
Improve your search - if the user has created a CD object by "JS Bach" they should be able to search for it by typing in "bach", "Bach", and "Johann Sebastian Bach".
Say the user has a CD by "Bachman–Turner Overdrive" as well as one by "JS Bach". If the user searches by the name "bach", or "Bach", both the CDs by "JS Bach" and "Bachman–Turner Overdrive" should be displayed.
Make a program to play the Hangman game.
If you're not familiar with Hangman, it works something like this:
________________ /\ | \/ | | | ------- | | | | | /\ | / \ | ___|_____ __ __ __ __ __ __
The spaces at the bottom represent letters of a word - in this case, the word is six letters long. On each turn, the player must guess a letter. If the letter is in the word, it's added to the bottom, like this:
________________ | | | | | | | | | ______|_____ b __ b b __ __
If the letter isn't in the word, a body part is added to the hangman and the incorrect letter is displayed below the word:
________________ /\ | \/ | | | | | | | ______|_____ b __ b b __ __ a
If the player guesses all the letters in the word, they win. If the player has had 6 incorrect guesses then they lose. The 6 incorrect guesses stand for the stick figure hangman's head, 2 arms, torso and 2 legs.
Build an app for playing Hangman. Think carefully about the object(s) you'll use before starting. There are multiple ways to solve this problem.
Guessby entering a letter into a form, and the app should tell them if it's right or wrong, and keep track of how many guesses they have left.
b _ b b _ _
Make a game where two people can play Go Fish against each other. You will need to create a Game class and a Player class, which should at least hold the player's hand of cards.
If you are feeling ambitious: create a single-player mode where one user can play against the computer.