phpBBHacks.com - Including a File in phpBB 3's PHP Files
Bad Boy Blog, an unofficial Diddy and Bad Boy fan blog
StatsForums Home   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in
FAQFAQ   SearchSearch   MemberlistMemberlist   TutorialsTutorials   ContactContact Us
Add Us:     MySpace     Facebook     StumbleUpon
Username:    Password:
Remember Me?    
Including a File in phpBB 3's PHP Files
Goto page 1, 2, 3  Next
BlinkList
del.icio.us
Furl
linkaGoGo
reddit
Simpy
Mister Wong
Yahoo! My Web

Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> Other phpBB 3 Questions and Discussion
 See a User Guidelines violation? Please contact us.
Author Message

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 12643
Location: Harbinger, NC, U.S.A.

PostPosted: June 23rd 2008, 11:22 am    Post subject: Including a File in phpBB 3's PHP Files Reply with quote

Hey all,

This is probably pretty simple, but it's escaping me. So, I thought I'd ask for help.

Let's say that you have a file called include.inc that you want to include in the footer of your phpBB 3. But, you don't want to make the change in overall_footer because you have a lot of styles installed and just want to have to make one change. (This may not be the best way to do it, but it's the way you want to do it, anyway ).

In phpBB 2, you could add "include("include.inc");" to page_tail.php, but when I try to add it in a phpBB 3 file I get cannot modify header errors. If anyone knows what the answer is, as far as how I can get it in there, that'd be great.

I appreciate your time.

Thanks,

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator
Author, Managing Online Forums (New Book)

Have a suggestion or a bit of feedback relating to phpBBHacks.com? Please contact me!
User Guidelines - phpBBHacks.com Awards - Featured phpBB - About Us - Supported Sites - Utilities

Vote in the phpBBHacks.com Awards 2008!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger

eviL<3
Not So New User

Joined: 25 Jun 2006
Posts: 65

PostPosted: June 23rd 2008, 11:33 am    Post subject: Reply with quote

This is a little tricky.

In phpBB 2.0 the template code is output right away. In phpBB 3.0 this is different, it's only output at the very end. This means that you are not allowed to output anything before it and therefore need to use the template system.

My suggestion would be to assign your stuff as a template variable, then you can add that to all of your styles and never have to adjust them again. Let me give you an example.

"footer.inc":
Code:
<?php

echo 'I\'m some test stuff...';

?>


Now we have to add the following to page_footer() in functions.php:
Code:
// begin with output buffering
ob_start();

// include our file
include('path/to/footer.inc');

// get contents of the output buffer and delete it
$footer_stuff = ob_get_clean();

// assign it as a template variable
$template->assign_var('FOOTER_STUFF', $footer_stuff);


Now all you have to do is add this to the template file:
Code:
{FOOTER_STUFF}


I hope that makes sense (and works ).
_________________
phpBBModders
Back to top
View user's profile Send private message Visit poster's website

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 12643
Location: Harbinger, NC, U.S.A.

PostPosted: June 23rd 2008, 7:15 pm    Post subject: Reply with quote

Hey Igor,

Thanks for that. I appreciate your help and time.

Really, I have to do it without editing any styles, not even the slighest change. Is there any way for that to happen?

Thanks,

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator
Author, Managing Online Forums (New Book)

Have a suggestion or a bit of feedback relating to phpBBHacks.com? Please contact me!
User Guidelines - phpBBHacks.com Awards - Featured phpBB - About Us - Supported Sites - Utilities

Vote in the phpBBHacks.com Awards 2008!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Semi_deus
New User

Joined: 23 Jun 2008
Posts: 6
Location: the Netherlands

PostPosted: June 24th 2008, 4:02 am    Post subject: Reply with quote

Patrick wrote:
Hey Igor,

Thanks for that. I appreciate your help and time.

Really, I have to do it without editing any styles, not even the slighest change. Is there any way for that to happen?

Thanks,

Patrick
I don't think that could be possible..
The html needs to be putten somewhere, and I think this is a small a change as it gets.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger

Marian
Not So New User

Joined: 08 Apr 2007
Posts: 63

PostPosted: June 24th 2008, 5:18 am    Post subject: Re: Including a File in phpBB 3's PHP Files Reply with quote

Patrick wrote:
But, you don't want to make the change in overall_footer because you have a lot of styles installed and just want to have to make one change.


You could choose to install only one template and a lot of themes to go with it. Then you'd only have to make one change in the template file and it would affect all your styles at once.
Back to top
View user's profile Send private message

Semi_deus
New User

Joined: 23 Jun 2008
Posts: 6
Location: the Netherlands

PostPosted: June 24th 2008, 8:10 am    Post subject: Re: Including a File in phpBB 3's PHP Files Reply with quote

Marian wrote:
Patrick wrote:
But, you don't want to make the change in overall_footer because you have a lot of styles installed and just want to have to make one change.


You could choose to install only one template and a lot of themes to go with it. Then you'd only have to make one change in the template file and it would affect all your styles at once.
Thats not possible either is it? Well, atleast not with phpbb3.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger

Marian
Not So New User

Joined: 08 Apr 2007
Posts: 63

PostPosted: June 24th 2008, 9:00 am    Post subject: Reply with quote

Yes it is, I have only subsilver2 and prosilver templates installed and more than 20 themes and imagesets. Most mods only change the template files so I only have to do those changes twice instead of 20+ times.
Back to top
View user's profile Send private message

Semi_deus
New User

Joined: 23 Jun 2008
Posts: 6
Location: the Netherlands

PostPosted: June 24th 2008, 10:01 am    Post subject: Reply with quote

Ah, I didn't understand your previous post

But that won't solve Patricks problem, I think, since he is more
concerned about the change, then how often it needs to be done.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger

Patrick
Admin/Webmaster

Joined: 11 May 2001
Posts: 12643
Location: Harbinger, NC, U.S.A.

PostPosted: June 24th 2008, 11:21 am    Post subject: Reply with quote

Hey Semi_deus and Marian,

Thanks very much for the replies and assistance.

But, yeah, you're right. I really need to have it be a change only to the phpBB .php files and not to anything in the styles folder.

I don't know if it matters, but what is in the .inc file is just some HTML (JavaScript).

If anyone has any other thoughts, I'd certainly appreciate them.

Thanks,

Patrick
_________________
Patrick O'Keefe - phpBBHacks.com Administrator
Author, Managing Online Forums (New Book)

Have a suggestion or a bit of feedback relating to phpBBHacks.com? Please contact me!
User Guidelines - phpBBHacks.com Awards - Featured phpBB - About Us - Supported Sites - Utilities

Vote in the phpBBHacks.com Awards 2008!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger

Ricky_Racer
Dedicated User

Joined: 19 Jul 2003
Posts: 1400
Location: Middle of Nowhere, USA

PostPosted: June 25th 2008, 7:31 am    Post subject: Reply with quote

If isn't too complicated of html, (JavaScript), why not just add it in here ? (./includes/functions.php)
Code:
         echo '   <div id="page-footer">';
         echo '      Powered by phpBB &copy; 2000, 2002, 2005, 2007-2008 <a href="http://www.phpbb.com/" target="_phpbb">phpBB Group</a>';
         echo '   </div>';
         echo '</div>';
         echo '</body>';
         echo '</html>';

Wouldn't that then make it a part of the function, ?
Code:
page_footer();

Therefore, no need to edit overall_footer.html. Or am I completely lost in left field ? (What can I say it's baseball season)
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBBHacks.com Support Forums Forum Index -> Other phpBB 3 Questions and Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Links: Big Message Boards - Free JavaScript - phpBB2 - phpbb styles - Suporte phpBB - phpBB.it - phpBB Česky - phpBB Turkiye - phpBBArabia.com - phpBB-fr.com - Romanian phpBB online community - phpBB-TW.net - phpBBservice.nl - phpBB Brasil

Network: iFroggy Network Blog - iFroggy Hosting - SportsForums.net - KarateForums.com - YanksBlog.com - PhotoshopForums.com - DeveloperCube - Managing Online Forums - ManagingCommunities.com - CommunityAdmins.com - DrGregHouse.com - Bad Boy Blog - BadBoyForums.com - SodaRatings.com - Patrick O'Keefe

< Advertising - Contact Us - Staff - User Guidelines >

Copyright © 2001-2008. iFroggy Network, phpBBHacks.com. All Rights Reserved. Privacy Policy. We Support phpBBHacks.com (of course!).
Powered by phpBB © phpBB Group. phpBB SEO. Hosted by 100MegsWebHosting. We are in no way affiliated with the phpBB Group. phpBB is copyright to the phpBB Group.