From the course: Getting Started as a Full-Stack Web Developer
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Break the site into modular pieces
From the course: Getting Started as a Full-Stack Web Developer
Break the site into modular pieces
- [Instructor] Before moving on to add more functionality to the site, I want to address a structural issue. The site is all in one big index.php file. That's fine as it is, but when I add new pages, I'll want some elements to be the same. Switching over to the browser, I want to keep this reservation bar and also this menu bar here, scrolling all the way to the bottom. I want to keep this footer as well. But if I just copy and paste those elements into new files, any changes I want to make will have to be repeated in every file. So instead, I'm going to break it up into pieces and let PHP assemble pages on the fly. Let's go back to the code editor to figure out which sections of code correspond to those parts of the webpage. Fortunately, many code editors, including VS Code, have a feature called code folding that makes such divisions visually clear. I'll scroll up to the top to show you. So you see this head section…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.