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

Trouble Including Files in Templates

Post by plasticmind »

I'm trying to use <!-- INCLUDE myfile.html -->, but nothing's coming up.

I can add/remove <!-- INCLUDE overall_header.html --> and see the change, but when I call to my own .html file that's living in the template directory, nothing.

I read in the coding guidelines that I need to activate PHP in my templates, so I thought perhaps that's why I wasn't seeing my include file, but I turned it on, added my include to index_body.html, cleared the cache and still nothing.

Anyone care to enlighten me?

plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

I also just noticed that I can include files that are part of the default template set. Is there something preventing me from including a "non phpbb" html file?

BondGamer
Registered User
Posts: 113
Joined: Mon Dec 15, 2003 8:20 pm
Contact:

Re: Trouble Including Files in Templates

Post by BondGamer »

That may have something to do with the includephp setting in the security section of the ACP.

plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

Right, as I said, I thought so, too. So I went in there, turned it on, cleared my cache and it's still not including it. Interestingly enough, I put the html I wanted into another existing template and it worked like a charm. But no go when I try to include a brand new file.

I did this with phpbb 2 by including it in the page header as a variable and then calling to that variable in my template. But the Olympus coding page tells me I don't have to do that. :-(

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Trouble Including Files in Templates

Post by Acyd Burn »

Just creating a whatever.html file, and using <!-- INCLUDE whatever.html --> should work fine if it is within the same directory as the other template file (in /styles/subSilver/template/). We did this in CVS more than once, for example with the breadcrumb change.

Image

Uchiha Nick
Registered User
Posts: 397
Joined: Tue Jul 20, 2004 6:21 am
Location: Rotterdam, The Netherlands
Contact:

Re: Trouble Including Files in Templates

Post by Uchiha Nick »

the way he said it it was inside the temp dir oO
Image

plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

Curses.

That's what I did, and I'm not getting anything. I know there could be tons of variables here, but it seems so straightforward.

My file, smooth.html exists within the /styles/subSilver/template/ directory. I can access it by visiting it manually (http://www.cardboardwhite.com/styles/su ... mooth.html) and as I said before, I can copy and paste the HTML into, say, COPPA include and then include that file no problem. But whenever I try to import smooth.html, it just doesn't do anything at all. I tried renaming the extension, I even tried using the INCLUDEPHP function (with PHP turned on in my templates) and still nothing.

And I'm running Beta 4.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Trouble Including Files in Templates

Post by Acyd Burn »

But whenever I try to import smooth.html


import? What do you try to do exactly?

Including works as documented, you have for example a test.html and your smooth.html file, the test.html file consist of:

Code: Select all

test1<br />
<!-- INCLUDE smooth.html -->
test3<br />
the smooth.html consist of:

Code: Select all

test2<br />
then the display would be:

Code: Select all

test1
test2
test3

Image

plasticmind
Registered User
Posts: 8
Joined: Thu Dec 07, 2006 10:50 pm

Re: Trouble Including Files in Templates

Post by plasticmind »

This is my current code for index_body.html. I hope you find something I'm missing:

Code: Select all

<!-- INCLUDE overall_header.html -->

<!-- IF U_MCP -->
	<div id="pageheader">
		<p class="linkmcp">[ <a href="{U_MCP}">{L_MCP}</a> ]</p>
	</div>

	<br clear="all" /><br />
<!-- ENDIF -->


<!-- INCLUDE forumlist_body.html -->

<span class="gensmall"><a href="{U_DELETE_COOKIES}">{L_DELETE_COOKIES}</a> | <a href="{U_TEAM}">{L_THE_TEAM}</a></span><br />

<br clear="all" />

<!-- INCLUDE breadcrumbs.html -->

<!-- INCLUDE smooth.html -->

<!-- IF S_DISPLAY_ONLINE_LIST -->
	<br clear="all" />

	<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<td class="cat" colspan="2"><h4><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h4></td>
	</tr>
	<tr>
	<!-- IF LEGEND -->
		<td class="row1" rowspan="2" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<!-- ELSE -->
		<td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<!-- ENDIF -->
		<td class="row1" width="100%"><span class="genmed">{TOTAL_USERS_ONLINE}<br />{RECORD_USERS}<br /><br />{LOGGED_IN_USER_LIST}<br /><br />{L_ONLINE_EXPLAIN}</span></td>
	</tr>
	<!-- IF LEGEND -->
		<tr>
			<td class="row1"><b class="gensmall">{L_LEGEND} :: {LEGEND}</b></td>
		</tr>
	<!-- ENDIF -->
	</table>
<!-- ENDIF -->

<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
	<br clear="all" />

	<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<td class="cat" colspan="2"><h4>{L_BIRTHDAYS}</h4></td>
	</tr>
	<tr>
		<td class="row1" align="center" valign="middle"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_BIRTHDAYS}" /></td>
		<td class="row1" width="100%"><p class="genmed"><!-- IF BIRTHDAY_LIST -->{L_CONGRATULATIONS}: <b>{BIRTHDAY_LIST}</b><!-- ELSE -->{L_NO_BIRTHDAYS}<!-- ENDIF --></p></td>
	</tr>
	</table>
<!-- ENDIF -->

<br clear="all" />

<table class="tablebg" width="100%" cellspacing="1">
<tr>
	<td class="cat" colspan="2"><h4>{L_STATISTICS}</h4></td>
</tr>
<tr>
	<td class="row1"><img src="{T_THEME_PATH}/images/whosonline.gif" alt="{L_STATISTICS}" /></td>
	<td class="row1" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {NEWEST_USER}</p></td>
</tr>
</table>

<!-- IF not S_USER_LOGGED_IN -->
	<br clear="all" />

	<form method="post" action="{S_LOGIN_ACTION}">
	
	<table class="tablebg" width="100%" cellspacing="1">
	<tr>
		<td class="cat"><h4><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h4></td>
	</tr>
	<tr>
		<td class="row1" align="center"><span class="genmed">{L_USERNAME}:</span> <input class="post" type="text" name="username" size="10" />&nbsp; <span class="genmed">{L_PASSWORD}:</span> <input class="post" type="password" name="password" size="10" />&nbsp; <span class="gensmall">{L_LOG_ME_IN}</span> <input type="checkbox" class="radio" name="autologin" />&nbsp; <input type="submit" class="btnmain" name="login" value="{L_LOGIN}" /></td>
	</tr>
	</table>
	
	</form>
<!-- ENDIF -->

<br clear="all" />

<table class="legend">
<tr>
	<td width="20" align="center">{FORUM_NEW_IMG}</td>
	<td><span class="gensmall">{L_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center">{FORUM_IMG}</td>
	<td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
	<td>&nbsp;&nbsp;</td>
	<td width="20" align="center">{FORUM_LOCKED_IMG}</td>
	<td><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr>
</table>

<!-- INCLUDE overall_footer.html -->
Notice <!-- INCLUDE smooth.html --> comes right after <!-- INCLUDE breadcrumbs.html --> in the template.

And of course smooth exists at http://www.cardboardwhite.com/styles/su ... mooth.html

And as you can see by visiting http://www.cardboardwhite.com, it's not showing. And yes, I've refreshed the templates, cleared the cache, etc... Does it have anything perhaps to do with permissions? Is there a scenario in which the permissions would be set incorrectly on smooth.html to not allow it to be included? Also, is there any way of debugging thing, i.e. having phpbb spit out an error message?

Thanks for helping me with the mystery...

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Trouble Including Files in Templates

Post by Acyd Burn »

Your smooth.html file is hopefully only html and has no php in it? Because INCLUDE only supports html.

Image

Post Reply