Ssi

liunx

Guest
Hi,<br />With my last host, I used SSI's on my site. The pages that end in .shtml work great.<br /><br />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:<br /><br /><?php require("../copyright.txt"); ?><br /><br />But my headers and footers aren't showing up. So I tried the .shtml way:<br /><br /><!--#include virtual="../copyright.txt"--><br /><br />That didn't work either. So I tried lengthing the ../ to 2, 3, 4, and 5 times but that didn't do it either.<br /><br />Any suggestions?<!--content-->
The appropriate syntax for PHP includes is:<br /><br /><!--fonto:courier--><span style="font-family:courier"><!--/fonto--><?php include("../copyright.txt"); ?><!--fontc--></span><!--/fontc--><br /><br />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).<!--content-->
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...?<br /><br />the page I want to include is at:<br />kastiron.com/copyright.txt<br /><br />I installed a forum at:<br />kastiron.com/forum<br /><br />The page that I've placed the Include on is at:<br />kastiron.com/forum/templates/subSilver/overall_footer.tpl<br /><br />Here is the include tag:<br /><?php include("../copyright.txt"); ?><br />because the page is called from 1 directory up at kastiron.com/forum<br /><br />But nothing shows up... no errors, just nothing there.<br /><br />I've also tried <?php include("../../../../copyright.txt"); ?><br />but that's not working either.<br /><br />Is this making any sense... sorry to be a bother about this, I'm just not sure what's wrong. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /><!--content-->
Would this work?<br /><br /><?php <br />include $_SERVER['DOCUMENT_ROOT']."/copyright.txt"; <br />?><!--content-->
That's a good idea, I would think that would work! But it didn't work either <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> <br /><br />frustratinggggggggg. bleh. hehe, sorry I can't figure this out, has anyone ever tried using includes with their forum for custom headers/footers?<!--content-->
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.<br /><br />EDIT:<br /><br />Sorry, I messed up my mind and answered with something completely useless for the discussion... <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/dry.gif" style="vertical-align:middle" emoid="<_<" border="0" alt="dry.gif" /><br /><br />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.<br /><br />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.<br /><br />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.<br /><br />Let us know if it works. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><br /><br />By the way, I'm moving this to a better forum.<!--content-->
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.<br /><br /><br />I just don't understand why, that's all. They must have php or something else configured differently. I dunno... oh well, <br /><br />it's just that it's a couple more pages to change, when I add and subtract stuff from my headers and footers... <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/unsure.gif" style="vertical-align:middle" emoid=":unsure:" border="0" alt="unsure.gif" /><!--content-->
Your other option is to force your html pages to be parsed for php.<br />See this post about <a href="http://www.totalchoicehosting.com/forums/index.php?showtopic=2180&view=findpost&p=52336" target="_blank">adding php handlers to apache</a><br /><br />This may be what you had befoer.<!--content-->
mdedens, perhaps you can contact your old host and ask them how that was possible?<br />Even I got curious about it.<!--content-->
Hi,<br />Thanks for the help,<br /><br />I had to do things a bit differently though, and it's still not working <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /><br /><br />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.<br /><br />User Defined Handlers <br />.htm .html server-parsed <br />.shtm .shtml server-parsed <br />.tpl server-parsed <br />cgi cgi-script <br />pl cgi-script <br /><br />System Defined Handlers <br />.cgi .pl cgi-script <br />.shtml server-parsed <br /><br />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. <br />When I pressed for more info they said:<br />Tech: for SSI to work<br />Tech: you need following handler<br />Tech: AddType text/html .shtml .html .htm<br />Tech: AddHandler server-parsed .shtml .html .htm<br />Tech: Options Indexes FollowSymLinks Includes<br /><br />Doens't make much sense to me yet...<br /><br />Here is a link to the old forum on their server and the header's and footer's are still working there: <!--coloro:blue--><span style="color:blue"><!--/coloro-->http://df03.dot5hosting.com/~admin252/forum/<!--colorc--></span><!--/colorc--><br /><br />I dun't get it yet. Gonna keep experimenting though.<br /><br /><!--coloro:green--><span style="color:green"><!--/coloro-->Edit by TCH-Raul: I edited your post so there was no live link to a competitor <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /><!--colorc--></span><!--/colorc--><!--content-->
Sorry about the link...<br /><br />Thanks for everybody's help,,, <br /><br />I suppose I'll just have to try submitting a support ticket for this.<!--content-->
 
Top