Joomla & WordPress Tutorials, Info, Discussion, Tips | GavickPro Blog

Changing the template name: a relatively pain-free guide

So you’ve finally finished your client’s site. After finding just the right template to use as a baseline, you’ve painstakingly modified and updated it to perfectly match your client’s needs. Everyone seems pleased with your work, but a week later you get an email; apparently, one of their guys who knows a thing or two about web development took a look at the site and noticed that it was loading a template! They’re shocked; shocked and appalled; shocked and appalled and astonished that you would stoop so low as to pass of someone else’s work as your own; I mean, it’s just not polite.

Truth be told, this situation doesn’t happen as often as it could, but there’s always the risk that a client will fail to appreciate that a template is just that; a baseline to work from, and not a complete website that comes ready-made off the shelf ready to be sold on. You may have spent hundreds of hours modifying and personalizing the template, but this can be hard to explain to someone not in the know.

So how do you mitigate this risk? By hiding and/or changing the template name, of course! By hiding the name or customizing it to suit your client’s company you can avoid any misunderstandings and sleep soundly at night (permit me some artistic license; I know most web developers are night owls, but “sleep soundly at some point between 4am and midday, if I’m lucky” doesn’t have the same ring to it).

The method we’ll describe here isn’t the only way to achieve this goal, but it’s simple and doesn’t require too much messing around with files, so even relative newcomers should find this a comfortable experience. Well, not uncomfortable, at least.

Important. If you’re doing this with our template, bear in mind that our license allows for the modification of the template name and template files, but the copyright information in the CSS/HTML or PHP files should be left untouched. Our developers work hard, and we want their hard work and input to be recognized, even if it’s in a small way.

Where is the template name visible in Joomla?

As you may be aware, the template name isn’t visible anywhere on the frontend, but if someone checks the page source code then they may notice that the gk_template_name appears in the links to the included CSS or Javascript files. There’s a bigger problem than that on the client side though, since they can just go the Extensions >> Templates in the menu and see the template name there, looking rather guilty. We’ll look at resolving these issues now, so no mention of the product name will appear on the front or backend.

You’ll find the whole process much easier if you make the decision to change the template name before you actually install anything, since then you can avoid making changes to the database and access to phpMyAdmin won’t be necessary. Even if you want to use the quickstart package you can just install the quickstart as normal, then download the clean template and change its name before installing as a second template. This might seem counter-intuitive at first, but this way you’ll already have the modules and demo content ready to go, and you’ll just need to import the template settings into the second version of the template after you’ve set it as default. Of course, you’ll have two of the same template for a minute, but they’ll have different names so it’s easy to discern between the two.

We think that this is the best setup if you want to save time during development process. But the basic thing to take away is this; whether you use the quickstart package or a clean install of Joomla, you’ll still need to download the clean template package from our Download area.

Renaming the template before installation.

Actually renaming the template takes no time at all and requires just a few simple steps:

  1. Unzip the template package locally, which will leave you with a directory called gk_template_name, where template_name is the template name, just in case you didn’t guess!

  2. Rename the directory to whatever you want the new name to be; you can just use one word like myname or several words with underscores custom_name_template. The one important thing to remember here is to not use spaces or special characters in this name or you’ll break something.

  3. Open the templateDetails.xml file with the editor of your choice and replace every occurence of the old template name in this file with your new name – there should be several instances that need replacing so you can use the find and replace feature to save a bit of time and avoid missing any.

  4. This step is the most complicated and tedious of the lot as you’ll need to replace the template name in the other template files; this means opening each file, searching for any instances of the old gk_template_name, and replacing them accordingly. If you’re not fond of the idea of opening every file, then you might want to look at using an editor that offers more robust search options, like allowing you to search through multiple files and directories. We like to use Sublime Text for this; even in the unregistered version you can perform an in-depth search within a few clicks. Just open the editor’s menu and select Find » Find in Files, select the directory with all the template files in, then click on the file name to automatically open every file you need to modify. If you’re a fierce traditionalist who doesn’t go for these new fangled search methods and prefer the good old file by file search, the most common template files that need changing are:

    • layouts/default.php
    • language/en-GB.tpl_gk_template_name.ini (filename)
    • js/gk.scripts.js
    • admin/scripts.js
  5. Once you’ve finished finding and replacing you need to zip the directory up again so that it’s ready to install through the Joomla backend. The ZIP package’s name should be yourNewName.zip and this file may be installed directly via the Joomla extension manager as normal.

That’s it – now your template is installed as a totally separate product that looks suspiciously like the original template, and you can start making changes without fear of the original template name rearing its head at an inopportune time.

What if the template is already installed?

If your template is already installed and customized and you don’t want to go through the hassle of reapplying your changes then it is possible to change the template name on a working, installed template. However, please, please remember to create a backup of your website before making any changes because we will be modifying the core Joomla database tables which can be a fast track to breaking something important.

First of all it is necessary to follow the first five steps from the above guide, but on the server side rather than locally. That means firing up your FTP or SSH connection and then accessing phpMyAdmin to modify the database. Most hosting companies provide this tool, but you may need to contact your provider for access details. After logging-in to the php admin panel we need to select the database where Joomla is installed, the click Search in the top menu.

In this view make sure to click on Select all tables to search through the entire database, then put the old template name in the search field, for example gk_gamenews. Now click on the search button, and wait for the results list to generate. Please note that only those tables where the Browse button is active contains the search phrase – usually it’s about 2 tables, but double-check to be safe!

When you click on the ‘Browse’ button the view should automatically scroll to the table view, where you may click on the Edit button to modify the entry. Like with the local name change you’ll need to swap the old template name with your shiny new one.

!Important Please note that direct modifications to the database are very dangerous and may damage your Joomla installation. Please always create a backup of the database (or entire website) before modifying the database, and certainly don’t do this while drunk. We take no responsibility for loss or damage of data; remember, backup, backup, backup!

Share