Updated c5Touch Theme for 2013 (PHP syntax fixed)
In case you couldn't tell, I've been working a lot with concrete5 recently. Now that I've got things in a stable condition I'm trying to get the c5Touch theme working. It's not as easy as drag & drop. I had to alter the source files to get it to work on my server which does not allow PHP Short Tags.
This article will help you get the theme updated & installed.
Note: Download link is at the bottom of the page if you want the fixed c5Touch theme.
References:
- c5Touch theme [concrete5.org]
- Concrete5: What is a theme? [concrete5.org]
- New theme not showing up in Dashboard [concrete5.org]
- PHP Best Practices [odi.ch]
- PHP Security Tip: Beware the Opening Tags [nealpoole.com]
- BlackBerry Web Inspector [docs.blackberry.com]
Troubleshooting & Root Cause
To figure out why the theme wasn't loading on my mobile device I fired up the Web Inspector on my blackberry and examined the response from the server. It looked like I was getting back the raw default.php file which was puzzling since I knew I had PHP enabled on my server.
Digging around a little I found that this theme relys on PHP's short open tags. Since my server is not setup to serve PHP files using this syntax, Apache is just returning the raw php page file contents.
Possible Solutions
There is one solution and one work around to get the c5Touch theme working on web servers like mine. The work around involves altering the short_open_tag option in the PHP INI file like this:
I consider this to be a work-around since it isn't best practice to run PHP files that use the abbreviated syntax. This does work, though.
The Solution to the problem is to alter the c5Touch theme to use the correct PHP Syntax. This means:
- Replacing occurances of <?= with <?php echo
- Replacing occurances of <? with <?php
For convenience, I'm providing the altered c5Touch theme for download at the bottom of the page. That's right, just scroll down to the bottom and save yourself some hassle. :)
Installing the Theme
I had some trouble figuring out how to install a new concrete5 theme. While I'm sure there's a concise page out there in 'the web' somewhere, Here's what I had to do to get concrete5 to recognize a new theme in the Themes area of the dashboard:
- Extract the theme into the <siteName >/themes directory of your concrete5 website
Note: Do not place the theme in the <siteName >/concrete/themes directory. That is not the place for the custom theme - Ensure that apache (or whichever http server you use) can access the directory contents. These 2 commands worked on my box (I'll tighten them up later):
chown -R <siteName >/themes/c5Touch
chmod 777 -R <siteName >/themes/c5Touch - Login to your concrete5 Dashboard and go to the Themes area.
- There should be a new theme available for you to install (bottom of the page). Click on it to Install
- In Concrete5 v5.6, there is a mobile theme switcher built in. Select the c5Touch theme
At this point if all has gone your way, you should be able to login from your favorite mobile device and see your website through the lense of a mobile theme.
Download
Since the c5Touch theme is distributed under the GPL I can release my alterations to anyone who wants them. If you make any enhancements, post below in the comments.