| | |
include files
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: May 2009
Posts: 10
Reputation:
Solved Threads: 0
Greetings,
I'm new here and new to php. I've always just written in basic html but now want to utilize global header, footer, and left nav bar. From what I've seen I should be able to accomplish that with php.
(My contact with siteaction suggested that I use Frames, but from what I've seen online about them, I'd like to stay away from that option.)
I dropped the code into a test index and uploaded a "header.php" but it didn't pull into my index_test.html.
My site host, siteaction.com is supporting php and mysql, but I have not anything other than upload the files to my directories.
Now, if I can somehow accomplish this with html that's fine too.
Thanks in advance for any help you can give me. toddsmith
I'm new here and new to php. I've always just written in basic html but now want to utilize global header, footer, and left nav bar. From what I've seen I should be able to accomplish that with php.
(My contact with siteaction suggested that I use Frames, but from what I've seen online about them, I'd like to stay away from that option.)
I dropped the code into a test index and uploaded a "header.php" but it didn't pull into my index_test.html.
My site host, siteaction.com is supporting php and mysql, but I have not anything other than upload the files to my directories.
Now, if I can somehow accomplish this with html that's fine too.
Thanks in advance for any help you can give me. toddsmith
In a header file, say header.php, include the HTML you want to have in the header – only the chunk of HTML you plan to insert into the bigger page.
Next, in the index file, use PHP's "include" function to insert the contents of header.php in the appropriate spot like this:
Depending upon your server setup, your index page will probably need to have a the .php extension, ie index.php, otherwise the PHP code won't be parsed and executed.
Hope that's helpful.
Next, in the index file, use PHP's "include" function to insert the contents of header.php in the appropriate spot like this:
<?php include("header.php"); ?> Depending upon your server setup, your index page will probably need to have a the .php extension, ie index.php, otherwise the PHP code won't be parsed and executed.
Hope that's helpful.
Last edited by coppercup; May 28th, 2009 at 10:39 am.
Thanks! Fritz Green
Pedants of the world unite!
Pedants of the world unite!
If you add this line to your .htaccess file:
AddType application/x-httpd-php .html .html pages will be able to execute .php commands.
www.beeerlover.org <- my hobby with 15K+ Pink Floyd Images
www.bestbridalprices.com <- my job with 15K+ Wedding Dresses
www.bestbridalprices.com <- my job with 15K+ Wedding Dresses
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: May 2009
Posts: 10
Reputation:
Solved Threads: 0
•
•
•
•
and every html file will be parsed as php adding a large unneccessary overhead to the server
I'm not sure exactly what that means, but I want to keep everything as lean and efficient as I can so it sounds like working with all .php pages is the best solution.
Thanks to all for the suggestions and help. I've never joined a forum like this before because I've always been a "learn as I go" developer (and I use the term loosely) and I've seen been to embarrassed to show how little I really knew.
Thanks for the help and allowing me to build a better site and learn from you all.
todd smith
Actually, I believe he means that ONLY pages that contain PHP code should have .php extensions, so that the PHP gets processed, while HTML files free of PHP code should be saved with .htm or .html suffixes so that they won't be processed by PHP.
By default, most servers will recognize a .php file extension and be sure that the contents of that file get parsed and processed by the PHP engine before they are delivered to end user's browser. Regular HTML files do not need to be run through the PHP engine.
Technically, I should have told you to name your header file header.htm so that it would not be parsed as PHP, but we frequently include PHP code in our headers, nav bars, footers and similar included "parts" of the page, so we are in the habit of giving these "included" files the .php extension. For example, we often have dynamic login information in the header that is handled by PHP code.
Anyway, hope this is helpful info!
By default, most servers will recognize a .php file extension and be sure that the contents of that file get parsed and processed by the PHP engine before they are delivered to end user's browser. Regular HTML files do not need to be run through the PHP engine.
Technically, I should have told you to name your header file header.htm so that it would not be parsed as PHP, but we frequently include PHP code in our headers, nav bars, footers and similar included "parts" of the page, so we are in the habit of giving these "included" files the .php extension. For example, we often have dynamic login information in the header that is handled by PHP code.
Anyway, hope this is helpful info!
Last edited by coppercup; May 29th, 2009 at 2:13 pm.
Thanks! Fritz Green
Pedants of the world unite!
Pedants of the world unite!
I meant, what coppercup wrote
keep your html only pages as .html and the php pages as .php
server delays between ,
html d/l directly
or
html parsed through php looking for <?php ?> before being d/l
become significant
adding unnecessary directives to the server, slows it,
server is fast, its not infinite.
keep your html only pages as .html and the php pages as .php
server delays between ,
html d/l directly
or
html parsed through php looking for <?php ?> before being d/l
become significant
adding unnecessary directives to the server, slows it,
server is fast, its not infinite.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
Similar Threads
- include files and SOAP (RSS, Web Services and SOAP)
- Include h files (C++)
- how to tell compiler to look in specific folder for include files? (C)
- How to set up include file for navbar (HTML and CSS)
- the difference between include and require (PHP)
- can't link to included files... y? (C++)
- Need Help with Side Nav Include (PHP)
- Do #include files get cached? (HTML and CSS)
- Linking files for Compilation in C++ Data Structures (C++)
Other Threads in the PHP Forum
- Previous Thread: Help with code please?
- Next Thread: Php insert to html
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube






