[TYPO3-ttnews] HTML import in tt_news db

David Zschille typo3 at zschille.net
Thu Jan 25 22:45:52 CET 2007


Hello,

i tried to import news messages from an old website into tt_news. After
i extracted the content out of the HTML files i wrote it into the db. I
used sql queries like this:

INSERT INTO tt_news
                (
                    starttime,
                    endtime,
                    hidden,
                    type,
                    datetime,
                    archivedate,
                    pid,
                    title,
                    fe_group,
                    editlock,
                    sys_language_uid,
                    author,
                    t3ver_label,
                    author_email,
                    short,
                    bodytext,
                    keywords,
                    no_auto_pb,
                    category,
                    image,
                    imagecaption,
                    imagealttext,
                    imagetitletext,
                    links,
                    related,
                    news_files,
                    l18n_diffsource,
                    crdate,
                    cruser_id,
                    tstamp
                ) VALUES (
                    '0',
                    '0',
                    '0',
                    '0',
                    '1169550720',      // date strtotime())
                    '0',
                    '62',        // id of newsfolder
                    'Neue Sprachnachricht',    // header
                    '',
                    '0',
                    '1',    // language uid
                    '',
                    '',
                    '',
                    'Russischer Zupfkuchen',    // teaser text
                    'lore ipsum...',     // MainText
                    '',
                    '0',
                    '0',
                    '',
                    '',
                    '',
                    '',
                    '',
                    '0',
                    '',
                    '',
                    '1169550833',    // date()
                    '1',
                    '1169550833'     // date()
                )

 INSERT INTO sys_refindex
                (
                    tablename,
                    recuid,
                    field,
                    flexpointer,
                    softref_key,
                    softref_id,
                    sorting,
                    deleted,
                    ref_table,
                    ref_uid,
                    ref_string,
                    hash
                ) VALUES (
                    'tt_news',
                    '353',    // newsid
                    'sys_language_uid',    // or 'image' or 'news_files'
                    '',
                    '',
                    '',
                    '0',
                    '0',
                    'sys_language',  // if img or file: '_FILE'
                    '1',    // if sys_language : lang uid
                    '',    // if img or file :path
('uploads/pics/katalog_02.jpg')
                    '690e251545d1e31d5f5830509f57f54a'
                )

INSERT INTO sys_log
                (
                    userid,
                    type,
                    action,
                    error,
                    details_nr,
                    details,
                    log_data,
                    tablename,
                    recuid,
                    IP,
                    tstamp,
                    event_pid,
                    NEWid,
                    workspace
                ) VALUES (
                    '1',
                    '1',   // or '2' if file or img upload
                    '1',
                    '0',
                    '10',     // or '1' if file or img upload
                    'Record \'%s\' (%s) was inserted on page \'%s\'
(%s)',  // or
'Uploading file "%s" to "%s"' bei file or img upload
                    'a:4:{i:0;s:20:\"Neue
Sprachnachricht\";i:1;s:11:\"tt_news:353\";i:2;s:10:\"PresseNews\";i:3;s:2:\"62\";}',
                    'tt_news',
                    '353',    // news uid
                    '172.26.70.20',
                    '1169550833',
                    '62',   // uid of the news folder
                    'NEW45b5edb7383df',
                    '0'
                )

--------------------------------------

Some extract of the php code you can find here (in german):
http://www.typo3forum.net/forum/news-tt_news-mininews-und-co/18569-tt_news-2-4-datenimport.html

The import works well...only two cases which are not solved yet:

1. - when you have images or files in your messages, they are not shown
2. - when you have different languages you can see only the messages in
your default language

For case one i found a "workaround": i made an "dummy" news message and
attached to it the images and files which were needed in the imported
messages. I left the message "hidden" and saved it. Now the imges and
files appear in the other messages. Four of this dummy messages where
enough for me to attach the 40 files i needed :)

For case two i have no idea. Do somebody now what i have not seen? What do
i have to write in the db to have the messags in all languages available?
If i edit in Typo3 one of the imported news messages the language field is
set to the correct language.


Greetings,
David



More information about the TYPO3-project-tt-news mailing list