anarchoi Posted February 19, 2008 Share Posted February 19, 2008 Hello, I have a old site that is 100% plain html files. I'm looking to migrate the site to work with a php-built CMS. The problem is that i have thousands of articles in html format, and I don't want to add them all one-by-one through the admin section of my CMS. So the only solution for me is to find a code that would take the html codes inside each of my static html files, and create an entry in my database with the content found. My site's structure is currently like this: www.mysite.com/books/Name Of The Book.html I have chosen JOOMLA for my CMS. Joomla stores its articles in a table called "jos_content" the structure of "jos_content" for the imporant article infos is: "id" = ID of the article, so we have to increase this by one for each new article "title" = Title of the article. In my case i'd put here the filename of the .HTML since it is the title of my articles "introtext" = text of the article. It should be the content inside of my HTML files So basically i'd need a code that would look for these informations and create a new entry for each of the .HTML files found in my /books/ server. For the rest I can do it myself, but if someone can hook me up with a code that would do what I explained above it would greatly help me to have somewhere to start since i'm still a newbie with php! Quote Link to comment Share on other sites More sharing options...
aschk Posted February 19, 2008 Share Posted February 19, 2008 I think you might have a problem in that you're going to have to give the script a list of all the urls. However saying that, I suppose it's only a large array of strings. Do your articles have a standard html format? i.e. body->div->h1->div->p You could use a regular expression to parse the html itself and grab the relevant html tags and their content before inserting into a database. (This is after you do a fopen/fread to get the file first ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.