Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-12-20 12:22:54

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,614
Website GitHub

[Solved] Import categorised links

I have a couple of Txp installations with a whole bunch of Content->Links in them that I want to copy across to another site (which already has content and links in it). I’m essentially merging a bunch of satellite sites into one.

Slight annoyance is that the links are categorised so I need to recreate the category tree(s) too on the destination site. Can anyone think of a way to neatly copy the links and category tree from one site to another without borking the category tree? I presume SQL-fu, but I’ll probably need to somehow trigger a category tree rebuild afterwards.

I’d rather not go through and create the categories or links by hand, as there are a lot of them. I can export the content of both tables via phpMyAdmin or rss_admin_db_manager but I’m concerned that if I import them the same way that it’ll break/overwrite something (and it’s a live site – I’m using dev preview for the behind-the scenes wrangling so I need to tread carefully!)

Thankfully the link IDs don’t matter, just their category assignment, because they’re squirted onto the page grouped by category to make giant link lists.

Any cool ideas?

Last edited by Bloke (2021-12-20 12:24:47)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#2 2021-12-20 13:34:59

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,231
Website

Re: [Solved] Import categorised links

If SQL copy + insert and a rebuild_tree doesn’t work, might a combination of dzd_multicat_creator and rebuild_tree afterwards (Oleg’s post) work?


TXP Builders – finely-crafted code, design and txp

Offline

#3 2021-12-20 14:06:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,614
Website GitHub

Re: [Solved] Import categorised links

Oooh if I export the cat data as CSV, Dragondz’ plugin looks just the ticket. Then it’s a simple case of exporting the links table, lopping off the ID column to avoid overwriting existing links, and importing that.

That might just work and be the simplest approach. Thank you.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2021-12-20 14:52:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,614
Website GitHub

Re: [Solved] Import categorised links

Woohoo, that seems to have worked spiffingly doing it as a two-stage process with a little bit of manual CSV skulduggery to remove unnecessary rows and the ID column from the txp_link table data.

Handy plugin for such category manipulation edge cases. Thanks, Dragondz if you read this.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB