|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Includes with .html...
my knowledge of php is limited as of lately but im on a huge crunch with a website i need to make.
its quite large so i want to use php includes but the problem is i cant use .php for the content pages. so i dont know whats possible out there these days but does anyone have some ideas? is it possible to make 1 php page with header/menu etc and then call out the content .html page in the menu and then have it load to a certain place on the page??? i remember doing this for photos and short text but not for whole pages..... any suggestions would greeatly help in my brainstorming!! thanks |
|
#2
|
||||
|
||||
|
why can't you use .php as the content page? IIRC you can set the apache config to handle the .html or any other extension to be php.
and maybe what you are looking for is templates.
__________________
life is a game.... Have fun ----------------------------- http://www.phpwomen.org strength in unity PHPCommunity IRC #phpc on freenode |
|
#3
|
|||
|
|||
|
not sure why you cant do includes, but try this
if you can't do includes, here is an alternative you could try:
PHP Code:
This should be the same as doing an include. |
|
#4
|
||||
|
||||
|
depends - that will not include a php file as if it is native to the code - it only echos out the php code.
|
|
#5
|
|||
|
|||
|
My suggestion would be to use mod_rewrite for this. I recently took over maintenence on a website with tons of legacy content. To get all of it to conform to the new layout, I wrote a PHP "engine" of sorts, and a mod_rewrite rule. Anytime someone called an html file directly, I would take that html, strip out everything between the body tags, and plop it into my layout. Works pretty well.
__________________
Errors have been made. Others will be blamed. Group Member, Dallas PHP Users Group <b>(DPUG)</b> --... ...--, Eric |
|
#6
|
|||
|
|||
|
the content pages need to be .htm for the site editor to work (stupid i know but gotta work by the rules).
i was thinking is it possible to have 1 php page and in the menu when it links to a page have it instead call that page into a certain place on the page? my php skills are very very rusty, infact i have little idea what to do anymore ;) thanks for any help! |
|
#7
|
|||
|
|||
|
Quote:
how did you go about doing this if i may ask... i dont know much php, would you mind sharing the code? |
|
#8
|
|||
|
|||
|
Sure. It is still a bit simplistic, and crude, but here is the code:
First, in my .htaccess file, I did this: Code:
RewriteEngine On RewriteRule ^([^/]*\.html) \ index.php?page=$1 [PT] What the above does is takes all pages with a .html extension, and sends them to index.php. index.php looks like this: PHP Code:
The last couple of lines are my implementation of a templating engine tutorial I came across on this website. |
|
#9
|
|||
|
|||
|
way to fopen as native code
PHP Code:
Instead of echoing back the content, you can instruct PHP to evaluate the string as if it were native php code: PHP Code:
Last edited by sabian_drummer : August 20th, 2007 at 11:12 PM. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Programming Theory > Includes with .html... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|