Compiling and tweaking styles in phpBB

Many fancier phpBB styles are now written to be “compiled”. This means that if you need to make changes to a stylesheet, you actually need to find the right .sccs stylesheet and edit that instead of the traditional approach of editing a .css file. If your style uses this approach, you will find these .sccs files in the theme folder of your style.

Unfortunately, after editing these files no changes are automatically affected on your website. You must “compile” these .sccs files into a stylesheet that the browser will recognize, i.e. with a .css suffix. In the phpBB world this generally means compiling all these .sccs files into one file, stylesheet.css. Once that file is rewritten the changes will be applied by the browser.

Using Chrome's developer tools to inspect the CSS for a page object
Using Chrome’s developer tools to inspect the CSS for a page object

How do you know what .sccs file to edit? It’s hard to know when a stylesheet is compiled since all the styling is in stylesheet.css. It helps to “snoop around”. If you use Firefox, Firebug is a great tool for doing this snooping with its object inspector. Firebug was such a hit that Google decided to basically clone it for its Chrome Browser as Chrome Developer Tools. It’s already built in. On the Chrome menu you can find it under View > Developer > Developer Tools. If you don’t have the menu showing, click on the three vertical dots near the top right corner of the page, then More Tools > Developer Tools.

In the example shown, I used the object inspector in Chrome Developers Tools to look at the <div> object containing the search box. This gives a clue to how I might change the background color of the search box. In this example I used the default prosilver style, which does not use .sccs files. However, it does say that I need to change the .search_header style to change its background color. In this case I know it’s in colours.css, but in a theme using .sccs files you’d have to hunt for the file containing the style. It’s often not too hard based on what you are looking at, its intended purpose and the .sccs file names.

The nice thing about both these tools is that you can test changes in the tool on the styles tab of the tool. Once you have it looking right, you can apply the change to the appropriate .sccs file.

How do you compile these .sccs files? If running phpBB 3.1, there’s a little known extension that allows you to do it. (It is little known because it is not considered an official phpBB extension, so you have to get it off the Artodia website instead.) Install it as you would any other extension then find it on the customise tab in the ACP under “Compile Themes”. Once compiled, go test it. There should be no reason to purge the cache, but if you don’t see the changes you may need to clear your browser’s cache.

If you have a phpBB 3.0 style that uses .sccs styles, look for documentation with the style on how to compile it.

Many of these styles have a control file used to easily change colors, fonts, common object widths and heights, etc. It is probably called _style_config.sccs.

If curious, SCCS means “Sassy CSS” files which are described in more detail on the SASS website.

Smartfeed 3.0.5 available

Version 3.0.5 of Smartfeed is available for download. It has not yet been approved by the phpBB Extensions Team, but approval is expected eventually.

The release’s principal new feature is the ability to integrate feeds from external sources into your forum’s newsfeed. As with the 3.0 modification, the SimplePie library is used, which is placed in a vendor/simplepie/simplepie folder in the archive.

The code has been thoroughly cleaned up by using the PHPStorm IDE.

The archive is available here or can be downloaded from GitHub.

July 2016 work summary

Fewer clients last month but plenty of work to keep me busy and my most profitable month so far this year. I spent a good part of a week on one rehosting detailed below.

  • See this blog post on the lack of virtues of Aabaco hosting, truly the worst host on the Internet.
  • I upgraded a forum from phpBB 3.0.11 to 3.1.9. During the upgrade, experienced weird hosting issues with FTP, the web host file manager and with the database. While the upgrade seemed to go okay (no button labels appeared during it) things looked off. I looked at schemas and made manual corrections to them, hundreds of alterations altogether to make the tables reflect my 3.1.9 reference installation. I removed all but the British English language pack. I installed elegance, black and bb_mobi styles. There was lots of fine tuning working through various issues. I sent support ticket to client’s web host, since the file problems were on their side. It turned out they were due to an old cPanel installation and they had not upgraded the client. Things eventually calmed down. I applied old logo to the black and elegance styles.
  • Facebook like and share buttons that I added a year or so back for a client weren’t working on the view topic screen. Apparently the code to use had changed subtly. I replaced code in the iframe with latest code on Facebook site and it worked again.
  • More work for the client last month whose dedicated server was wiped and reloaded. User recovered his database using phpBB’s built in capability. Afterward, certain users could not login if there was a special character in their username, such as a “!”. I tried a number of approaches, eventually installed the Support Toolkit (since he had a phpBB 3.0 forum), ran the clean usernames function and that solved the problem. After repeatedly trying to login, some users got a “Not possible to convert password” error. Set the user_pass_convert column to 0 for all. In addition the user_email_hash was incorrect. Found a program to update it and that problem went away too.
  • This was my big project of the month. The user’s forum had been guest hosted on a nonprofit’s website for many years, on a host running Windows and the IIS web server. Performance was very slow. The user had a huge amount of images attached to his posts. The images folder exceeded 30GB! He wanted to get off the nonprofit site and onto a site running Linux for the faster performance. The new host was on Network Solutions where he had a contract that allowed unlimited shared hosting. With help from his tech support guy on the non-profit’s site, the client moved files and an extract of database to new Network Solutions hosting. The files containing an extract of the database did not import in phpMyAdmin and would not finish with even when I tried with bigdump.php, a staggered importer I often use on share hosting. I was able to load it into my local database after I downloaded it. I first snipped out SQL to populate the search tables and the log tables since those weren’t needed and consisted of most of the 500MB database extract. I created these tables from a reference and left them unpopulated. I then exported my local database using phpMyAdmin doing one SQL statement for every row, so bigdump.php could import it. I was then able to import the data into the client’s database. However, many primary keys and indexes were missing that I had to add by comparing his tables to my reference 3.1.9 database. I also had to add auto_increment to many primary keys. As we slowly stood up the rehosted forum, HTTP 504 Gateway timeout errors occurred while recreating the search index. These were likely due to going over some nebulous quota with the database server because he was populating tables. A call to technical support temporarily solved the problem. But eventually these 504 gateway timeouts took over stopping all traffic. I did finally notice that the server was running PHP 7. I downgraded PHP from 7 to 5.3, since phpBB 3.1 does not support PHP 7. Gateway timeouts continued irregularly. Discovered that images over 131K could not be uploaded with a post, even after changing PHP settings to allow it. The problem was his Apache web server limited uploads to about 131K. Then it was discovered that certain images (PNG images it looks like) were corrupt. So I downloaded all 30GB of these images again and then uploaded them to his host and this time the PNG images arrived uncorrupted. However, we could not fix the file upload issue because only Network Solutions could do this, and since he is using shared hosting they had to change it for everyone. There was lots of back and forth with technical support on this issue and they said it couldn’t be done. This was very strange because few people will use shared hosting with this limitation. The client eventually called the CEO of (which now owns Network Solution) to complain. They eventually fixed something and the problem went away. This was a very frustrating week long endeavor that frustrated the users of the forum, but was eventually resolved with lots of persistence and complaints to Network Solutions. When things were finally settled down I went to the next step. I upgraded forum from 3.0.12 to 3.1.9. More gateway timeouts on upgrade meant yet another call to technical support. Eventually I got the upgrade script to succeed by ignoring timeouts. I had to remove one index from search table to finish the upgrade. I tweaked the prosilver style to give it white background. I centered logo image and moved the search box down. I installed the Board Announcement and Share On extensions. Customer placed ads on a template. Tweaked Board Announcements to show only on the index. The customer finally was fully rehosted, fully upgraded and things finally seemed to be working well.
  • Upgraded a forum on GoDaddy hosting from 3.0.11 to 3.1.9. Backing up database was tough due to hosting timeouts. I finally succeeded by making 4 partial backups. Installed the premium Metro style, only black and white was enabled. An error occurred during upgrade because an index already existed on the search table. I dropped it and upgrade completed.
  • Installed phpBB 3.1.9 (new install) after user had issues doing it himself. Issue getting into control panel made things needlessly time consuming. I did a little basic tutoring on setting up forums, groups and group forum privileges with the client via a screen sharing session online. I helped configure his forum, added forums, and added a spambot countermeasure. He’s trying to integrate this into a WordPress site. It’s likely I’ll help him with that in August.