The Reflection

Since the time to work on this project is almost over, I can now reflect on the outcome, the group work, the planning and the other important things that were a part of it. We have basically been working on the page for two months now and I think time wise, we have done really well. We agreed to have the page finished before Easter so we could spend the time during the holiday to make smaller changes, comment the code, and look for errors or way to improve things that we did not like that much. Luckily most of our group worked really hard to reach this goal and when we went home, all the big parts, except for making it responsive where taken care of. During this development, we used GitHub as Rob suggested and we got to understand it pretty well. It was a very useful way of sharing code and keeping track of issues and things missing. Me and Tina created a lot of Issue files that could easily be closed once something was fixed. I have been uploading onto GitHub from the very start of the working process and every time I ran into an issue with the code, I could easily go back to an older version or track all the additions I had made. This was the first time ever, I worked on the development of a webpage but I can imagine that managing the code without GitHub would turn out very chaotic. I am happy that I now know how to use it and can keep using it for projects in the future.

Another thing I did along with the coding was blogging. It was a good way to reflect on things I had learned as well as a possibility for us to understand the thought process of our fellow group members. In case I forget something I might need for upcoming projects, I can now always go back and look at how I did it before.

Reflecting on our project now, I am very satisfied with the outcome. Our page does not only meet the basic needs but because we were finished with the coding early, we had time to add extras such as a logo, more PHP functions and a nice design. Of course, we focused on the PHP first, since it is the main part of this project bur once I had it done, we wanted to explore all the other ways we could improve our page.

Looking back at the beginning of the project, I am very happy with the way the planning went on. Tina joined our group a bit later but she helped from the very beginning and was enthusiastic about work and ended up redesigning and improving the welcome page Becky made with Bootstrap, after we decided not to use Bootstrap, from the very scratch. We all contributed logo ideas and Tina did a lot of research on the name. We also all looked into other projects similar to ours to make sure we understood what we were dealing with. We all showed up for our group meetings, except for Rafiel who disappeared after the second one and we stayed in a lot after workshops to work on the project and we all developed a clear idea on what the page was supposed to look and be like. Since my group members said that they were not very secure with coding, I ended up writing most of the PHP for the page though while my group members contributed in other important ways. I did not mind the extra work, but because I came from basically no web design and PHP background, I had to do a lot of research on it but now, I feel pretty secure with it. Of course I know I have only scratched the surface of it and there is way more to learn but I enjoyed the coding. Since the project is about us all understanding the code and working on it though, I also spent a lot of time explaining my group mates how to do things and going through the code with them. Becky then managed to write PHP for the search page as well as code for making the page responsive (she also worked on a report button that we sadly could not integrate) and Tina did the about-us page, did research on anonymity online, wrote a text for the page telling the users what it was supposed to be used for (and what not) and helped me with the design and CSS part. She also stayed in late with me a lot to make sure that she understood how everything worked and we could get it done in time. I also commented all the code so my group members could go through and ask questions about it in case they had not understood anything. Rafiel wanted to contribute doing a ‘like on Facebook’ button but he never replied to our messages again. In general, I think we all improved our knowledge in a lot of different ways but now we should be at a point where we know what is going on with the backend as well as the frontend of our page as well as having a pretty decent understanding of the area our page is in.

Advertisements

Making the page responsive

Eventually we still had to make our page responsive, so it could be used on different devices without any problems. Making a page responsive is an important part of its development since nowadays, a lot of users do not longer stick to only laptops or PC’s to use the internet. According to the Office for national Statistics for example “access to the Internet using a mobile phone more than doubled between 2010 and 2014, from 24% to 58%.” Looking at numbers like this, it can easily be seen how important it is that the user is enables to access the page from other devices.

Originally, Becky wanted to take care of making our page responsive. Since we decided not to use Bootstrap, we had to do more work ourselves but we made the decision so we could not just improve our PHP but also our CSS skills working on the project. Becky started off looking at different resources and gaining knowledge about how to turn an already existing page responsive. But she could not quite figure out how to do it, so she asked for help and I also send her some links and explained what I knew about responsiveness. Since I previously looked into it for a bit as well as talked to the other students, I knew about media queries and how to use them to change the way the page looks like depending on screen size. Becky then did some more research and wrote some code, but she could not quite get it working, so she asked me if I could give her an example of how to use the media query and to help her, I used one of them to make the page responsive to an iPad mini (1024px max width). We thought that once Becky saw and understood the query, she could add more of them. To make the page look nice and usable on a smaller screen, I had to work with spaces and sizes. The layout would change if the screen size was changed, and slip into the new line. Because the header is fixed though, it ended up being really big and cover up the posts. To make the header thinner, I changed the size of two of the buttons. After this was done, the rest would fit into one line and not be in front of the posts. You can see the two versions here:

Before:

Screenshot (315)

After:

Screenshot (299)

I then uploaded the following code onto Github, so Becky could look at the query.


/*Media Queries for making to responsive to smaller screen sizes.*/

@media screen and (max-width: 1400px) {

.box_post_gender {
 min-height: 70px;
 color: white;
 margin: auto;
 font-family:sans-serif;
 font-size: 20px;
 background-color: #4F4F4F;;
 width: 100%;
 z-index: 100;
 top: 50px;
 position: fixed;
}

.box_hello {
 color: white;
 font-family: sans-serif;
 font-size: 20px;
 text-align: center;
 margin-left: 20px;
 float: left;
 line-height: 70px;
}

.box_hello2 {
 display: none;
}

.box_post_gender_content {
 text-align: right;
 margin-right: 35px;
 display: inline-block;
 float: right;
 margin-top: 5px;
}
 
.delete_toggle {
 width: 150px;
 height: 48px;
 cursor: pointer;
 text-align: center;
 line-height: 10px;
 background: #d1404b;
 border: 1px solid #be3b45;
 border-radius: 2px;
 color: #fff;
 font-family: 'Exo', sans-serif;
 font-size: 20px;
 font-weight: 500;
 display: inline-block;
 position: relative;
 left: 0px;
 top: 3px;
}
 
.delete {
 width: 150px;
 height: 48px;
 line-height: 50px;
 text-align: center;
 background: #d1404b;
 border: 1px solid #be3b45;
 cursor: pointer;
 border-radius: 2px;
 color: #fff;
 font-family: 'Exo', sans-serif;
 font-size: 20px;
 font-weight: 500;
 margin-left: 82px;
 text-decoration: none;
}

.delete a {
 text-decoration: none;
 color: white;
}
 
input[type="submit"] {
 width: 60px;
 height: 48px;
 background: #fff;
 border: 1px solid #fff;
 cursor: pointer;
 border-radius: 2px;
 color: #85c14a;
 font-family: 'Exo', sans-serif;
 font-size: 15px;
 font-weight: 500;
 padding: 6px;
 margin-top: 10px;
}

input[type="submit"]:active{
 opacity: 0.6;
}

input[type="submit"]:hover{
 opacity: 0.8;
}
}


Becky worked for a day on the responsiveness for smaller screen sizes. Then she messaged me again, saying that she still  struggled with doing it and that she had only partly made it responsive to one smaller size and that she might not be able to finish it on her own, so she put her code onto Github, so me and Tina could have a look and finish it. I worked on it then using more media queries and in the following, you can see some pictures that show how it turned out. I then updated Github again, so Becky could look at and go through the code.

Screenshot (311)

Screenshot (312)

Screenshot (313)

Screenshot (314)

References:

Part of Internet Access, Households and Individuals, 2014. Available from: http://www.ons.gov.uk/ons/rel/rdit2/internet-access—households-and-individuals/2014/stb-ia-2014.html [Accessed 19th April, 2014].

Unknown, Unknown. Am I Responsive? Available from: http://ami.responsivedesign.is/ [Accessed 19th April, 2014].

Holidays and what I have been doing

Since I was going home for the holidays, my group and I decided to finish most of the project before the Easter break. To do so, we had a group meeting on the last Friday before and because during this group meeting we noticed that a lot of things still had to be done, me and Tina decided to stay at Uni a bit longer to finish the work. During this night, Tina worked on the aboutus.php page and since I had the PHP for our page finished at this point, focussed a bit on the design aspect as well as I helped other course members with their PHP. Beccy could not stay because she had to go home but she said she would take care of making the page responsive. Also, she worked on the PHP for the search engine and because she finished it this day, I integrated it into the page.  At the end of this, we had a functional site with a newer design as well as the aboutus page working.

I then went home for holidays and spent some time ‘cleaning up’ the code, like taking out things we did not need anymore and formatting. I also changed some small things, like replacing ‘ucfirst’ with ‘ucwords’ in some cases, so not only the first letter of the first word would be capital but the first of every word. That was important for example for the locations that consisted of two words instead of one. I then looked through the file on my computer and the one on github and uploaded all the changes I had made. To double check if the github version was working, I downloaded the .zip file and looked at the page using XAMPP. I then did some more edits and in the end, the version was up to date.

After all of this was done and we were sure that we would not make any major additions to the code, I started commenting the PHP. Once I am back, I offered to meet up with my teammates to go through all the code and comments together so we would all have an understanding of everything.

Filtering the posts by location

Since our group had most of the basic PHP finished at this point, we had time to focus on more difficult things to improve the user experience on our page. So far the user was able to set up an account, log in, post, delete their posts, delete their account, look through other posts, see how long ago they were created and where and  if they were created by a female or a male person. Also they could visit the aboutus page to learn about who created the page. To improve the page, we still wanted to add a ‘search by words’ function as well as a ‘filter’ function. To provide more information, Tina also thought that it would be a nice idea to make the about us page a bit more complex. To get those things done, we agreed to each look at one of those things until our next meeting, mine was the ‘filter by location’ option.

What we thought for that was a simple concept. The ‘filter’ page was supposed to be accessed using the navigation bar, Tina originally created for the about us page and I integrated into the other pages. Then another page should appear, looking very similar to the normal ‘posting’ page. Just that the form for posting should be replaced by another form (including a dropdown menu for filtering by location). The html part for that was done quickly, I simply had to create another file (filter.php), integrate another field into the navigation bar and then link them up. Next, I created a new form very similar to the form I previously used when I wrote the code for the posting process, a dropdown menu including all the locations and a submit button.


<form class="sort_place" action="filter.php" method="post">

Only show posts from: <select name="sort" class="dropdown">

                            <option value="">--Select--</option>

                            <option value="talbot campus">Talbot Campus</option>

                            <option value="landsdowm campus">Landsdown Campus</option>

                            <option value="halls">Halls</option>

                            <option value="private accommodation">Private Accommodation</option>

                            <option value="unilet">Unilet</option>

                            <option value="town">Town</option>

                            <option value="none">None</option>

                        <input type="submit" onClick="redirect();" />

                        </select>

                    </form>

I also integrated the navigation bar into the new file so it would also be accessible from the new page and enable to user to navigate back to the ‘posting page’ or to any of the other pages and wrote some css to make it all look nice. But it still would not work because the PHP was missing.

I did some research even though I had quite an idea of how I could get there but I wanted to make sure. I read some threads on Stackoverflow where other people were asking questions very similar to me and looked at the suggestions they got but they did not really got me to where I wanted to get. I will reference some of them at the end of this post though.

After that research, I started writing my own code.  It ended up not being that complicated and looking back at all the hours I have spent doing research and coding in PHP I noticed my improvement. During all this time, I gained knowledge and doing this last bit of coding, I felt way more secure with what I was doing than in the beginning. Of course I still ran into some errors but they were not as big as the ones before and fixed fast. In the end, I worked exactly the way I wanted it to, showing a page with the results once accessed and then filtering them once the form is submitted. I used an if statement for that. To show the results of my search in boxes exactly like the ones on the ‘posting’ page, I created another file (box_search.php) exactly like box.php and did another while look linking to it. In the end it showed the results perfectly. In the following you can see the PHP code for it:


<?php
 if(isset($_POST['sort'])) { //Only if the form above is submitted.
 $sort = $_POST['sort']; //Declaring the variable $sort.
 $query = "SELECT * FROM posts WHERE place_of_post='{$sort}'"; //Query to get all the results for the selected place. 
 } else {
 $query = "SELECT * FROM posts"; //If no place is selected, show all. 
 }

 $result = mysqli_query($connect, $query);
 
 while($row = mysqli_fetch_assoc($result)) {
 include 'box2.php'; //The while loop is used to include the file box2.php for each post matching the criteria.
 }
 ?>


References:

Mack, Kt. 2014. PHP Mysql query – allow user to filter results. Stackoverflow. Available from: http://stackoverflow.com/questions/21349161/php-mysql-query-allow-user-to-filter-results [Accessed 30th March, 2015].

Xalkia, S., 2013. PHP filter mysql results. Stackoverflow. Available from: http://stackoverflow.com/questions/14387684/php-filter-mysql-results [Accessed 30th March, 2015].

Uploading code

After we created the folder structure and some code in our workshops, we could start using our freshly created GITHUB repositry. It was a bit tricky to figure out how to upload the code since I have never used GITHUB before. But after a while, I think I figured out a way to do it and uploaded all the files.

Screen Shot 2015-02-26 at 10.49.07

Screenshot (202)

Link to our repositry: https://github.com/i7674769/Group-project