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

Post by ckwalsh »

I'll install/test when I get home :D
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 »

Thanks. Right now it's a deal-breaker for me, and I can't figure it out. I really want to move off of XS.
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.2

Post by drathbun »

I got the latest attachment MOD and downloaded the pre-modded files (they're for 2.0.21, so that's what I installed). I created a board with nothing but the attachment MOD and speedy template 0.1.2 and got the same issue. I expect you will find the same result. Either that, or it's a php issue with the fact that I'm on php 4 instead of 5...

I will PM you a link to the vanilla board where I have this installed if you like.
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.2

Post by ckwalsh »

Hmmm... What exactly are you doing to get that error?

I posted a couple times on your test board and have not gotten any errors. However, I am not seeing any attachment abilities (not installed yet?)

I've also tried it on my test board with attachment MOD and have no errors :(
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 »

I probably need to change the permissions. I was logged in as Admin. Registered users can post attachments now. Also, be sure to put the "te" option on the URL or you're just using the standard template.

I have added a topic with a link that should work to reply to the topic, but with &te=1 on the URL it switches to the 0.1.2 version of your code and generates the error.

You said it's working on your side. Wonder if it's a php4 thing again.
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.2

Post by ckwalsh »

Alright, I think I figured out what was going on. The attachment MOD directly accesses the files in the template variable, which I renamed. I don't know why it was working for me though (I think php5 might handle variables starting with an underscored differently?). I'll have 0.1.3 out tomorrow for you to try.

Hopefully that is the reason it was messed up and it will work now.
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 »

Brainy wrote:Alright, I think I figured out what was going on. The attachment MOD directly accesses the files in the template variable, which I renamed.
Sounds like a bad programming practice to me... who wrote that thing, anyway? :lol:
I'll have 0.1.3 out tomorrow for you to try.
That will be excellent. Last night I ran some numbers using the template_file_cache.php code found in the /contrib folder. Have you looked at it at all? It did quite well, and in fact I am using it on my largest board as of right now. I was desperate; I wanted to get off of XS and the engine from /contrib worked with the attachment MOD, so I went ahead and put it in place after running some benchmarks.

I still want to test your final version as well.
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.3

Post by ckwalsh »

I've got 0.1.3 released, so please try it and see if it works now.

An addition, below I've listed all of my file changes I made for testing so anyone can try. I was feeling lazy and didn't put it exacly in the correct MOD format, but eh :P

Code: Select all

#
#-----[ COPY ]----------------------------------
#

extreme styles TO includes/template.php
original template script TO includes/orig_template.php
speedy templates TO includes/speedy_template.php
file cache template TO includes/file_template.php

#
#-----[ OPEN ]----------------------------------
#

common.php

#
#-----[ FIND ]----------------------------------
#

<?php

#
#-----[ AFTER, ADD ]----------------------------------
#

$starttime = microtime(true);

#
#-----[ FIND ]----------------------------------
#

include($phpbb_root_path . 'includes/template.'.$phpEx);

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

$class_start = microtime(true);
$engine = isset($_GET['te'])?$_GET['te']:0;
switch($engine)
{
case 0:
	include($phpbb_root_path . 'includes/orig_template.'.$phpEx);
	break;
case 1:
	include($phpbb_root_path . 'includes/speedy_template.'.$phpEx);
	break;
case 2:
	include($phpbb_root_path . 'includes/file_template.'.$phpEx);
	break;
default:
	include($phpbb_root_path . 'includes/template.'.$phpEx);
        break;
}
$class_time = microtime(true) - $class_start;

#
#-----[ OPEN ]----------------------------------
#

index.php
memberlist.php
viewforum.php
viewtopic.php

#
#-----[ FIND ]----------------------------------
#

$template->pparse('body');

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

$parse_start = microtime(true);
$template->pparse('body');
$parse_time = microtime(true) - $parse_start;

#
#-----[ OPEN ]----------------------------------
#

includes/page_tail.php

#
#-----[ FIND ]----------------------------------
#

$db->sql_close();

#
#-----[ BEFORE, ADD ]--------------------------
#

$totaltime = microtime(true) - $starttime;
$db->sql_query('INSERT INTO template_times (engine, file, page_time, class_time, parse_time) VALUES (' . $_GET['te'] . ', \'' . basename($_SERVER['SCRIPT_FILENAME']) . "', '$totaltime', '$class_time', '$parse_time')");

#
#-----[ OPEN ]--------------------------
#

templates/subSilver/overall_header.tpl

#
#-----[ FIND ]--------------------------
# 

</head>

#
#-----[ BEFORE, ADD ]--------------------------
#

<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)) % 4);
	}
	window.location = url;
}
</script>

#
#-----[ FIND ]--------------------------
#

<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">

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

<body bgcolor="{T_BODY_BGCOLOR}" text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}" onload="setTimeout('nextPage()',500)">

#
#-----[ SQL ]----------------------------------
#

CREATE TABLE template_times (
  id int(10) unsigned NOT NULL auto_increment,
  `engine` smallint(5) unsigned NOT NULL,
  `file` varchar(63) NOT NULL,
  page_time varchar(31) NOT NULL,
  class_time varchar(31) NOT NULL,
  parse_time varchar(32) NOT NULL,
  PRIMARY KEY  (id)
);

#
#-----[ DIY INSTRUCTIONS ]----------------------------------
#

Make sure the cache folder is chmodded to 777 for caching to work.  For analyzing at the data, I found that this SQL statement created a nice, easy to read layout:

SELECT `file`, `engine`, AVG(page_time) AS page_time, AVG(class_time) AS class_time, AVG(parse_time) AS parse_time FROM template_times GROUP BY `engine`, `file` ORDER BY `file`, page_time
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.3

Post by drathbun »

Downloaded, will install on the test board shortly. Thanks.
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.3

Post by drathbun »

I'm afraid I still get the same error. :?

I cleared the cache completely. I checked the file, and the $version variable is set to 0.1.13 as

Code: Select all

 var $version = '0.1.3';
so I believe I'm running the current script. I'm running php4 and phpbb2.0.21 with the pre-modded files from the Attachment MOD. Other than that, I don't know what else to tell you.

I took out the branching code that checks for &te on the URL, and the only template engine in use right now is speedy 0.1.3.
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.3

Post by ckwalsh »

drathbun wrote:I'm afraid I still get the same error. :?

I cleared the cache completely. I checked the file, and the $version variable is set to 0.1.13 as

Code: Select all

 var $version = '0.1.3';
so I believe I'm running the current script. I'm running php4 and phpbb2.0.21 with the pre-modded files from the Attachment MOD. Other than that, I don't know what else to tell you.

I took out the branching code that checks for &te on the URL, and the only template engine in use right now is speedy 0.1.3.
This is being a pain :(

I'll put together a testing script to try figure out what's wrong, but I have no idea what is happening at the moment.
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.
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.3

Post by ckwalsh »

Brainy wrote:
drathbun wrote:I'm afraid I still get the same error. :?

I cleared the cache completely. I checked the file, and the $version variable is set to 0.1.13 as

Code: Select all

 var $version = '0.1.3';
so I believe I'm running the current script. I'm running php4 and phpbb2.0.21 with the pre-modded files from the Attachment MOD. Other than that, I don't know what else to tell you.

I took out the branching code that checks for &te on the URL, and the only template engine in use right now is speedy 0.1.3.
This is being a pain :(

I'll put together a testing script to try figure out what's wrong, but I have no idea what is happening at the moment.
[EDIT] Wow... It's amazing what grep will tell you... That message is from attach_mod/displaying.php. I'm looking into it and hopefully can get it working :D[/EDIT]

[EDIT2] Hmm... looking at the code I think was causing it, I'm surprised I didn't get that error (I was probably doing something wrong). I also feel like the wheel was reinvented for the sake of caching. The attachment MOD directly replaces a variable in the uncompiled code of the template class. Since I am structuring the data differently, it fails. I think the easiest way to fix it is to replace the offending function, but I don't really want to tell people with the attachment MOD to change some of it's code. It wouldn't be too hard to make sure it then didn't error when using other template engines, but I don't feel like telling people to change their attachment MOD for a templating engine.

What do you think?[/EDIT2]
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.3

Post by drathbun »

Sorry, I could have told you which part of the attachment MOD was generating the error. Even posting on the test board I set up would have done that. :)

I am not against modifying the attachment code. Fact is, many MODs have instructions for specific MOD compatability issues. Some of my MODs have issues with eXtreme Styles, so I have an extra installation instruction for users that use that code.

Just tell me what to change, and I will at least test it. :)
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.4

Post by ckwalsh »

Got it working. Get 0.1.4 (or add "define('SPEEDY_TEMPLATES', true);" to the one you have, they are the same thing :P) and make these changes to attach_mod/displaying.php:

Code: Select all

#
#-----[ FIND ]----------------------------------
#
function init_display_template($template_var, $replacement, $filename = 'viewtopic_attach_body.tpl')

#
#-----[ BEFORE, ADD ]----------------------------------
#
// Fix for Speedy Templates
if(defined('SPEEDY_TEMPLATE'))
{
function init_display_template($template_var, $replacement, $filename = 'viewtopic_attach_body.tpl')
{
	global $template;

	$template->set_filenames(array($template_var => $filename));
	$template->assign_var_from_handle(substr($replacemane, 1, -1), $template_var);
}
}
else
{

#
#-----[ FIND ]----------------------------------
#
	display_compile_cache_clear($template->files[$template_var], $template_var);
}

#
#-----[ AFTER, ADD ]----------------------------------
#
}
I'm not seeing any other parts of that file that will cause problems, so hopefully this is the last of it.
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.
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.4

Post by ckwalsh »

I know I have done some benchmarks here, but here are some more, using 0.1.4. I am posting them as images because then I have the nice colors without the 2.8 MB file. If anyone is interested in the raw data, just post or PM me and I'll send it right over.

All of these tests were done with the browsers changing pages 50 milliseconds after the page loaded :twisted:

=== 1 session with caching ===
Image

=== 1 session, no caching ===
Image

=== 5 sessions from same computer with caching ===
Image

=== 10 sessions from same computer with caching ===
Image
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.
Post Reply

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