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 » Tue Mar 13, 2012 9:15 pm

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 » Tue Mar 13, 2012 11:29 pm

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 » Tue Mar 13, 2012 11:48 pm

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 » Wed Mar 14, 2012 1:07 am

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 » Wed Mar 14, 2012 9:27 am

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 » Wed Mar 14, 2012 6:08 pm

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: 3476
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: phpBB Standalone Template Engine

Post by bonelifer » Wed Mar 14, 2012 7:52 pm

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.
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
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 » Wed Mar 14, 2012 11:18 pm

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 » Fri Mar 16, 2012 5:06 pm

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 » Fri Mar 16, 2012 7:05 pm

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: 5613
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack » Fri Mar 16, 2012 7:23 pm

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 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
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 » Fri Mar 16, 2012 9:35 pm

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: Surrey, UK
Name: Michael Cullum
Contact:

Re: phpBB Standalone Template Engine

Post by MichaelC » Fri Mar 16, 2012 10:59 pm

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 » Fri Mar 16, 2012 11:44 pm

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: 5613
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: phpBB Standalone Template Engine

Post by AmigoJack » Sat Mar 17, 2012 12:17 am

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 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.

Locked

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