[TYPO3-english] Inserting TS Config Text into sys_template

Xavier Perseguers typo3 at perseguers.ch
Mon Apr 12 11:57:23 CEST 2010


Hi,

> I'm trying to manually insert a record into the sys_template table of my TYPO3 DB, using PHP. So, I have a few variables:
>
> $template_id =<the next usable UID in the table>
> $site_root =<the ID of the page containing the template>
> $typoscript_constants =<2 lines of TS code>
> $typoscript_config =<TS code, 3200 characters long>
>
> ... and then I slap that into the massive insert statement like this:
>
>   $create_template_query = "INSERT INTO  sys_template ( uid, pid, t3ver_oid, t3ver_id, t3ver_wsid, t3ver_label, t3ver_state, t3ver_stage, t3ver_count,t3ver_tstamp, t3_origuid, tstamp, sorting, crdate, cruser_id, title, sitetitle, hidden, starttime, endtime, root, clear, include_static, include_static_file, constants, config, editorcfg, resources, nextLevel, description, basedOn, deleted, includeStaticAfterBasedOn,static_file_mode,tx_impexp_origuid) VALUES ( '$template_id', '$site_root_id', 0, 0, 0, '', 0, 0, 0, 0, 0, 1266097202, 256, 1265252387, 1, '$template', '', 0, 0, 0, 1, 3, '77,57,43', 'EXT:css_styled_content/static/', '$typoscript_constants', '$typoscript_config', NULL, NULL, '', NULL, '', 0, 0, 0, 0);";
>
> However, the result is a failure. In particular, I've isolated the problem to be caused when trying to insert the contents of the $typoscript_config variable.

I'd guess that at least one of your 3200 characters is a single quote and this breaks your INSERT statement

> Any input is as always appreciated - thanks!

Is there a reason why you do not use the official TYPO3 API to manipulate TYPO3 records?

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-english mailing list