1
#1
Minify HTML
Posted November 18th 2012, 3:36pm
Many people these days access phpBB3 with mobile devices, and more than a few are on data plans. Others do not have fast internet connections. In both cases, reducing the amount of data a page sends to the browser would be a good thing.

The phpBB3 templates are formatted with tab and end-of-line (EOL) characters to make them more readable. However, those characters are not removed before the page is sent to the browser, even though they are unnecessary to render the page. If you want to see the difference it can make, go to the index/home page on your own phpBB3 board and click the "View Source" option on your browser. Note all the whitespace garbage that has been sent to your browser. Now return to this board and click the "View Source" on the index/home page here. You'll notice a dramatic difference!

The following modification will show you how to remove those characters before phpBB3 sends a page to the browser.

Please log in to view this content.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Minify HTML
Posted November 20th 2012, 12:54pm
I'm confused with what templates I need to edit. :(
φ
Posts: 237
Joined: October 29th 2011, 11:00pm
Location: england, united kingdom, stoke on trent
Likes Given: 20
Likes Received: 4
Minify HTML
Posted November 20th 2012, 1:27pm
I think index_html and most of the editor related templates. Just do a quick search for CDATA in each of them.
φ
Posts: 64
Joined: June 17th 2011, 11:00pm
Location: 127.0.0.1/
Likes Given: 3
Likes Received: 2
Minify HTML
Posted November 24th 2012, 1:23pm
Ryan said:
I'm confused with what templates I need to edit. :(
idem

It may cause several conflicts with mods (phpBB Social Network and others)
φ
Posts: 23
Joined: September 25th 2012, 4:06pm
Likes Given: 14
Likes Received: 3
Minify HTML
Posted November 24th 2012, 2:39pm
Given the large number of MODs it breaks, somehow I'm not surprised that phpBB Social Network has a problem with this procedure. ;)

This procedure would cause a problem with a MOD if it was written to be dependent on whitespace (which is lazy and/or incompetent programming/design), or if it is also minifying HTML (in which case you don't need this procedure).

An example of such lazy/incompetent programming would be writing javascript which is dependent on the position of elements, such as a script which uses nextSibling.nextSibling to skip over a whitespace element to get to the adjacent element. Someone doing this IMO has no business writing scripts...
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Minify HTML
Posted January 21st 2014, 1:53am
I did as instructed above and the HTML is still formatted in Firefox and Chrome. It hasn't removed any of the white space.

Ideas please.
φ
Posts: 6
Joined: December 18th 2013, 9:38am
Likes Given: 2
Minify HTML
Posted January 21st 2014, 9:49am
Did you purge the cache from the phpBB ACP? Unless you are using phpBB-SEO, that is the only thing which would cause what you describe.

phpBB-SEO does some things with the templates to generate pseudo-static HTML pages. If those pages are being saved in a cache, you'll need to delete every page from that cache.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Minify HTML
Posted January 21st 2014, 12:10pm
I refreshed the style and purged the cache. Using out the box PHPBB (with mods). I'll check in the morning again.

Didn't get on with phpBB-SEO. It was a lot of work for very little gain.
φ
Posts: 6
Joined: December 18th 2013, 9:38am
Likes Given: 2
Minify HTML
Posted December 15th 2014, 11:17pm
Dion said:
phpBB-SEO does some things with the templates to generate pseudo-static HTML pages. If those pages are being saved in a cache, you'll need to delete every page from that cache.


Was there ever a fix for this? there doesn't seem to be any other place phpbb-seo holds cached files except maybe in its own phpbb_seo/cache/ directory but I even cleared that too.
φ
Posts: 22
Joined: February 9th 2013, 6:43pm
Likes Given: 7
Likes Received: 4
Minify HTML
Posted December 16th 2014, 12:44am
phpBB-SEO may be ignoring the template functions since it does its own things with pages. If so, then this hack would have no effect on phpBB-SEO.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
Post a reply
10 posts

Who is online

Users browsing this forum: No registered users and 1 guest