From the course: PHP with MySQL Essential Training: 2 Build a CMS

Unlock this course with a free trial

Join today to access over 25,600 courses taught by industry experts.

Scope page position by subject

Scope page position by subject

- [Instructor] So far in this chapter, we've learned how we can nest our pages underneath our subjects. And in the last movie, we talked about how we can more efficiently count the number of pages that belong to each subject. I now want to take those two ideas and combine them together to talk about how we scope the page position by its subject. You may or may not have noticed that we actually have a problem in our current code. If we go to one of our subjects, we view the pages and then I click on one of the pages to edit it. If I look at the position listing, you'll see that I have 13 different positions available. Why is that? Well it's because I have 13 different pages, but that doesn't seem quite right. It seems like instead that I should have positions one, two, three, and four, right? That it should be scoped by the subject. And then for another subject, such as over here on consumer, I ought to have positions one, two and three, right? I should never ever run into a case where…

Contents