MyBB Community Forums

Full Version: what is wrong with this code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am trying to insert a new template into the global template list during a plugin install but i keep getting sql errors

	//add new global template
	$template = array("title" => "delayedpost",
                      "sid" => "-1",
                      "template" =>"<br />&nbsp;&nbsp;<strong>{\$lang->delayedpost_label1}</strong>{\$lang->delayedpost_label2} <label><input type=\"text\" id=\"delayed_post_time\" maxlength=\"25\" size=\"25\"/>&nbsp;<img src=\"{\$theme['imgdir']}/cal.gif\" onclick=\"javascript:NewCssCal('delayed_post_time','MMddyyyy','arrow',true,'24')\" style=\"cursor:pointer\"/></label>");

what is wrong with template? the error is attached. i have tried single and double quotes, escaping various ways, etc
Have you tried this;
    //add new global template
    $template = array("title" => "delayedpost",
                      "sid" => "-1",
                      "template" =>'<br />&nbsp;&nbsp;<strong>{$lang->delayedpost_label1}</strong>{$lang->delayedpost_label2} <label><input type="text" id="delayed_post_time" maxlength="25" size="25"/>&nbsp;<img src="{$theme[\\\'imgdir\\\']}/cal.gif" onclick="javascript:NewCssCal(\\\'delayed_post_time\\\',\\\'MMddyyyy\\\',\\\'arrow\\\',true,\\\'24\\\')" style="cursor:pointer"/></label>'); 
that worked. i had done similar but not with the triple escapes. its worked for me other times, but not this time. so strange.

thanks for the tip
No problem. Glad it works. =)
It's easier to use $db->escape_string to do escaping for you. (except the single quotes for js)