common code for serveral files in tpl- html??

I have some .TPL files (basically they are inside HTML), actually they are a PHPBB skin, and i want to include some portions of code to be read from an common place for several different .tpl files

lets say i want to include 10 lines of code, located in "banner.html", in 10 different .TPL files, I'm not going to write this 10 times over again everytime I change it, hOw can i set this code in a commonplace for all the files??

Open in new window

axturAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
WodConnect With a Mentor Commented:
or maybe your TPL files need to be broken down into smaller files?
0
 
WodCommented:
you could convert your banner.html to banner.tpl and then use this inside your main tpl (ie: sidebar):

{include file='banner.tpl'}
0
 
axturAuthor Commented:
It doesn't work, it would display {include file='banner.tpl'} instead of the code contained in banner.tpl...
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
WodCommented:
try to add that line in a PHP file of the skin and not inside a TPL file
0
 
axturAuthor Commented:
That would be easy :), but what i need is the tpl file to read from another tpl / html file
0
 
WodCommented:
would it work if you add it at the very beginning or end of the TPL ?

if that would work for you, you could add it in the PHP right before or right after that TPL gets loaded and it would be like it's part of the other TPL

0
 
axturAuthor Commented:
I think I'm gonna break my tpl file into smaller ones, since I can't find the way to "include" other tpl files into another one. And change the PHP code, I don't like this solution, is not very "elegant", but works just fine.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.