Jump to content
Killersites Forums

Beginners Questions


Virtual-Instructor
 Share

Recommended Posts

To go over MVC briefly:

 

-- The "C" in MVC stands for "Controller". It takes any user input and chooses what models to call and what views to display

-- The "M" stands for your models. The model contains functions used by the controller. Ideally, the models should contain the bulk of your code (I've heard it said that it is good practice to have "light" controllers and "heavy" models.) Models often deal with retrieving data from the database.

-- THe "V" stands for "views". This contains your HTML/CSS code, and snippets of PHP where you want PHP variables to display within the view.

 

Exactly what models, views and controllers you have depends on your application structure. However, I personally like to split up my controllers/models/views (assuming that I am not duplicating any code though), so I may have a separate models for members/nonmembers, and different views for members/nonmembers. If the pages you will show your regular site visitors and the page that logged in members see will be different, yes, you will have different views.

 

Does that help?

Link to comment
Share on other sites

To go over MVC briefly:

 

-- The "C" in MVC stands for "Controller". It takes any user input and chooses what models to call and what views to display

-- The "M" stands for your models. The model contains functions used by the controller. Ideally, the models should contain the bulk of your code (I've heard it said that it is good practice to have "light" controllers and "heavy" models.) Models often deal with retrieving data from the database.

-- THe "V" stands for "views". This contains your HTML/CSS code, and snippets of PHP where you want PHP variables to display within the view.

 

Exactly what models, views and controllers you have depends on your application structure. However, I personally like to split up my controllers/models/views (assuming that I am not duplicating any code though), so I may have a separate models for members/nonmembers, and different views for members/nonmembers. If the pages you will show your regular site visitors and the page that logged in members see will be different, yes, you will have different views.

 

Does that help?

 

 

Sort of. I still feel like I'm half way between understanding and diving head first into OOP, because that what it seems like.

Link to comment
Share on other sites

I can't remember exactly where you are in the lessons... Have you done my OOP/MVC login tutorial? I'm assuming that's what you are working with at the moment?

 

Personally, it took me a while to grasp OOP and MVC, so you may just need to give it some time. The more you practice and work with it, hopefully the easier it should get.

Link to comment
Share on other sites

I've completed the PHP Login videos, and truth be told it wasn't all that difficult. I'm still having some issues with the MD5 and Salt with the login, but I think I have a pretty good grip on things. I think the big problem is trying to figure out how to maintain that login across all the pages so that I can use the ratings to control who can and cannot have access to certain pages and controls.

 

I thought I was doing pretty good this weekend when I finally solved some of the dbase problems that I have been dealing with and imporved the way information is stored in the dbase. But the more I think about this stuff them more I see it as like squares on a game board. You know if you land on square one you can do one thing, but if you land on a different square you may or may not be able to do the same thing that you did on square one. It kind of makes scense but its still a little confusing.

 

In terms of where I am in the training, I just finished the shopping cart and will be starting the OOP discussion with Steph this week sometime when I don't have to work every second of the day. I have to say, for what I am building, I found the shopping cart videos to be absolutely useless. They may come into play later as the site grows, but for the moment it seems like a complete waste of time.

 

I am hoping that the OOP and OOP Login lessons prove to be more informative, but as I said, all this information is great, but unless I can figure out how to put these pages together in the way that I have envisioned, its a bit on the pointless side.

 

I will say this much for you guys, you sure do make it easy to learn this stuff; I'm really looking forward to buying into the University.

Link to comment
Share on other sites

I think the big problem is trying to figure out how to maintain that login across all the pages so that I can use the ratings to control who can and cannot have access to certain pages and controls.

Unfortunately, I don't believe my OOP Login videos cover permissions. It's on my list, I've just been busy with other things. However, my non-OOP login series (within the KS Video Tutorial Library -- PHP > PHP Login) does cover the basic concept. Videos 17 and 18 cover user permissions. It probably isn't necessary for you to watch the entire series just for those two videos. As long as you get the overall concept, that's the important part.

 

Implementing some sort of permissions system shouldn't be that difficult. Within your database, you'll need to have some sort of "user level" column within your members table that defines what type of member that member is (for example, you might have a "regular" member and an "admin" member). When logging the person in, you would query the database and get the user's level and store it within a session variable. Anytime you need to figure out what content to display to the user, you can check the session variable, figure out what type of member the member is, and display the appropriate content.

 

I have to say, for what I am building, I found the shopping cart videos to be absolutely useless. They may come into play later as the site grows, but for the moment it seems like a complete waste of time.

If you aren't building something that requires a shopping cart or PayPal integration, then no, watching those videos isn't necessary. Personally, I'm surprised you watched those videos in the first place if the main items they covered wouldn't be useful for the application you are building.

Link to comment
Share on other sites

Implementing some sort of permissions system shouldn't be that difficult. Within your database, you'll need to have some sort of "user level" column within your members table that defines what type of member that member is (for example, you might have a "regular" member and an "admin" member). When logging the person in, you would query the database and get the user's level and store it within a session variable. Anytime you need to figure out what content to display to the user, you can check the session variable, figure out what type of member the member is, and display the appropriate content.

 

I figured it would be something like that. However I'm more concerned with form and site administration. I.E. I already have a ratings system in place and there are certain functions that are available only to senior staff. That is where the real big restrictions will come into play. I figure that if I can maintain the login ID, I can simply run a query on the dbase before the function runs to make sure they have the right access level, then just use an if/else statement.

Link to comment
Share on other sites

I figure that if I can maintain the login ID, I can simply run a query on the dbase before the function runs to make sure they have the right access level, then just use an if/else statement.

Sounds about right. Though if you store their user level in a session variable, you don't have to make a database call anytime you need to check their user level. At least as far as I understand it, the fewer database calls you need to make, the better.

Link to comment
Share on other sites

Unfortunately, they are only available to view, not to download.

 

I'm not sure that I like that.......I have such limited time to begin with that sometimes I will go two weeks without doing anything. Which naturally begs the question. Where do I begin? There is so much information here and I want to be able to go back later an reference the infromation. I have pretty deep pockets, but I don't know if I should go with just one or a combination of two.

 

Any thoughts?

Link to comment
Share on other sites

I'm not sure that I like that.......I have such limited time to begin with that sometimes I will go two weeks without doing anything. Which naturally begs the question. Where do I begin? There is so much information here and I want to be able to go back later an reference the infromation. I have pretty deep pockets, but I don't know if I should go with just one or a combination of two.

In that case, you may be better served purchasing one of the other video packages that allow you to download and view the videos later. Another alternative, though, is to purchase the 3 month option, see how much you use it, and cancel or renew based on how often you were able to use it. (Keep in mind that the subscription automatically renews though.)

 

Realistically though, if you purchased the Complete Web Programmer course, you have nearly all of the PHP videos that KillerSites offers. Definitely make sure you check out the KillerSites Video Tutorial library and ensure that it has the sort of videos you are interested in.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...