phpBB Standalone Template Engine

Discussion forum for MOD Writers regarding MOD Development.
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

i find out, that its also important to change this part

Code: Select all

		$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
to

Code: Select all

		$data = "<?php" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
If not, the cached files shows nothing. Afterward, thanks for this great stuff.
By the way, it works perfect with both 3.0.10 template classes.
Last edited by 4_seven on Wed Mar 14, 2012 11:21 pm, edited 1 time in total.
Current Mods | Mod Base | php(BB) programming | No help via PM
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 »

If someone is interested in it would be great to create MODx file with instructions how to use phpbb3 template and session system, maybe also a lang system. we can also cooperate
Angel200
Registered User
Posts: 26
Joined: Fri Apr 28, 2006 11:19 am
Location: 127.0.0.1:1337
Contact:

Re: phpBB Standalone Template Engine

Post by Angel200 »

4_seven wrote:i find out, that its also important to change this part

Code: Select all

		$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
to

Code: Select all

		$data = "<?php" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
If not, the cached files shows nothing. Afterward, thanks for this great stuff.
By the way, it works perfect with both 3.0.10 template classes.

Download: Working Example
Sure? Because i make the following and my cache is working and in the cache files is all the stuff that i see in the source code from the template files
samuelgozi wrote:If you want it to work with the files of phpBB 3.0.8 you will need to find:

Code: Select all

		$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
and remove it.
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

delete the files in folder cache once (accept .htaccess) after each change, bcs. the old files are shown, if not. also you can rename the cache folder, may cache_, when you work on templates/sites/engine. but if it works anyway for you, than have fun.
Current Mods | Mod Base | php(BB) programming | No help via PM
Angel200
Registered User
Posts: 26
Joined: Fri Apr 28, 2006 11:19 am
Location: 127.0.0.1:1337
Contact:

Re: phpBB Standalone Template Engine

Post by Angel200 »

4_seven wrote:delete the files in folder cache once (accept .htaccess) after each change, bcs. the old files are shown
On my site it works, i see the new files
4_seven wrote: also you can rename the cache folder, may cache_, when you work on templates/sites/engine.
If i rename it, it makes no cache files, but i can change the templates files and after pressing F5 i see the changes.

I don't see a bad site because if i have a cache folder i have to delete the cache files to see my changes as it is in phpbb ;)

Can you explain what you mean exactly?
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

Sorry, but i also havent understand the intention/reason for this post,
http://www.phpbb.com/community/viewtopi ... #p13125530
so may enlight me before.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3542
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: phpBB Standalone Template Engine

Post by bonelifer »

4_seven wrote:i find out, that its also important to change this part
....
Download: Working Example
The included index.php starts:

Code: Select all

<?
should be:

Code: Select all

<?php
Else it just renders the contents of index.php for me.
William Jacoby - Community Team
Knowledge Base | phpBB Board Rules | Search Customisation Database
Please don't contact me via PM or email for phpBB support .
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

zip is corrected / revisited: http://4seven.de/tpl_engine.zip

Works as before and shows

Code: Select all

Header
Index
Footer
http://4seven.de/tpl_engine/index.php

with or without* cache.

*just rename cache to cache_
Current Mods | Mod Base | php(BB) programming | No help via PM
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 »

You could also use twig. Just sayin. ;-)
Igor Wiedler | area51 | GitHub | trashbin | Formerly known as evil less than three
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

No chance. phpbb3 engine is smart enough and well known ;)
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
AmigoJack
Registered User
Posts: 6109
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack »

4_seven wrote:phpbb3 engine is smart enough
The 3.0 engine also has its weaknesses with file inclusions inside loops.

If someone is looking for alternatives: DirecTemplate worked like a charm for me on rather small (board-less) sites.
  • "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." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

For static or less dynamical sites its heavenly good. For more complex projects it gives alternatives. Thanks for hints and your work here.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
MichaelC
Consultant
Consultant
Posts: 3642
Joined: Mon Dec 21, 2009 3:36 pm
Location: London, UK
Name: Michael Cullum
Contact:

Re: phpBB Standalone Template Engine

Post by MichaelC »

4_seven wrote:No chance. phpbb3 engine is smart enough and well known ;)
Twig is also very well known and it will most likely be used in phpBB 4. ;)
:)
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
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: phpBB Standalone Template Engine

Post by 4_seven »

interesting, but it seems the syntax is not that clear as before.
Current Mods | Mod Base | php(BB) programming | No help via PM
User avatar
AmigoJack
Registered User
Posts: 6109
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack »

4_seven wrote:not that clear
Can I rephrase that as being more versatile? :lol:
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.
  • "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." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Locked

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