x
 
Create New Page

Revision: Change Weblog Parameter via Database Queries

Revision from: 18:30, 8 Jul 2007

Changes are made at your own risk and are not guaranteed to work. Always make backups of the database and files prior to implementing hacks. Make a special backup of the file and/or template you are modifying so that you can roll back quickly.

Hacks are dangerous and can cause your site to stop working. They make later updates to ExpressionEngine more difficult; you should track your hacks for post-update re-implementation. 

Most hacks are unnecessary, please review the Development Documentation for information on expanding ExpressionEngine via Modules, Extensions, and Plugins.

Hacks are never officially supported.

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;

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

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: