Trouble Including Files in Templates

All style (template, theme and imageset) related questions for the new release; advice, feedback here please.
plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

Yeah, but even if it did have PHP in it, I assume it would just display like php on an html page would, as plaintext, right? For instance, you'd see:

Code: Select all

<?php echo 'Hello world!'; ?>
In the code while the rest of the HTML would display.
profpete
Registered User
Posts: 140
Joined: Wed Dec 08, 2004 10:49 pm
Location: Wales, UK

Re: Trouble Including Files in Templates

Post by profpete »

No, the phpbb template engine strips out anything between <? and ?> inclusive...
plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

Ok, that's good to know.

Still doesn't quite solve my problem though...
profpete
Registered User
Posts: 140
Joined: Wed Dec 08, 2004 10:49 pm
Location: Wales, UK

Re: Trouble Including Files in Templates

Post by profpete »

Maybe <!-- INCLUDEPHP smooth.php --> is what you need then?

(But make sure the relevant setting in the security page of the ACP is set)
JoSch
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 8:47 am

Re: Trouble Including Files in Templates

Post by JoSch »

Is this problem still unsolved?
I also encountered exactly the same issue.
I did a simple <!-- INCLUDE mytestfile.html --> with mytestfile.html located in the template directory and with some test content.
But this content is not being shown!
I did it the same way all the other includes were added but it seems not to recognize new files that are not in the standard subsilver template.
User avatar
Highway of Life
Registered User
Posts: 1399
Joined: Tue Feb 08, 2005 10:18 pm
Location: I'd love to change the World, but they won't give me the Source Code
Contact:

Re: Trouble Including Files in Templates

Post by Highway of Life »

Okay... listen very closely, and follow these exact steps to test it.

Create a new HTML file, save it to the /styles/subSilver/template/ directory as "myfile.html"
put the following code in that file:

Code: Select all

<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum. Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.</p>
Open /styles/subSilver/template/index_body.html
FIND:

Code: Select all

<!-- INCLUDE breadcrumbs.html -->
BEFORE, ADD:

Code: Select all

<!-- INCLUDE myfile.html -->
Clear /cache/ directory.
Reload index page, look near the very bottom, right before the last breadcrumb bar.
Whala!!

(Tested just now on a localhost Beta4 install)
Image
JoSch
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 8:47 am

Re: Trouble Including Files in Templates

Post by JoSch »

Thanks for the quick reply.
I also tested it on my localhost phpbb3 install but with no luck.
I know that this is very annoying but I even copy and pasted your steps to do everything exactly as you did.
I'm currently working on my own phpbb3 template and did *very* deep changes so I already got experience in writing template files and I think I know what I'm doing.
Because it still not works it has to do something with my configuration. To be sure I think I will now do a clean reinstall of phpBB3 on my machine and then try it out again. If then it's still not working it has something to do with my server.
JoSch
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 8:47 am

Re: Trouble Including Files in Templates

Post by JoSch »

Now that we speak about it: i recently had another similar issue.
I'm German and I wanted to install the German language pack, so I unpacked the de directory in my language dir.
I went into my acp and tried to change the language but the only option there was Englisch as if I had never copied anything in the language dir.
This is the same error since my phpbb install seems not to recognize new files/folders added.
User avatar
Highway of Life
Registered User
Posts: 1399
Joined: Tue Feb 08, 2005 10:18 pm
Location: I'd love to change the World, but they won't give me the Source Code
Contact:

Re: Trouble Including Files in Templates

Post by Highway of Life »

Okay, Language packs are another issue, so I won't address that here... if you think it's a bug, post it in the bug tracker.

For the templates... remember, if it can include overall_header and overall_footer... and breadcrumbs... etc... then it can call ANY file... as long as the file is within the /template/ directory of the style that is being viewed. (i.e. if you have Two subSilvers installed, and are viewing one on the forums, and modifying another one, then it's obviously not going to work)
Another test for you is to remove the breadcrumbs include... then check the page... if the breadcrumbs disappeared, then you are editing the right file, if they are still there, then something else is wrong.

It really shouldn't matter what Beta version you have installed, as I had it working from Beta1, and of course, now all the way through Beta4
Image
JoSch
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 8:47 am

Re: Trouble Including Files in Templates

Post by JoSch »

SOLUTION!

It's really simple and I don't know why I forgot this... stupid...
The reason why new files in my phpbb folder are not accessed as if they were not there is the linux permission setting!
A simple chmod 707 instead of my former 700 will allow php as the user 'apache' to access the files wich were created by myself.
I feel really stupid but now everything works! :mrgreen:
Post Reply