| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Senior Member | Simple PHP Question Hello, I've had a web page going for a little while now using very basic PHP (includes). However, the way I'm doing it seems rather inefficient compared to other sites I've worked on (but not built) before. http://scca-racing.com/ As you can see, every page with content on it (with the exception of the forum) uses the same basic page template -- the header, left side, background, content area, and the copyright area. Right now, I have a basic "framework" for each page, that is simply the blank squares of each section. Where the main content area is, I have it including a page from my includes/ folder, which is just the content displayed there. For example, on the Cup Series standings page: In my root directory I have cupstandings.php, which is the "framework" of the page that has an include to includes/header.php, includes/left.php, includes/copyright.php and includes/cupstandings.php, which is the content of the page. Is there a way to simplify this process of creating a new framework page and only changing what one div layer includes for each page? I'd really like to just have one framework page that displays whatever content I ask it to. For example, if I have a file "octopus.php" in my includes/ folder, I'd like to be able to type in a URL that is actually the "framework" of that page with "octopus.php" as the content, sort of like "http://scca-racing.com/index.php?page=octopus.php" or something of that nature. I don't really know what I'm talking about, but hopefully someone with more PHP knowledge than I have knows what to do. I've seen it done before, I just can't do it. Any help or advice is greatly appreciated! ![]() Thanks, Steve |
| |
| | #2 (permalink) | |
| Senior Member | Quote:
Just edit $var in the top ($header = "HEADER HTML GOES HERE" , and the same for the rest. When you go to index.php?page=octopus it will show the header/side bar/footer and will say Welcome To octupus page!Let me know if that's what you were looking for. Thanks.
__________________ || VPSByte Virtual & Dedicated Solutions || True 24/7/365 support with a 1 hour guaranteed response time! || We offer budget, yet powerful dedicated servers and vps solutions. || All servers come w/ 10Mbps unmetered bandwidth & lite management standard. | |
| |
| | #3 (permalink) |
| NamePros Member | would what you could do is is make one page (index.php) that holds the standard non-changing stuff like: header, footer ect. and make separate little files for the content (variable) part. then you could include the file needed, depending on the page that was called like this: in index.php you then place this where you want the content to show up: PHP Code: main.php: HTML Code: Welcome to xxx.com. Please take the time to browse around ! HTML Code: This is the news section of the site ! kind of like the way StackedTech allready explained. This may not be the most efficient way to do things but it is a way Hope I explained that clear enough...
__________________ Directory Bids | ArcadeCharts.com | Play Arcade Games CasinoPremiums.com | DrmRemover.com | InsuranceBasic.com | Pedicure.cc | 32-bit.com | BearDolls.com |
| |
| | #5 (permalink) | |
| Senior Member | Quote:
StackedTech and Ms Grace, I was able to get things exactly the way I want them, it's as efficient as I need it to be, and it's very simple. Thanks a lot, rep coming your way! | |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |