Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

RSS Feed to SMF forum

Aloittaja Psyclones, marraskuu 20, 2005, 10:17:01 AP

« edellinen - seuraava »

Psyclones

I am working on a mod that writes the contents of a RSS Feed into a forum as new topics for the posts, similar to the echo forum thingy.

I need a bit of advice on how the database works,

what I need to know is

does smf write to the smf_topics table and transfer the information to smf_messages table or visa versa.

Progress so far I can successfully take a RSS feed and copy it into the smf forum but need to add to smf_topics for them to show up.
Error checking for duplicated posts ect and also reformatting the rss for non compatible sql characters also needs to be added.

the basics are there just need to tidy it all up.

I am php newbie learning on the fly but I hopefully will get there.

Any help on how smf works on posting to the database will be great.

thanks
Psyclones

Psyclones

Lainaus käyttäjältä: Psyclones - marraskuu 20, 2005, 10:17:01 AP

Any help on how smf works on posting to the database will be great.

thanks
Psyclones

Anyone??????

Thantos

Createing a new topic without polls or attachments is a three step process.  I don't remember the exact order that SMF does it but basically:

insert known data into {$db_prefix}messages, this includes things like the subject, body, time, etc.  Get the ID_MSG of the message inserted.
insert data into {$db_prefix}topics, get the ID_TOPIC
update {$db_prefix}messages with the topic id

There is some stuff you have to do to the message before inserting it.  such as preparsecode() and esacaping the body.

Psyclones

Thanks for the quick reply Mike, thought I was on my own with this one,

upto now I think I figured that 3 tables are used,

smf_messages
smf_topics

and also I think there is a count for id_last_message in smf_boards

So let me verify what you are telling me,

A messages gets posted into smf_messages creating an (autonumber) id_msg when inserted with other required data.
id_msg and other data gets inserted into smf_topics.id_first_msg smf_topics.id_last_msg
then the smf_topics.id_topic gets inserted back into smf_messages.id_topic

hopefully that completes the main tables

then the message counts get updated in smf_boards.id_last_msg

arrgggg got brain ache.  Finger Crossed

Thanks for your help
Psycones

Thantos

well you should make a call to:
updateStats() and updateLastMessage()

Also if you are using smf 1.1 you can use the function createPost() located in Subs-Post.php

Xarcell


slatkin

have you seen this? works pretty well, i just run it on a cron

Advertisement: