[ABD] Template Replacement MOD

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sat Feb 22, 2003 7:22 am

Shihiko Kami wrote: Herbalite, I think I found another template in php error.... but this time it doesn't tell me what the error is... just gives me "Invalid Session" when I tried to send a Email using phpbb... I tried with out the template.php file and it works... you might want to look into it :D
Do you have some details? Most helpful is which functionality of phpBB2 are you using to send mail, and which template are you using?
The problems most the time are related to the engine not substituing a template var, so knowing the template helps me to quickly find the problem.

But thanks in any case, I'm finishing up 1.1.0 which introduces IF ELSE ENDIF blocks, and if I can squash a bug before I release that code, the better.

Shihiko Kami
Registered User
Posts: 26
Joined: Tue Feb 11, 2003 4:45 am

Post by Shihiko Kami » Sat Feb 22, 2003 1:31 pm

Oh... I see it's a template problem too... well it's fixed now... thanks... I'll note more errors when they come up :D... great mod hehe... hope the IF statement version works great too... :mrgreen:

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sat Feb 22, 2003 1:43 pm

Shihiko Kami wrote: Oh... I see it's a template problem too... well it's fixed now... thanks... I'll note more errors when they come up :D... great mod hehe... hope the IF statement version works great too... :mrgreen:
Great, I was a bit worried.

And yes the IF stuff seems to work great so far, I also wrote up a manual today. I'll give the code some trashing, if I don't find any problems, I'll put 1.1.0 up tomorrow.

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Sun Feb 23, 2003 10:21 am

Version 1.1.0 is available.

It adds IF/IF AS .. ELSE/ ELSE AS ... ENDIF syntax So bye bye to template switches in the phpBB original code, and other cool stuff possible with IF AS syntax

And a manual. The manual also covers the original functionality in the original template engine.

Be sure to read through the IF AS example in the manual, some cool possibilites popped up.

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Tue Feb 25, 2003 1:30 am

Didn't changed a line correctly in 1.1.0: The fix will be in the next release, in the meantime apply the following change

#
#-----[ OPEN ]------------------------------------------
# for V 1.1.0 only

includes/template.php

#
#-----[ REPLACE ]------------------------------------------
# (Line 742)

if ($block_name == 'T_ROOT' || ($block_ref['type'] == T_IF && $block_ref['type'] == T_ELSE))

#
#-----[ WITH ]------------------------------------------
#

if ($block_name == 'T_ROOT' || $block_ref['type'] == T_IF || $block_ref['type'] == T_ELSE)

PK Barbie Doll
Registered User
Posts: 71
Joined: Sun Sep 01, 2002 5:22 pm
Location: Uncharted Territories
Contact:

Post by PK Barbie Doll » Sun Mar 02, 2003 4:51 pm

Herbalite wrote:
j0ker wrote:I have tried the template replacement on phpbb 2.0.4 (clean install) without any problems so far...

..but when I tried it on my mod'ed board (also 2.0.4) I got this error:
template->compile(): irrecoverable error. Possibly because there are more END than BEGIN lines


I currently use the birthday MOD, and also I have MOD'ed some of my own.. adding a few fields in the user-db.

I get the error when I try to enter "profile" in the menu. I have mod'ed my usercp_register.php file.. the error is probably there..

Check the template for that page. Make sure that all the <-- BEGIN block --> sections match the appropriate <-- END block --> and are properly nested.


Herbalite, I am receiving this error now on a recently upgraded 2.0.0 to 2.0.4 board. All pages work except for posting.php, which gives me this error. I checked /templates/sometemplate/posting.body.tpl and confirmed that I have equal numbers of BEGIN and END tags.

The last mod I installed was quick reply, however it required no changes to posting.php or posting_body.tpl. I checked the BEGIN END tags on viewtopic and have an equal count there too.

Any suggestions?

sj26
Registered User
Posts: 447
Joined: Fri Dec 14, 2001 4:06 pm
Location: /dev/cpu/[0-9]+ :D
Contact:

Post by sj26 » Sun Mar 02, 2003 5:14 pm

You do realise that all these features are already in phpBB 2.1 CVS? check out a copy for yourself.

It includes new features liek IF, ELSEIF, ELSE, ENDIF, BEGIN, BEGINELSE (if there are no rows), END, PHP, ENDPHP (to add PHP blocks), INCLUDE (include a template), INCLUDEPHP (include a php file), etc

Here's a modified 'backwards-compatible' version with some features added:

http://sj26.cjb.net/template.phps

These are:

{&blockname} - current iteration of this block
{#blockname} - total iterations of this block
<!-- COMMENT comment goes here --> - A comment that is removed on parsing... maybe this should be ! instead of COMMENT...

and I am adding

<!-- SET VAR = value --> - set a variable
{blockname[1].VAR}, {&blockname[1]}, {#blockname[1]} (you get the picture)
- to access a specific iteration
{blockname[{VARIABLE}].VAR} - using a variable as the iteration number
{blockname[{blockname.VARIABLE}].VAR} - using a block-level variable as the iteration number

and I want to add a more friendly parsing validation system, to remove those unsightly eval'd errors.
[ Working on: It's a secret! ]
[ Links: My Mods | My Site | PALGN ]

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Mon Mar 03, 2003 1:08 am

sj26 wrote: You do realise that all these features are already in phpBB 2.1 CVS? check out a copy for yourself.
No, I've downloaded the 2.1 CVS earlier but then found only the original template. But thanks for pointing it out.

Skimming to the code might I add some suggestions?

With the CVS 2.1 template it looks I still cannot load templates from a string. (It's not hard to add that functionality, I've added that extension a long while ago as a simple MOD on phpbbhacks.com.

Another suggestion I have: make_filename() still is very unsafe IMO and in certain circumstances plain wrong in the current CVS version. Still can't load a template from a http address since the code recognizes it as a relative filename. Feel free to look how it looks in my version and you can use whatever you need in the CVS version.
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Mon Mar 03, 2003 3:57 am

PK Barbie Doll wrote:
Herbalite wrote:
j0ker wrote:I have tried the template replacement on phpbb 2.0.4 (clean install) without any problems so far...

..but when I tried it on my mod'ed board (also 2.0.4) I got this error:
template->compile(): irrecoverable error. Possibly because there are more END than BEGIN lines


I currently use the birthday MOD, and also I have MOD'ed some of my own.. adding a few fields in the user-db.

I get the error when I try to enter "profile" in the menu. I have mod'ed my usercp_register.php file.. the error is probably there..

Check the template for that page. Make sure that all the <-- BEGIN block --> sections match the appropriate <-- END block --> and are properly nested.


Herbalite, I am receiving this error now on a recently upgraded 2.0.0 to 2.0.4 board. All pages work except for posting.php, which gives me this error. I checked /templates/sometemplate/posting.body.tpl and confirmed that I have equal numbers of BEGIN and END tags.

The last mod I installed was quick reply, however it required no changes to posting.php or posting_body.tpl. I checked the BEGIN END tags on viewtopic and have an equal count there too.

Any suggestions?
Which version are you using?. The new diagnostic message should tell you what END BLOCK the parser found, and what it expected. Should help to pinpoint problems
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3466
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Post by bonelifer » Mon Oct 31, 2005 1:50 pm

Interesting. Are you still working on this. Does it work with the current version?
Knowledge Base | phpBB Board Rules | Search Customisation Database
Image
Please don't contact me via PM or email for phpBB support .

Herbalite
Registered User
Posts: 205
Joined: Wed Apr 10, 2002 8:11 am
Location: South East Asia

Post by Herbalite » Tue Nov 01, 2005 12:39 am

bonelifer wrote: Interesting. Are you still working on this. Does it work with the current version?

It should work with the current version. I continued to develop the MOD until a year ago. Added template caching and the ability to add block local template replacments. Instead of repeating the entire block name(s) again for each and every block var one just writes :MyVar and the template engine figures out everything. Wish the original template engine had this possibility as it saves a lot of writing, and rewriting when the template needs a change.

But about a year ago I switched to the PHP5, XML, XSL, DOM, SPL way of doing things, and I never looked back. Particulalrly XML, XSL is way a more powerful, industry standard way for templates, and it's faster than any template engine. Also with XML it's much easier to develop RIA's (Rich Internet Application).

Bottomline I did halt all phpBB MOD development and am working on my own project.
In the interest of cutting costs, the light at the end of the tunnel has been switched off...

User avatar
MHobbit
Former Team Member
Posts: 4761
Joined: Thu Mar 18, 2004 5:32 pm
Location: There and Back Again

Post by MHobbit » Tue Nov 01, 2005 1:57 am

Though you may not update this MOD anytime, you should add a proper topic title prefix, in accordance with this forum's rules. :wink:
Former phpBB MOD Team member
No private support is offered.
"There’s too many things to get done, and I’m running out of days..."

Disturbed One
Registered User
Posts: 129
Joined: Sun Apr 03, 2005 12:31 am

Post by Disturbed One » Wed Nov 02, 2005 2:05 am

A MOD better than this has been made called eXtreme Styles. It has all the same functions and more.

http://phpbbstyles.com

Locked

Return to “[2.0.x] MODs in Development”