Running php in a tpl

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Running php in a tpl

Post by John Cartwright »

I am trying to run any particular code in a .tpl file and wondering how this can be accomplished if anyones knows. I'm trying to modify phpbb2 forums .. and have tried their support forums but no one is answering me would be much appreciated if someone could help me :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

phpbb2 "compiles" the tpl when it's requested.. So you may not be able to effectively add real code to it.. template.php in the includes folder has all their code for that particular thing..
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

hmm I'm just tyring to do an include at the moment... any other ideas?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

depending on what and how you want to include it, you could add a couple template data chunks or a different template file, and insert it into the queue where you want it to show.. or just edit the template file directly..
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

i just want to have the following run

include("../nav.php");

but I don't know what you mean aobut the queue and whatnot


btw all nav.php is is a bunch ofn links
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'm guessing this would go in overall_header.tpl? the way I've done specialized code running in the phpbb I've modified, I added a few lines to one of the main php files phpbb uses. Adding a template variable, and calling my functions to set the proper one to control what content changed using the template variable naming system...
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Feyd sorry I'm really noobish when it comes to how phpbb works...

if you got a few min think you could walk me through it?

Not in a particular rush but it would be much appreciated.


btw its in the index_body.tpl that i am modifying
Post Reply