Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-01-03 05:02:19

duchamp
Member
From: Patagonia
Registered: 2005-02-03
Posts: 222
Website

[Help] Creating & importing posts with a texteditor

I know that this is not a ‘normal’ case but … I’m working on a site that a friend started in 1998 with a lot of contents, mostly texts that are stored in TXT files. He was thinking to publish ALL that texts (not a few!) through Textpattern, one by one, but Im “almost” sure that all that work could be easier creating and importing an SQL file with the right format, for example, this is how a post looks in his database:
<br />
<code>INSERT INTO `textpattern` VALUES (1, ’2006-01-03 11:20:00’, ‘textpattern’, ’2006-01-03 11:20:00’, ‘username’, ‘A title’, ‘’, ‘Lorem ipsum dolor sit amet, consectetuer adipiscing elit.’,</code>
<code> ‘<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>\n\n\n ‘, ‘’, ‘\n\n\n ‘, ‘’, ‘thecategory’, ‘’, 1, ‘Comments’, 1, 4, 1, 1, ‘thesection’, ‘’, ‘’, ‘a-title’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘’, ‘becfea8fd42901304463b23701198f28’, ’2006-01-03’);</code>
<br />
it’s not difficult to understand each piece of this, the only part that I don’t know ‘How’ to generate is the large UID code! (becfea8fd42901304463b23701198f28)
It could be dangerous to leave the UID blank?
or there’s anything to do with this?

Thx in advance

Offline

#2 2006-01-03 07:19:27

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: [Help] Creating & importing posts with a texteditor

Duchamp,

I went and looked at TXPRef. If you go to include/txp_article.php, and the article_post() method you will this definition for the UID:
<pre>
uid = ‘”.md5(uniqid(rand(),true)).”’
</pre>

Offline

#3 2006-01-03 14:36:30

duchamp
Member
From: Patagonia
Registered: 2005-02-03
Posts: 222
Website

Re: [Help] Creating & importing posts with a texteditor

Thank you! That means I can use something like this:

<code><?php
// generate a random uid
$randomid = md5(uniqid(rand(), true));
echo “.$randomid.”;
?></code>
<br />

to generate that UID, great!

Offline

#4 2006-01-17 07:19:16

SCuM
New Member
Registered: 2006-01-09
Posts: 2

Re: [Help] Creating & importing posts with a texteditor

Can you do that? What was the purpose of the field if you can just put any old thing in it? I am in the same boat, I need to export and tweak my db from my old CMS so I can import into TextPattern and I had the same questions about the UID. Do any other tables refer to it?

I imported a single story and left it blank and all seemed to work fine, but then again, I am so new at TextPattern that I probably would not know if it was broken. :)

SCuM

Last edited by SCuM (2006-01-17 07:20:25)

Offline

Board footer

Powered by FluxBB