![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jan 2007
Posts: 108
OS: window XP
|
Create php Web site using template
I would like to know how to create a customizable php web site that using a template.
I did create a php web site before that using a template. The logic for the web site is like this: 1) First, I create a web template. Example, the name is "template.php" 2) Then I create the main page content for the web site named "main.php". 3) Then I create an index file. File name is "index.php". So, It work like this. In the index.php, it will include the file main.php and template.php. Example code for template.php <html> <head> <title>New Page 1</title> </head> <body> <table border="0" width="100%" height="32"> <tr> <td width="100%" height="7">banner here</td> </tr> <tr> <td width="100%" height="13"> <?php include($content); ?> </td> </tr> </table> </body> </html> Example code for main.php <html> <head> <title>main page</title> </head> <body> Here is the content for main page </body> </html> Example code for index.php: <?php $content = "main.php"; include("template.php"); ?> ------------------------------------ This site work well if you have a few page for your site. If your page increase, we need to add php swith command to the index page. But that is the inefficient come, if your page content hundred of page, then need to add hundred of php switch command to check which page to load. So, any others way to create a customizable web site that using template? Hope you guy can understand |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
|
Re: Create php Web site using template
You can call the content up through a variable. I do this on my website and other sites that I've made, actually.
So you can make it like this: index.php?p=contact contact.php is pulled into the middle of the page. At the top of index.php, I put this: PHP Code:
People could do the above and basically take over your server. So that's why we clean up the variable and get rid of everything in "$remove" ... it's also a good idea to turn "allow_url_fopen" off so people can't open malicious text files through an off-site URL. Ensure that you've modified "open_basedir" as well - it should be set for your account, that way nobody can execute a script that is not on your server/account. Okay, so where you have the include, this is what I do: PHP Code:
I hope you get what I'm throwin' at ya ;) |
|
|
|
![]() |
| Thread Tools | |
|
|