phpBB Standalone Template Engine

Discussion forum for MOD Writers regarding MOD Development.
User avatar
MichaelC
Consultant
Consultant
Posts: 3642
Joined: Mon Dec 21, 2009 3:36 pm
Location: Surrey, UK
Name: Michael Cullum
Contact:

Re: phpBB Standalone Template Engine

Post by MichaelC » Sat Mar 17, 2012 12:01 pm

At the moment phpBB is so isolated by the fact it uses its own framework, template engine, DBAL etc. which makes it hard to integrate and uses a lot of development time maintaining it. Using external frameworks means development time can be spent on phpBB things and it makes phpBB easier to integrate with other scripts and websites.

phpBB selects the frameworks which meet phpBB's needs so I would not worry about the fact we use 3rd party libs means that it would not be suited to phpBB's needs. :)
:)
Formerly known as Unknown Bliss.
Formerly Website Team Lead/Manager & Development Team.
Please don't PM me for support (or stuff that belongs in the forums or tracker) but otherwise feel free

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Re: phpBB Standalone Template Engine

Post by igorw » Sat Mar 17, 2012 12:03 pm

AmigoJack wrote:I'm no friend of relying on (heavy) external frameworks - flexibility always comes with performance loss and once phpBB chooses that direction it will be difficult or impossible to tune it for phpBB's needs.
So monolithic mashed together architecture is a good thing and small decoupled libraries are a bad thing? Sure, if you add too many abstractions you will see a performance loss. But a template engine is either performant, or it is not. The fact that it's part of phpBB does not change a thing. We could switch to twig for templating and would most likely see no performance loss, or maybe even performance improvements.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

User avatar
AmigoJack
Registered User
Posts: 5605
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack » Sat Mar 17, 2012 1:09 pm

igorw wrote:
AmigoJack wrote:relying on (heavy)
small decoupled
Variety shouldn't be underestimated. Once using Twig, phpBB will profit be unburdened, but also rely and suffer. A vulnerability to Twig will then reach far more users, not to mention how phpBB will handle version updates because of that. Potential MODs will then have to touch Twig where phpBB's hook architecture won't kick in. I'm the pessimist and always see the disadvantages.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
igorw
Former Team Member
Posts: 8024
Joined: Fri Dec 16, 2005 12:23 pm
Location: {postrow.POSTER_FROM}
Name: Igor Wiedler

Re: phpBB Standalone Template Engine

Post by igorw » Sat Mar 17, 2012 1:32 pm

I don't see how that changes anything. When a security issue is found, we make a new release.

A library is not a magic black box. It's a tool. It's some code that we can use. We can treat it as if it were part of phpBB. At least that's the way that I use libraries.
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three

alexander7566
Registered User
Posts: 171
Joined: Mon Mar 12, 2012 5:26 pm

Re: phpBB Standalone Template Engine

Post by alexander7566 » Thu Apr 12, 2012 3:21 am

Wow.. I think this is neat. However.. i get this error...

Code: Select all

Notice: Undefined index: template_path in C:\Server\test\classes\template.php on line 767 Notice: Undefined property: stdClass::$lang in C:\Server\test\classes\template.php on line 776 Fatal error: template->_tpl_load_file() in C:\Server\test\classes\template.php on line 776
Anyone know what the issue could be? I have set up this site EXACTLY how you did as far as the directory structure goes.

is there anyway you could just upload the files you made that we can use? That would be very helpful!

My non working template.php - http://www.itwontwork.net/shared/template.zip

nanothree
Registered User
Posts: 262
Joined: Wed Dec 10, 2003 8:33 am
Location: Doncaster, UK
Contact:

Re: phpBB Standalone Template Engine

Post by nanothree » Thu Apr 12, 2012 8:14 am

@Alexander it's been a long time since i have actually used phpBB as a template engine. I wouldn't recommend it now. There are better ones that could be used, such as Twig which has been mentioned a few times.

Although phpBB's template system was good for me at one time, i now prefer to use no template engine and just use plain php variables in my views when working on other projects. My advice now would be to use an mvc framework (i use cakephp) instead of trying to build your own.

If you plan on doing a lot more work with phpBB in the future, i would suggest learning Symfony as i think that is what phpBB4 is going to be built with.

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: phpBB Standalone Template Engine

Post by Louis7777 » Wed Oct 30, 2013 12:59 am

Can anyone:

1. Provide a working standalone template engine made out of the latest phpBB version and combine the template.php and functions_template.php etc. in one file named template.php that has all the required code?

2. Type a small tutorial on how to create language template variables using the above or any other engine? For example:

How would this --> {L_HOME_ADDRESS}

be replaced by this --> MY STREET ADDY

which is defined in a language file like this:

Code: Select all

$language = array_merge($language, array(
   'HOME_ADDRESS' => 'MY STREET ADDY',
));

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: phpBB Standalone Template Engine

Post by EXreaction » Mon Nov 04, 2013 2:21 am

Why do you want to use phpBB's template engine stand-alone?

There are far better template engines, like Twig, if you're using something independent of phpBB (we actually use Twig in phpBB 3.1).

User avatar
Kamahl19
Registered User
Posts: 1598
Joined: Tue Nov 06, 2007 3:33 pm
Location: Slovakia
Name: Martin
Contact:

Re: phpBB Standalone Template Engine

Post by Kamahl19 » Mon Nov 04, 2013 3:29 am

Actually I understand him. phpBB's template engine has its weaknesses and limitations, but I really like it. It is very simple and intuitive, at least for me. I also use Twig and sometimes Mustache for most of my non phpbb projects, but for small simple applications, I would like to use phpbb template engine.

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: phpBB Standalone Template Engine

Post by Louis7777 » Mon Nov 04, 2013 9:57 am

EXreaction wrote:Why do you want to use phpBB's template engine stand-alone?

There are far better template engines, like Twig, if you're using something independent of phpBB (we actually use Twig in phpBB 3.1).
Well, I really like the syntax in its templates and it's simple. I mainly want it for multilingual websites where I have to use mixed php and html all the time.

If anyone could point out how I can achieve what I wrote above about language varuables with any other engine, such as Twig, then I can do without phpbb's engine. :)
Kamahl19 wrote:Actually I understand him. phpBB's template engine has its weaknesses and limitations, but I really like it. It is very simple and intuitive, at least for me. I also use Twig and sometimes Mustache for most of my non phpbb projects, but for small simple applications, I would like to use phpbb template engine.
Yup.

User avatar
AmigoJack
Registered User
Posts: 5605
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack » Mon Nov 04, 2013 11:45 am

AmigoJack wrote:If someone is looking for alternatives: DirecTemplate worked like a charm for me on rather small (board-less) sites.
You haven't tried this, which directly comes with examples and is very lightweight.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: phpBB Standalone Template Engine

Post by Louis7777 » Mon Nov 04, 2013 1:06 pm

AmigoJack wrote:
AmigoJack wrote:If someone is looking for alternatives: DirecTemplate worked like a charm for me on rather small (board-less) sites.
You haven't tried this, which directly comes with examples and is very lightweight.
Actually, I saw that (and all posts in this thread) but DirecTemplate seems kinda outdated:

"Last updated: Oct 15, 2007 01:40 AM"

User avatar
AmigoJack
Registered User
Posts: 5605
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack » Mon Nov 04, 2013 2:12 pm

In that logic HTTP 1.1 is also "outdated" because it hasn't been updated since 1999, yet you use it daily.
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
Louis7777
Registered User
Posts: 247
Joined: Sat Apr 21, 2012 9:22 pm

Re: phpBB Standalone Template Engine

Post by Louis7777 » Mon Nov 04, 2013 3:53 pm

AmigoJack wrote:In that logic HTTP 1.1 is also "outdated" because it hasn't been updated since 1999, yet you use it daily.
That is a protocol, so no, not "in that logic".

I'm sure the scripts still work, like a website written in HTML 4 that utilizes frames would still work, but I'd like something a bit more modern... :)

User avatar
EXreaction
Former Team Member
Posts: 5666
Joined: Sun Aug 21, 2005 9:31 pm
Location: Wisconsin, U.S.
Name: Nathan

Re: phpBB Standalone Template Engine

Post by EXreaction » Mon Nov 04, 2013 4:13 pm

Twig has some really good documentation: http://twig.sensiolabs.org/documentation

The first three parts should cover everything you need to handle this particular task and many more.

Locked

Return to “[3.0.x] MOD Writers Discussion”

cron