x
 
Create New Page

Revision: Change Weblog Parameter via Database Queries

Revision from: 21:01, 18 Aug 2006

Changes are made at your own risk and are not guaranteed, either by the author or the administrator, to work. You should always make backups of the original files so that you can revert back to them, as well as backups of the database in case you really mess up.

Best Practice
Make a duplicate copy of your original weblog template group, or create a backup copy. This allows you to rollback quickly to a pristine version of the original templates.

Also, note with hacks that they are dangerous and can cause your site to stop working. They also make later updates to EE more difficult and you should track the hacks you use if you are going to use them, or you may lose the functionality later on down the line when you upgrade.

Reusing Templates For the Lazy and Brave:

If your templates contain assign_variables for template name and weblog name at the top (eg. {assign_variable:template_name=“broadband”}) then when you use this template group for another weblog, you have to go through changing each of these variables. Here is a quicker way, but as with all direct changes to databases, it is easy to screw things up badly!!!

Find the group_id of the template_group you want to change:

select * from exp_template_groups;[code]

Then run the following query replacing
"oldname", "newname" and "mygroupid" as required.

[code]
update exp_templates set template_data
=
replace(template_data,'oldstring','newstring')
where group_id=mygroupid;

If there is a chance you have used oldstring elsewhere in the template, be more specific:

update exp_templates set template_data= replace(template_data,
'assign_variable: template_name="oldstring"',
'assign_variable: template_name="newstring"')
where group_id=mygroupid;

IMPORTANT Remove the linebreaks in the queries.

Category:Templates Category:Database

Categories: