Page 7 of 8

Re: phpBB Standalone Template Engine

Posted: Sat Mar 17, 2012 12:01 pm
by MichaelC
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. :)

Re: phpBB Standalone Template Engine

Posted: Sat Mar 17, 2012 12:03 pm
by igorw
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.

Re: phpBB Standalone Template Engine

Posted: Sat Mar 17, 2012 1:09 pm
by AmigoJack
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.

Re: phpBB Standalone Template Engine

Posted: Sat Mar 17, 2012 1:32 pm
by igorw
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.

Re: phpBB Standalone Template Engine

Posted: Thu Apr 12, 2012 3:21 am
by alexander7566
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

Re: phpBB Standalone Template Engine

Posted: Thu Apr 12, 2012 8:14 am
by nanothree
@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.

Re: phpBB Standalone Template Engine

Posted: Wed Oct 30, 2013 12:59 am
by Louis7777
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',
));

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 2:21 am
by EXreaction
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).

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 3:29 am
by Kamahl19
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.

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 9:57 am
by Louis7777
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.

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 11:45 am
by AmigoJack
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.

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 1:06 pm
by Louis7777
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"

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 2:12 pm
by AmigoJack
In that logic HTTP 1.1 is also "outdated" because it hasn't been updated since 1999, yet you use it daily.

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 3:53 pm
by Louis7777
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... :)

Re: phpBB Standalone Template Engine

Posted: Mon Nov 04, 2013 4:13 pm
by EXreaction
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.