Closed (fixed)
Project:
Content Templates (Contemplate)
Version:
5.x-1.1
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2007 at 21:31 UTC
Updated:
7 Oct 2011 at 00:24 UTC
I entered some bad php into a template and now when I view any node of that type, or the template edit page for the type, I get part of the node content and the bad php with an error. Is there a way I can manually "reset" the nodes template--perhaps a url I can use? I looked at the code, but the "reset" submit button runs with some js and I don't know if I can enter code on the page to replicate the function.
I would normally just go into the DB, but I don't have phpmyadmin or anything to easily go through the tables on this server.
Comments
Comment #1
inforeto commentedThis module should have a delete or disable link.
Or at least not to run the code in the editing page.
A page to a blank form to resubmit the template should work too.
Suggestions on implementation?
Here's duplicates:
http://drupal.org/node/123061
http://drupal.org/node/137719
Comment #2
jrglasgow commentedGoto admin/content/templates will allow you to select the node type, then you can reset, or fix the problem.
Does this fix your problem?
Comment #3
inforeto commentedThat's not possible because you get the php error on the template page.
To reset from the database:
update contemplate set body = "blank text" where type = "content_type_name";
There should be a way to reset templates, would this take a feature request or a bug request?
Comment #4
inforeto commentedok. leaving this as support request
here's related:
http://drupal.org/node/101144
http://drupal.org/node/113980
http://drupal.org/node/123061
http://drupal.org/node/137719
http://drupal.org/node/220374
Comment #5
jrglasgow commentedthe ability to delete the template(this will remove the row in the database for that template) will be on the admin/content/templates page, this will appear in 5.x-1.9 releasing tonight
Comment #6
inforeto commentedthanks! a much wanted feature.
Comment #7
jrglasgow commentedComment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
primalmedia commentedActually you may not have to delete it. I saved my [explative deleted] by deleting the offending code in phpMyAdmin. All I did was search for the exact phrase and I was able to isolate and remove it without having ot re-create an entire Content Type. Whew!
Adam
www.primalmedia.com
Comment #10
mscheine commentedYep, going to PHPMyAdmin worked for me as well. Go to the Acquia-Drupal database (if you're using Acquia Drupal), and all your custom templates should be on the table "contemplate". Change the body to remove the offending code and you're good to go.
Comment #11
DropInTheOcean commentedHi For Drupal 6 - Just in case you don't have access to PHPMyAdmin (and DBA module is unavailable).... You can export the Contemplate table via the 'Backup and Migrate module'. Then you can delete the problematic template on admin/content/types/templates. Then you can obtain a backup of the template from the exported Backup and Migrate file (I imported it to a local version of phpMyAdmin). Modify before re-trying.
Comment #12
sockah commentedBeautiful. Using PHPMyAdmin to cut out the bad php just saved me a ton of time.
Not sure why, but when I have bad PHP code in Contemplate, I can't edit the Contemplate fields any longer. When I try to edit, I'm instead taken to actual node content like the original poster. This is in Drupal 6 for me.
Comment #13
inforeto commentedPHP is sensitive to bad code in eval, which is the case with templates.
e.g. things like drupal_goto take you to the node in the same fashion, breaking cron.
Another way to work around is to open two browser tabs with the contemplate fields, so you can clear from the 2nd.