[BETA] Speedy Templates 0.1.6

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.
User avatar
Dog Cow
Registered User
Posts: 2499
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by Dog Cow »

drathbun wrote: So at the moment I am at a loss. :) It seems that this isn't really a bug, but somehow a feature of eXtreme Styles. There's no problem with going back and resetting language strings in my files, but I now am going to have to go through my board and find out other pages where I might have taken shortcuts and fix them.
This is the reason I love eXtreme Styles: It is the lazy man's joy!

It has code to look for a $lang['foo'] var if the {L_FOO} is empty. This means you do not have to declare loads of L_ vars in your PHP code, which I love.

phpBB3 template has same thing, in fact it is mentioned in phpBB3 coding guidelines.

This functionality is the main reason I am sticking with XS. :P
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookMac GUIMac 512K Blog
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

I've also discovered another issue... I can't post. I need to download the current code posted in this topic and see if I have the same issue. I never tested posting during my benchmarking because I didn't want to try to script something that complex. But when I try posting I get an eval() error.

I'll try the current code first, and see if it generates the same issue.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
Dog Cow
Registered User
Posts: 2499
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by Dog Cow »

Yeah, that's the bug I had too on my more "normal" phpBB2 tester forum, but I only mentioned it to Brainy via PM!

I tried removing things, and I got down to the poll box and topic review, and i think removing either one or both of those things may have solved it.
Dog Cow via PM wrote: On a more normal phpBB forum, I get parse error (something about STRING) on the posting page when cached. When not cached, it gives a template error about uneval'd code... Thought you ought to know.
Moof!
Mac GUI Vault: Retro Apple II & Macintosh computing archive.
Inside Allerton bookMac GUIMac 512K Blog
deny
Registered User
Posts: 565
Joined: Wed May 14, 2003 9:14 am
Location: Find-Ip-Address.org
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by deny »

I will probably wait om more stable version that all bugs are fixed.Just wonder of you can run Speedy Templates along with Extreme Styles or you must uninstall Extreme Styles?
Geolocation of any IP address including detection of hostname,
browser, country and country code with ip address range web tool.

IP Address Locator | Email Tracking | IP Address | Check Email
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

You cannot run both of them together. You have to pick one or the other.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by ckwalsh »

I think I found the bug that DogCow was getting and have it fixed with a new release (in the first post)

The code should be easier to read as I rewrote the compile function. The logic was barely changed, but it is a lot crisper and cleaner.

One thing i have noticed with this release is it seems to not be as efficient now. I don't really understand why this is (none of my changes should have slowed it down as much as it appears). However, in my testing it is also saying XS is slower than the default phpBB code, which I am pretty sure is not the case :P. I have a feeling my server needs a bit of TLC.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

Some quick feedback on the new code for 0.1.1

1. I had to purge all of the cached templates otherwise I got pages that were completely messed up

2. The new engine does not render my pages correctly. I have "title" text for my URL's, and the title text is coming out as the text for the link now. Here is the code generated in the template for one such link:

Code: Select all

<a href="<?php $this->print_var($t['U_FAQ']); ?>" class="mainmenu" title="<?php $this->print_var($t['L_FAQ']); ?>"><?php $this->print_var($t['L_FAQ_EXPLAIN']); ?></a>&nbsp;|&nbsp
Here is the code from overall_template.tpl for that same link:

Code: Select all

<a href="{U_FAQ}" class="mainmenu" title="{L_FAQ_EXPLAIN}">{L_FAQ}</a>&nbsp;|
And here is the code from page_header.php that pushes those values into the template:

Code: Select all

        'L_FAQ_EXPLAIN' => $lang['FAQ_explain'],
        'U_FAQ' => append_sid('faq.'.$phpEx),
        'L_FAQ' => $lang['FAQ'],
3. I still can't post, but this time I get an error about "Template->loadfile(): No file specified for handle attachbody". I have the attachment MOD installed. Since there were other issues I didn't try to track down where this error was coming from.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by ckwalsh »

Darn. I thought I wouldn't have many problems :P

I'll look into them :D

EDIT: I'm pretty sure I found the problem with the swapping variables and when updating now your cache shouldn't get messed up. Full, but not messed up.

However, i am dreadfully confused about the "Template->loadfile(): No file specified for handle attachbody", since that is not anywhere in the code o_O.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

Brainy wrote:However, i am dreadfully confused about the "Template->loadfile(): No file specified for handle attachbody", since that is not anywhere in the code o_O.
I will spend a bit of time to track it down and see if I can figure out what's going on. What I can say right now is that the same code works with eXtreme Styles, but it could be something like the missing language string handling I mentioned earlier.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

The same issue exists with the CH template. It works with eXtreme Styles and with standard phpBB template engine.

I also found out something else that XS was "fixing" for me, like the language strings. To be honest, I would rather it didn't. I would rather know there's a problem and get it fixed than rely on something guessing what my intentions were. But that's besides the point.

If I figure out what the template difference is as far as the call to the attachment MOD code I will come back and post it. But for now I have at least determined that it works in phpbb standard.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

Got another error, after I removed all references to the attachment MOD I get this:

Code: Select all

Parse error: syntax error, unexpected T_STRING in /home/forumtop/public_html/bobbeta/includes/brainy_template.php(157) : eval()'d code on line 19
When I look at the file that is referenced on line 19 I see this:

Code: Select all

$_str.= '                               <td class="row2"><span class="genmed"><input type="text" name="poll_option_text[<?php $this->print_var($t['poll_option_rows.'][$_0_i]['S_POLL_OPTION_NUM']); ?>]" size="50" class="post" maxlength="255" value="<?php $this->print_var($t['poll_option_rows.'][$_0_i]['POLL_OPTION']); ?>" /></span> &nbsp;<input type="submit" name="edit_poll_option" value="' . ( ( isset($t['.'][0]['L_UPDATE_OPTION']) ) ? $t['.'][0]['L_UPDATE_OPTION'] : '' ) . '" class="liteoption" /> <input type="submit" name="del_poll_option[<?php $this->print_var($t['poll_option_rows.'][$_0_i]['S_POLL_OPTION_NUM']); ?>]" value="' . ( ( isset($t['.'][0]['L_DELETE_OPTION']) ) ? $t['.'][0]['L_DELETE_OPTION'] : '' ) . '" class="liteoption" /></td>' . "\n";
If you look closely at the line, there are single quotes that are not matched out properly.

CH works okay with the same code, once I removed the attachment includes. I'm going to go back and see what it is about the attachment code that causes the earlier issue but thought I would post about this first.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by ckwalsh »

I just finished some testing with my latest code (0.1.2, now updated on the first page) and I would like to share the results I have gotten. I've tried to be as unbias as possible, but being the author of Speedy it's been hard. If you think I'm being unfair, please call me on it.

For this test, I wanted to time three different areas:
  • overall page generation,
  • parsing the template.php, and
  • parsing the main body of different pages.
I was testing three different engines (XS, Speedy, and stock) on four different pages (index, memberlist, viewtopic, viewforum). I also wanted to test how this was affected by the cache being deleted and the folder made unwritable, forcing the engine to regenerate each page view.

First things first, I set up a switcher for the templates by replacing the normal include in common.php to the following code:

Code: Select all

$engine = isset($_GET['te'])?$_GET['te']:2;
switch($engine)
{
case 0:
        include($phpbb_root_path . 'includes/orig_template.'.$phpEx);
        break;
case 1:
        include($phpbb_root_path . 'includes/speedy_template.'.$phpEx);
        break;
default:
        include($phpbb_root_path . 'includes/template.'.$phpEx);
        break;
}
I then added this javascript to overall_header.tpl to traverse the pages. a body onload event executed the function to move on to the next page. It's not nice, being thrown together from a couple google searches, but it works.

Code: Select all

<script>
function returnDocument() {
var file_name = document.location.href;
var end = (file_name.indexOf("?") == -1) ? file_name.length : file_name.indexOf("?");
return file_name.substring(file_name.lastIndexOf("/")+1, end);
}
function nextPage()
{
        engine = document.location.href.substr(document.location.href.length - 1, 1);
        file = returnDocument();
        if(file == 'index.php')
        {
                url = 'memberlist.php?te=' + engine;
        }
        else if(file == 'memberlist.php')
        {
                url = 'viewforum.php?f=1&te=' + engine;
        }
        else if(file == 'viewforum.php')
        {
                url = 'viewtopic.php?t=1&te=' + engine;
        }
        else
        {
                url = 'index.php?te=' + ((engine - (-1)) % 3);
        }
        window.location = url;
}
</script>
I then set up a timer using microtime starting at the top of common.php (for overall page time, not a completely accurate place to start, but close enough and easy to manage), a timer around the template switcher up above, and a timer on each page around the $template->pparse('body') call. These timers were then inserted into the database right before the connection was closed, along with filename and engine used.

I then cleared the cache, made it read only, and completed 500 tests for each page/engine combination, 6000 in all. After copying an overview of the data (I am absolutely in love with SQL views right now :D), I made the cache writable, ran through each page/engine once to generate caches, and cleared the table. I then did 500 tests for each page/engine again.

The results were surprising.

Total Page Time: These results really surprised me, because IMO it is the most important. As I hoped, Speedy performed the best, averaging 1.32 times faster than the stock engine when cached and 1.03 times with caching disabled, but in all except one page with caching XS actually performed the worst, up to 9% slower than the stock phpBB. I mentioned earlier that my tests were saying XS performed the slowest and I thought there was a problem with my computer, since everyone else got better results. I believe that they were measuring only page parse time, not overall page time, which resulted in faster times.

Template.php Parse Time: As expected, this was fairly constant for each engine, independent of caching enabled or page loaded. This appears to show why XS achieve worse results in the total page time: it loaded 5 times slower than the stock engine. Looking at the file sizes, this makes sense, since it is comparatively so much larger than Speedy or the stock templates.

Parse Time: I was very pleased with these results. I'll admit I used the XS cached templates to reverse engineer some of the things XS does to improve it's parse time, and they worked. Speedy ran an average 3.2 times faster than the stock phpBB when cached, beating XS which ran 2.25 times faster. However, XS won the speed competition when the cache was unwritable, running 1.32 times faster when Speedy ran only 1.11 times faster.

Conclusions: Concerning overall performace (which I measured with page generation time), XS may not be the best choice. The stock engine or Speedy would be a better choice. However, neither has the rich feature set of XS, which besides being the only engine with that capability provided has only a small speed decrease compared to the stock template.

One thing to survey next round of testing I do (whenever that may be) is how much of a memory footprint and cpu usage each engine has. However, i do not know exactly how to test this, so if anyone has any suggestions I would love to hear them.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by drathbun »

In my testing I focused on the body parse time but I also captured the page generation times. I would be happy to share my numbers, or run your tests to your exact specifications on my server in order to compare apples to apples. :)

I will download and test the latest version now. And as before, a huge thanks for your efforts on this.

[Edit]I had to remove the "static" definition on one of your functions because I'm on php4. Also, the posting process still does not work. It seems that the code to load the attachment template is not getting the proper path somehow. That may be my fault as I have cached some of the template information; I will look at that and see.[/Edit]
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
ckwalsh
Former Team Member
Posts: 1837
Joined: Wed Mar 15, 2006 1:50 am
Location: Seattle, USA
Name: Cullen Walsh
Contact:

Re: [BETA] Speedy Templates 0.1.0

Post by ckwalsh »

drathbun wrote:Got another error, after I removed all references to the attachment MOD I get this:

Code: Select all

Parse error: syntax error, unexpected T_STRING in /home/forumtop/public_html/bobbeta/includes/brainy_template.php(157) : eval()'d code on line 19
When I look at the file that is referenced on line 19 I see this:

Code: Select all

$_str.= '                               <td class="row2"><span class="genmed"><input type="text" name="poll_option_text[<?php $this->print_var($t['poll_option_rows.'][$_0_i]['S_POLL_OPTION_NUM']); ?>]" size="50" class="post" maxlength="255" value="<?php $this->print_var($t['poll_option_rows.'][$_0_i]['POLL_OPTION']); ?>" /></span> &nbsp;<input type="submit" name="edit_poll_option" value="' . ( ( isset($t['.'][0]['L_UPDATE_OPTION']) ) ? $t['.'][0]['L_UPDATE_OPTION'] : '' ) . '" class="liteoption" /> <input type="submit" name="del_poll_option[<?php $this->print_var($t['poll_option_rows.'][$_0_i]['S_POLL_OPTION_NUM']); ?>]" value="' . ( ( isset($t['.'][0]['L_DELETE_OPTION']) ) ? $t['.'][0]['L_DELETE_OPTION'] : '' ) . '" class="liteoption" /></td>' . "\n";
If you look closely at the line, there are single quotes that are not matched out properly.

CH works okay with the same code, once I removed the attachment includes. I'm going to go back and see what it is about the attachment code that causes the earlier issue but thought I would post about this first.
I missed your post when posting my big long one. Are you sure you are using the correct code? With your first error (The loadfile error) the version available at the time didn't contain that function or string. It also did not use that syntax for the jumpbox (or any other variables assigned by a handle).

Would you check if your browser is caching the old code? I'll double check the download link on the first page also, to see if it's my mistake.

As for your testing, I'll send you the files I modified so you can double check them and use them on your server.

[EDIT] Oops about the static method. I had forgotten it was php5 only. Will be removed next version. With that change I'll re-run my tests and update the above post accordingly.
Where to post what | Forum Rules | The Dos and Don'ts of General Discussion
In Seattle and want to meet, chat, or have a coffee? Drop me a PM.
User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: [BETA] Speedy Templates 0.1.2

Post by drathbun »

You were correct, I was using older code. My last post was related to 0.1.2 version, and it's still not working with the attachment code. I removed my cache of the theme information (reverted back to the standard phpBB2 method of querying the data) and the issue remains.

I spent a little time digging into the code for the attachment MOD, but right now I am working on a rather large project so I have less time to dig into this. Do you have the attachment MOD installed on your board? If not, can you do that as a test and see if it is a general issue with the attachment MOD, or something in my code?
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image
Post Reply

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