I got the error below while installing

Parse error: syntax error, unexpected T_STRING in sites/all/modules/node_template/nodetemplate.module on line 212

$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d', $nid));

I don't know how to create patches so i'll just post the fix. Single quote used to close Double quote. Just replace single quote with double quote at the end of the query string.

$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d", $nid));

;)

CommentFileSizeAuthor
#5 nodetemplate.module.patch672 bytesfoxfabi

Comments

muximus’s picture

Sorry same error on the following lines

Line: 257
change
$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d', $nid));
to
$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d", $nid));

Line: 114
change
$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d', $nid));
to
$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d", $nid));

Line: 281
change
db_query("INSERT INTO {node_template} (nid, is_template, shared) VALUES (%d, %d, %d)', $nid, 1, 0);
to
db_query("INSERT INTO {node_template} (nid, is_template, shared) VALUES (%d, %d, %d)", $nid, 1, 0);

paskainos’s picture

FYI: I received a similar error:

Parse error: parse error in ... nodetemplate.module on line 212

I made the same changes:

%d'

to:

%d"

on lines 208, 253, and 277 (in nodetemplate.module) which seems to have fixed it in my case.

edan7’s picture

Priority: Critical » Minor

FYI -

Encountered this issue with 6.1 but seems to be resolved for me (so far) with dev version 6.x-1.x-dev.

majorbenks’s picture

I got the same error: Parse error: syntax error, unexpected T_STRING in sites/all/modules/node_template/nodetemplate.module on line 212

But in my file the %d' is a %d" but it is still not working

Here is that line of code where the error comes:

db_query("INSERT INTO {node_template} (nid, is_template, shared) VALUES (%d, %d, %d)", $nid, 1, 0);

And this line is in this environment:

if (variable_get('node_template_without_clone', TRUE)) {
				$nid = $form_values['nid'];
				$existed_node = db_result(db_query("SELECT COUNT(*) FROM {node_template} WHERE nid = %d', $nid));
				if ($existed_node > 0) {
					db_query('UPDATE {node_template} SET is_template = 1 WHERE nid = %d', $nid);
				} else {
					db_query("INSERT INTO {node_template} (nid, is_template, shared) VALUES (%d, %d, %d)", $nid, 1, 0);
				}
				drupal_goto('node/'.$nid);
			} else {
				duplicate_node($form_values['nid']);
			}
foxfabi’s picture

StatusFileSize
new672 bytes

i have changed the " with ' on lines: 208, 253, 277