The point of the website is to show different foods, lets say from the fridge, and let people rate them.
The system will use two IDs
- Food_ID
- User_ID(divided into Admin and Average user)
There would be 2 databases.
Food database:
- Food_ID
- Name
- Bio(well, if you want to tell a story about where you got the egg, like from a farm or shop. or special features)
- Ratings
- Expiring date
User database:
- User_ID
- User_Type(Admin, Average user)
- Name
- Bio/Info(Bio and other user related info, like day of creation)
- Rating history
Also tables:
- Main raiting page
- Personal rating page
- Expiring table
Now that the parts have been laid down, how does it all come together:
As said before, the system will mainly use two ID-s. First of all Food_ID. This is used to recognize the food that is being rated. A table, which users can see, will send the request to the database and retrieve the information for the required food_ID. The Ratings used in that database, will use the information(ratings) given by the users and record em in the database. After a certain amount of time, the ratings will be updated by simply calculating the mean( the sum of ratings given / the sum of ratings = Answer).
The expiring date will be used as a trigger. If the item has past the expiring date for a day, it would be removed from the table.
Now this is where the Food_ID makes its biggest play. On to the User_ID
The User_ID also retrieves information from the database. Now, depending on the User_type, Admins and other users will see a slightly different tables. The average user will see the name of the food, expiring date, rating(of the food) and a field, where they can put their own rating. The ratings themselves, as said before, are related to the Food_ID. Now all users have their own rating page, where they can see and change their past ratings. It works like this: When a user has rated an item the Food_ID of that item will go into the user’s Rating history. Every time a user views the main table the Food_IDs in his rating history will not be displayed. On the personal rating page, there will be a table which shows only those foods which the user has already rated for(like the name implies).
With the Admin, it’s a little bit different. First of all the Main rating page has a extra field, where the Admin can add items. This will be a row, which has empty spaces in the places of data.
In the Personal rating page, there will be the same rating table, like the average user has.
The Admin will also have an Expired food table where the foods, which have passed the “one day over expiring date” line, will be displayed. From that table, the Admin can delete the items from that table and thus from the entire database. This helps the admin to keep on eye on the things they have, for example: Mom can see which foods have expired in the fridge.
So this is kind of it, I hope it makes sense 😉
Paavo Viilup 19:13 on May 8, 2011 Permalink | Log in to Reply
Make it so.
alex 18:04 on May 10, 2011 Permalink | Log in to Reply
I have a two questions at the moment. My first question would be that in my index file I have the logged in function whether it is true or false. When it is true all of the pages can be accessed but when it is false then only the login and register pages are accessible. Now the problem is that when it is false and I want to display only the login and register pages then I want to do this without the navigation. At the moment when i turn it to false then the navigation is also there and is disturbing. I also shared the whole thing with you in dropbox if you want to have a look at it. The second problem is that on the so to say userpage when I want to go to the second page then it goes to the home page. I can’t seem to pinpoint the error. Maybe you can find it and tell me.
Joel L 18:14 on May 10, 2011 Permalink | Log in to Reply
If you don’t want to show the navigation for non-logged-in users, just use:
<?php if ($logged_in) { ?>
# navigation menu
<?php } ?>
Remember, if statements have to be used whenever you want to show/change something based on some condition.
—
“The second problem is that on the so to say userpage when I want to go to the second page then it goes to the home page.”
What “user page”, what “second page”?
Please use the names that you use on your php page, so I’ll understand a bit more! 🙂
alex 18:23 on May 10, 2011 Permalink | Log in to Reply
I am not sure I understand the first solution in using a id for the navigation menu 😀 I know I am dumb 😀
But the second problem is that on the webpage when you go to the friends frides page then by clicking on a friend it opens up the userpage or the friends fridge and on that page there is a button next to go to the second page. The first page is userpage.php and the second one is userpage2. I have referenced in userpage to go to userpage2 by clicking next but for some reason it takes me to home.php.
Joel L 18:30 on May 10, 2011 Permalink | Log in to Reply
re: using #id – wordpress ate the php tags and I didn’t notice at first. Fixed now.
re: userpage2 – you must add it to the $allowed_pages array.
alex 18:38 on May 10, 2011 Permalink
K got it working thanks a lot, but is it okay or what is it lacking just to know what to add there or improve?
Another question too. Is it possible to implement the code in a way that when somebody clicks on the login button and then gets logged in so that a person does not have to change the logged_in statement? Or is a database needed in order to do that?
One more. As you have noticed that every item that you click brings you to a rating page. The only thing is that I have not figured out how to make it so that if you click on a food item then it takes you to that specific food item and lets it rate that. Basically only the picture and info have to change. Any ideas?
Joel L 18:59 on May 10, 2011 Permalink
Well, does the page have all the functionality you want? For example, where’s the search results page?
Is the food category menu always visible? Even on the login page? Why? Why not?
Why are links in the My Friends table not identifiable as links? Why are the emails not clickable?
If I click a category, what do I see? Are these food items in my fridge only? Or all fridges in the system? How do I know which?
Just keep polishing existing functionality, don’t worry about login code yet.
Joel L 19:09 on May 10, 2011 Permalink
Re: different food items – we’ll come to that later.
Sander 19:11 on May 10, 2011 Permalink | Log in to Reply
Not wanting to keep my user pages as facebook pages, i started creating separate user pages. To access these pages, I need to perform arrayception. Namely, on the user page (not the wrapper anymore) i need to have another array of pages and some more PHP code. So how do i shot w- i mean, how do i get the pages to show up? Right now, I have Silver’s page in a separate users folder (the PHP actually works, go figure), but when i try to see his profile page, the home page is shown instead.
Joel L 19:20 on May 10, 2011 Permalink | Log in to Reply
And where might I be able to see your code?
Sander 19:21 on May 10, 2011 Permalink | Log in to Reply
It’s on my USB stick! (putting it on dropbox atm)
Sander 19:36 on May 10, 2011 Permalink | Log in to Reply
Btw, the problem is most probably on the “friendz.php” page
Joel L 19:47 on May 10, 2011 Permalink | Log in to Reply
If you go to ?page=friendz&user=Usersilver, then
1. The friendz.php page is included
2. The friends page includes the silver page.
But:
If the index.php page includes the friends page, and both start with , then the resulting page has a structure like:
html
—body
——div.smth
———–html
—————body
and this is… err, wrong.
Please review the original sample I made.
The pages that you include into index.php must only have the fragments that change, not the entire html page structure.
Sander 19:53 on May 10, 2011 Permalink
Hmmm…so how bad is it if i leave in the facebook integration (for users) ?
Joel L 20:03 on May 10, 2011 Permalink
integration == links?
Sander 20:07 on May 10, 2011 Permalink
Pretty much, yeah. Or could i just copypasta a nifty facebook plugin of some sort?
Joel L 20:10 on May 10, 2011 Permalink
First, make everything else work perfectly!
Sander 20:14 on May 10, 2011 Permalink
What’s missing?
Anyway, I’ve removed all of the unnecessary tags, but I’m still rather hazy on how to make the actual user specific page show up….
Joel L 20:19 on May 10, 2011 Permalink
fixed it for you.
$allowed_users vs $allowed_pages.
i.e. if you copy-paste stuff, make sure to also change things…
Silver 15:26 on May 11, 2011 Permalink | Log in to Reply
Shared…
better late then never, right?
Joel L 18:17 on May 11, 2011 Permalink | Log in to Reply
no