[Beta] Template Replace

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.
Post Reply
Fubonis
Registered User
Posts: 359
Joined: Sun Dec 02, 2001 6:05 am
Contact:

[Beta] Template Replace

Post by Fubonis »

Template Replace
Basically, it creates a new database table. This will hold the record ID, the template variable name and the value. The variable/value array is made when includes/page_header.php is called and builds/assigns the variables/values from the database table into the template object. Now, those can act as regular template vars.

Download
Read Install.txt

Login as an administrator, under the General Admin category menu, there should be a new option, Template Replace. Click this and add a new variable/value.

For the example, make the Key TEST_VAR and the Value <font color="red">Testing Template Replace</font> and submit the form.
It should now be in the database. All you need to do now is edit a template file, and add the new variable. Open templates/subSilver/overall_header.tpl and add {TEST_VAR} after {SITE_DESCRIPTION}. Load up your forum, and now, near your site's description, you should see Testing Template Replace.

Report any bugs or abnormal things here. Feature requests, too, if you can think of any.
phpBB, more like idon'tlikeyouorwhatyoupostedsoi'lllockyourtopicandthendeleteitBB m i rite???

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic »

nice idea!

i've wondered for a while now why all the language stuff is not stored in the db and accessible through the admin panel? I'm sure there is probably a good reason for it :?
Defend the game:
Image

Fubonis
Registered User
Posts: 359
Joined: Sun Dec 02, 2001 6:05 am
Contact:

Post by Fubonis »

Thanks for the feedback.

I think the general issue was speed. The $lang array is huge, so each time you needed the language vars, you'd have to query the DB, then loop through the result and make the array.
phpBB, more like idon'tlikeyouorwhatyoupostedsoi'lllockyourtopicandthendeleteitBB m i rite???

Fubonis
Registered User
Posts: 359
Joined: Sun Dec 02, 2001 6:05 am
Contact:

Post by Fubonis »

Beta 2.0.0

Fixed some mod template errors, added the SQL query for the table

2.0.0 allows the administrator to use PHP with the replacements, or just normal text.
phpBB, more like idon'tlikeyouorwhatyoupostedsoi'lllockyourtopicandthendeleteitBB m i rite???

Post Reply

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