miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Re-cycled miniBB Support Forums / Re-cycled /  
 

How to use php in template files?

 
Author Peter
Partaker
#1 | Posted: 10 Jan 2006 05:42 
I've tried to put a php include in main_header.html, but it doesn't work. The include only works when I rename the file to main_header.php, but that of course messes up the system.

Why are the template files called .html? Is there a way to fix this?

If I can't use php includes in the header and footer files, integrating miniBB into my site will become a lot more complicated/cumbersome.

Author Team
8-)
#2 | Posted: 10 Jan 2006 13:03 
You can use including of any file in bb_plugins.php. After that, store all output in some variable, for example, $output. Then provide {$output} in main_header.html.

Author Florian
Guest
#3 | Posted: 9 Feb 2006 15:12 
hi paul,

i wanted to add a php-include file to templates/main_header.html
it only adds some html-code in front of the main forum. my .htaccess is advised to crawl html files like php files. but the only thing my browser does is showing the php source-code. it doesn't include the html source code... why? minibb . info / minibb.html (i inserted the source manualy)

Author Team
8-)
#4 | Posted: 16 Mar 2006 12:52 
PHP-include will not work in the templates. The only way to display a variable is to give it a value it first within some PHP script, then provide {$variable} tag in the template.

If you want to use dynamic header/footer, look at the options $includeHeader and $includeFooter in setup_options.php.

Author muz1
Partaker
#5 | Posted: 11 Jul 2006 21:39 
Hey there.
I am having the same problems. I have done some test code and understand how I need to redefine variables and call them in the template. My problem is that my code is so technical and to try and string it as a variable would be a nightmare. The header I want to generate also includes javascript functions and heaps of other stuff.
I am already getting a headache trying to work out whatI am going to do.
Any ideas.

Author Paul
Lead Developer 
#6 | Posted: 12 Jul 2006 06:46 
Take a look at this thread or, as said above, look at the options $includeHeader and $includeFooter, which specify the names of your custom PHP header files.

Overall, we are providing only paid support on custom implementations.

Author Andrewww
Partaker
#7 | Posted: 13 Jun 2007 18:43 
You can use including of any file in bb_plugins.php. After that, store all output in some variable, for example, $output. Then provide {$output} in main_header.html.

I would be very grateful if you can tell me the name of function( and file, where it is ), that makes the substitution in templates. I consider it as very nice solution and I am really curiosus how does it work. I hope it is possible to answer my question. Thank you for any answers.

Author Paul
Lead Developer 
#8 | Posted: 14 Jun 2007 03:51 
bb_functions.php -> ParseTpl()

Re-cycled miniBB Support Forums / Re-cycled /
 How to use php in template files?
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Get the Private Messaging add-on: allow your miniBB-forums members to communicate with each other.


  ⇑