Header Scripts

You may occasionally run into a situation where you cannot install a template in your Joomla 2.5 site with Upload Package File in the Extension Manager. When this problem occurred in  Joomla 1.5, it was easy to fix because all that you had to do was upload your template into the templates folder and then you can set it as your default site theme. In Joomla 2.5, copying the template into this folder isn’t enough because you need to create entries in the database to recognize it.

The stored procedure below will add the appropriate entries to jos_extensions and jos_template_styles in your database. The prefix (jos_) for your tables is probably different so you’ll need to modify the script to match the actual value.

———-[ createtemplate.sql ] ————————————

DELIMITER //

CREATE PROCEDURE CreateTemplate (IN sTemplateName VARCHAR (255))
  BEGIN
    INSERT INTO jos_extensions (name, type, element, client_id, enabled, access, protected, manifest_cache, params, checked_out, checked_out_time, ordering, state)
      VALUES (sTemplateName, ‘template’, sTemplateName, 0, 1, 1, 0, ‘{}’, ‘{}’, 0, ‘0000-00-00 00:00:00’, 0, 0);

    INSERT INTO jos_template_styles (template, client_id, home, title, params)
      VALUES (sTemplateName, 0, 0, sTemplateName, ‘{}’);
  END //

DELIMITER ;

———-[ createtemplate.sql ] ————————————

After you run the script, a stored procedure will be created in your database and you can run the following query to install your template:

         CALL CreateTemplate (‘my_template’);

where my_template is the name of the template that you are installing.

You can download the SQL script here.

Print Friendly, PDF & Email
Translate »