johnstephens Posted November 4, 2015 Share Posted November 4, 2015 I'd like to read up on importing content from Textpattern into a fresh ProcessWire installation. I know there are more than a few Textpatrons here: Is there a tutorial or thread or blog post covering this?I've used Textpattern for years. I'm very familiar with it's database schema and pretty comfortable exporting and manipulating it with MySQL. ProcessWire's schema uses a totally different paradigm, and I'm not confident that I could simply dump the data and import it into ProcessWire with the same facility. I'm happy with Textpattern for most of the sites in which I use it, but there are a few that I think using ProcessWire would be a significant boon.Thanks in advance! Link to comment Share on other sites More sharing options...
LostKobrakai Posted November 4, 2015 Share Posted November 4, 2015 You could always use an bootstrap script, which does connect to the Textpattern database, reads the data by mysql queries and then use the processwire api to fill those data into the pages you need. 5 Link to comment Share on other sites More sharing options...
adrian Posted November 4, 2015 Share Posted November 4, 2015 Or you could build a module like MigratorWordpress: https://github.com/NicoKnoll/MigratorWordpress that gets the Textpattern content and creates JSON that can be imported into PW. While it might be a little more work to build, it would be useful for other future users coming from TextPattern. 4 Link to comment Share on other sites More sharing options...
renobird Posted November 5, 2015 Share Posted November 5, 2015 Hey johnstephens, How large/complex is the Textpattern site? I moved a bunch of sites a few years back, and they were all pretty simple transfers. I didn't try to write any kind of importer, I was done with the transfers manually faster than I could write the importer. 1 Link to comment Share on other sites More sharing options...
johnstephens Posted March 25, 2017 Author Share Posted March 25, 2017 Concepts like "bootstrap script" and writing my own importer were a bit much for me when I initially posted this question, but now that I'm facing a real need I might have to wrap my mind around them. On 11/5/2015 at 8:53 AM, renobird said: Hey johnstephens, How large/complex is the Textpattern site? I moved a bunch of sites a few years back, and they were all pretty simple transfers. I didn't try to write any kind of importer, I was done with the transfers manually faster than I could write the importer. At the time I wrote, I didn't have a specific site in mind to convert, but now I do. It's one of my more complex Textpattern sites, but it's not insane. Here's what I have: - 7 major content "sections", some of which would be nested in a ProcessWire site. I also have some utility sections used for things like search and site map. - 660 "articles", most of which belong to a knowledge base. - 39 categories in two major divisions. Each article in the knowledge base belongs to two categories. - The site uses Textpattern's MLP plugin/hack to offer content in two languages. The 660 article IDs include the renditions in both languages. On the front end, that means you can click on a language link for any article and view it's rendition in the other language. The URL changes from domain.tld/en/{section}/{url-title} domain.tld/es/{section}/{url-title}. - The site uses 15 custom fields, with the glz_custom_fields plugin offering support for different field types. Articles in different sections use different combinations of the custom fields, but all the custom field data lives in the same table with the articles. I think that covers all the complicating factors. In a vanilla Textpattern installation, all the article content lives in one table, and I suppose importing it would involve some way of mapping the columns of that table to pages and fields in ProcessWire, with the "section" field designating the rootParent page. But this site has the added convolution of a localization table that maps articles in both languages so they can be linked appropriately. Tom, when you say you transferred the content manually, do you mean you opened the article in Textpattern's editor (the Write tab) and simply copied and pasted each field to ProcessWire? Is that the method you'd recommend for this site, or is there some way of automating it that you'd suggest? Thanks in advance for any guidance you can offer! Link to comment Share on other sites More sharing options...
Adam Kiss Posted March 27, 2017 Share Posted March 27, 2017 Bootstrapping means 'require'-ing ProcessWire website from elsewhere, like this: <?php require_once '/absolute/path/to/your/PW/site/index.php'; foreach( \ProcessWire\wire('pages')->get('/')->children() as $ch ) { echo "{$ch->title}\n"; } I've just tried this so I won't lie to you: I literally just created this in in my home directory, ran it in terminal with PHP and got a list of page titles in the console. So by writing your own importer, people mean something like this: <?php require_once '/path/to/processwire/index.php'; $wire = \ProcessWire::wire(); // get stuff you want to import $articlesToImport = \OldCMS\DB::query($oldSiteDB, 'select * from articles join whatever'); // iterate over it and create pages for it foreach($articlesToImport->next() as $oldArticle){ $newArticle = new \ProcessWire\Page(); $newArticle->template = 'article'; $newArticle->parent = $wire->get('/articles/'); $newArticle->title = $oldArticle->get('title'); $newArticle->body = $oldArticle->get('html'); $newArticle->save(); } And that's it. You've just imported some articles from your old CMS to your brand new ProcessWire installation. Of course, on "real" pages you'll want to think about this for a bit; Maybe create pages for authors first, some categories, some tags, and then maybe add the pages in parts, so you don't timeout mid-import, or turn off timeout. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now