![]() |
|
#1
|
|||
|
|||
Include by new PhP workerI want to have different parts of my page (which are the same on every one) loaded by an include command.
For me this is new and i want to learn hot to make such. What i know till now: For my page i want to have a 'header', a 'footer' and a 'mainlink' that is repeating on every other page in the same way. How to make such: I made the html for the header, footer and mainlink in wordpad and safed it into header.php.txt (etc for the other two) I uploaded this and put it into an include folder in my hdocs. Next i renamed the files and skipped the .txt so now all are name.php ---- What i not know is if i have to make such with only the code that i want to include or is it so that i have to make these files like a normal page (with head, etc in the code)? ---- The page where i want to include these .php files is a next step for me and what is the best for me to do? Can i make them in a normal editor or do i have to make such also in wordpad and rename them on the server into .php? ---- The pages are for several levels of the site and is there a way to make one kind of include so i can use this without changing every time the path to these .php files? I hope you can give me the push to proceed. |
|||
|
#2
|
||||
|
||||
|
I'm hoping I'm answering your questions:
I'm giving you an example of how you're wanting your include()s to work Quote:
Quote:
Quote:
And the index.php page that includes all these files will be like so: Quote:
There is nothing stopping you putting PHP code into any of the .inc files that you include, this will be run also! You don't have to call the included files anything special, .txt will work just fine. For your last question, try finding out the absolute path to the include files. On a Unix webserver, it may be something like /usr/www/sitename/header.inc. This file path will work no matter which directory the php script is in. Hope I've helped Garth Farley |
Recent GIDBlog
Once again, no time for hobbies by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Optimizing your web server with Turck MMCache for PHP | JdS | Web Hosting Forum | 2 | 07-Jan-2004 08:48 |
| apache2 - php cgi fehler - schleife | inna | Apache Web Server Forum | 8 | 27-Nov-2003 10:55 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 09:40 |
| [script] Password Protect web pages/site using PHP and MySQL | JdS | PHP Code Library | 0 | 23-Jul-2003 11:02 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 17:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The