Version: , by Radon3k
Developer Last Online: Feb 2009
Version: Unknown
Rating:
Released: 01-21-2003
Last Update: Never
Installs: 0
No support by the author.
Hi there,
I'm developing something and now I'm stuck on it. This may sound weird, but I do have a point behind it, so please bare with me. For right now, I just want the simple procedure, and if that's successful, then I'll take it to the next step.
I have a text file that contains several thousand company names in it. What I want to be able to do, using the "add forum" section from /admin/forum.php, is have it read each line of the text file and create a category name for each company listed there.
Example:
Microsoft
Circuit City
Best Buy
When the script is executed, a category for Microsoft, a category for Circuit City, and a category for Best Buy would be created. To add onto that, with each category created, 4 forums would be added as well, all having the same names.
Example:
Category names:
Microsoft
Circuit City
Best Buy
Forum names:
General talk
What To Buy
What's On Sale
When the script is executed:
Microsoft
--General Talk
--What To Buy
--What's On Sale
Circuit City
--General Talk
--What To Buy
--What's On Sale
Best Buy
--General Talk
--What To Buy
--What's On Sale
You get the idea. I know that I need to use a loop (probably going to use a "for" loop) for this, but I'm unsure of how to import the file. To add onto that, I'm having trouble figuring out how to add it to the forums with the code from /admin/forum.php.
I've tried adding just one forum using an HTML form, but that did not work.
I'm thinking that I need to make the text file into a PHP file and make the company names an array. Though, that sounds like a lot of work for several thousand companies. If this were 10 companies, I'd add them manually via the Admin CP in vBulletin, but several thousand companies is a lot of work.
I know you're probably asking, "Why on Earth would you want to do that?". Please just bare with me.
Any guidance in the right direction would be most appreciative. Thanks!
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
couldn't you do it with just a query to the db, to get it from the text file explode it into an array then count the array and do for($i=0;$i<array;$i++) then a query to make a forum, look at what query vb does when you tell it to create one and use that
$pid = $i + 1;
$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayorder,parentid,
parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
styleoverride,allowratings,countposts,moderateattach)
VALUES
(NULL,'YOUR DEFAULT STYLE','$filearray[$i]','','1','$i','$pid',
'$i,-1','0','0','0','','','0','0','1','1','1','1','0','1',
'1','0')");
$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayorder,parentid,
parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
styleoverride,allowratings,countposts,moderateattach)
VALUES
(NULL,'YOUR DEFAULT STYLE','General Talk','','1','$i','-1',
'$i,-1','1','1','30','','','0','0','1','1','1','1','0','1',
'1','0')");
$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayorder,parentid,
parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
styleoverride,allowratings,countposts,moderateattach)
VALUES
(NULL,'YOUR DEFAULT STYLE','What to Buy','','1','$i','-1',
'$i,-1','1','1','30','','','0','0','1','1','1','1','0','1',
'1','0')");
$DB_site->query("INSERT INTO forum
(forumid,styleid,title,description,active,displayorder,parentid,
parentlist,allowposting,cancontainthreads,daysprune,newpostemail,newthreademail,
moderatenew,allowhtml,allowbbcode,allowimages,allowsmilies,allowicons,
styleoverride,allowratings,countposts,moderateattach)
VALUES
(NULL,'YOUR DEFAULT STYLE','What's on Sale','','1','$i','-1',
'$i,-1','1','1','30','','','0','0','1','1','1','1','0','1',
'1','0')");
the only thing i can't get to work is the parent list thing so i dont know if this will even work until you get those working, but i haven't tested this