Jump to content

Recommended Posts

Posted

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?

Posted (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 by TCH-MikeJ
Posted

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. :)

Posted

That's a good idea, I would think that would work! But it didn't work either :unsure:

 

frustratinggggggggg. bleh. hehe, sorry I can't figure this out, has anyone ever tried using includes with their forum for custom headers/footers?

Posted (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... :unsure:

 

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. B)

 

By the way, I'm moving this to a better forum.

Edited by TCH-Raul
Posted

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... :unsure:

Posted

mdedens, perhaps you can contact your old host and ask them how that was possible?

Even I got curious about it.

Posted (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 :dance:

Edited by TCH-Raul

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...