mdedens Posted April 7, 2004 Posted April 7, 2004 Hi, With my last host, I used SSI's on my site. The pages that end in .shtml work great. But I also changed the header and footer of my forum. And I wanted to include the same header and footer as in my other pages. since the forum is php, and up a directory, I tried this: <?php require("../copyright.txt"); ?> But my headers and footers aren't showing up. So I tried the .shtml way: <!--#include virtual="../copyright.txt"--> That didn't work either. So I tried lengthing the ../ to 2, 3, 4, and 5 times but that didn't do it either. Any suggestions? Quote
MikeJ Posted April 7, 2004 Posted April 7, 2004 (edited) The appropriate syntax for PHP includes is: <?php include("../copyright.txt"); ?> For .shtml method, the file extension of the file you are putting the include in has to be .shtml unless you change the handlers for that (but that would break the pages if they are PHP). Edited April 7, 2004 by TCH-MikeJ Quote
mdedens Posted April 8, 2004 Author Posted April 8, 2004 Hmm, this was the say it was setup on my last host, but I must be doing something wrong here. If I may explain the way it's setup, maybe I can figure out if it's an error in my coding or a server setting...? the page I want to include is at: kastiron.com/copyright.txt I installed a forum at: kastiron.com/forum The page that I've placed the Include on is at: kastiron.com/forum/templates/subSilver/overall_footer.tpl Here is the include tag: <?php include("../copyright.txt"); ?> because the page is called from 1 directory up at kastiron.com/forum But nothing shows up... no errors, just nothing there. I've also tried <?php include("../../../../copyright.txt"); ?> but that's not working either. Is this making any sense... sorry to be a bother about this, I'm just not sure what's wrong. Quote
boxturt Posted April 8, 2004 Posted April 8, 2004 Would this work? <?php include $_SERVER['DOCUMENT_ROOT']."/copyright.txt"; ?> Quote
mdedens Posted April 8, 2004 Author Posted April 8, 2004 That's a good idea, I would think that would work! But it didn't work either frustratinggggggggg. bleh. hehe, sorry I can't figure this out, has anyone ever tried using includes with their forum for custom headers/footers? Quote
borfast Posted April 8, 2004 Posted April 8, 2004 (edited) mdedens, include() or require() work the same way, the only difference is that if include() doesn't find the file you specify, it will go on, while require() will stop the execution of the script. EDIT: Sorry, I messed up my mind and answered with something completely useless for the discussion... Anyway, the problem is that you're trying to use PHP in a phpBB template file. Template files contain only HTML and template code. No PHP in them. A possibility would be to use a template funtion to include other files into the template but as far as I know, phpBB's template language doesn't such have a function. Still, you can add the content of copyright.txt to the template file manually. Just copy/paste it into the place you're using the include() function and it should be just fine. Let us know if it works. By the way, I'm moving this to a better forum. Edited April 8, 2004 by TCH-Raul Quote
mdedens Posted April 8, 2004 Author Posted April 8, 2004 Ok, I can do that... I just found it odd that I WAS able to do this at my last host with the 'require' code. I just don't understand why, that's all. They must have php or something else configured differently. I dunno... oh well, it's just that it's a couple more pages to change, when I add and subtract stuff from my headers and footers... Quote
TCH-Don Posted April 8, 2004 Posted April 8, 2004 Your other option is to force your html pages to be parsed for php. See this post about adding php handlers to apache This may be what you had befoer. Quote
borfast Posted April 8, 2004 Posted April 8, 2004 mdedens, perhaps you can contact your old host and ask them how that was possible? Even I got curious about it. Quote
mdedens Posted April 8, 2004 Author Posted April 8, 2004 (edited) Hi, Thanks for the help, I had to do things a bit differently though, and it's still not working My apache looks like this... when i added the .shtm .shtml application/x-httpd-php it stopped my .shtml pages from using includes. So I just typed in "server-parsed" and they work again. So I tried the .tpl ext but still not working. User Defined Handlers .htm .html server-parsed .shtm .shtml server-parsed .tpl server-parsed cgi cgi-script pl cgi-script System Defined Handlers .cgi .pl cgi-script .shtml server-parsed I talked to my old host, but there's a reason they're my old host, they have little to no support. The only thing they told me they used to get this to work was "mod-rewrite" Whatever that means. When I pressed for more info they said: Tech: for SSI to work Tech: you need following handler Tech: AddType text/html .shtml .html .htm Tech: AddHandler server-parsed .shtml .html .htm Tech: Options Indexes FollowSymLinks Includes Doens't make much sense to me yet... Here is a link to the old forum on their server and the header's and footer's are still working there: http://df03.dot5hosting.com/~admin252/forum/ I dun't get it yet. Gonna keep experimenting though. Edit by TCH-Raul: I edited your post so there was no live link to a competitor Edited April 8, 2004 by TCH-Raul Quote
mdedens Posted April 9, 2004 Author Posted April 9, 2004 Sorry about the link... Thanks for everybody's help,,, I suppose I'll just have to try submitting a support ticket for this. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.