Skip to content

DotNetNuke Tabs synchronization in 8 simple steps

December 28, 2010

For you DNN developers out there.

Problem: I have a DotNetNuke (DNN) development site that is a copy of a live site. It has like 5,000 pages in it. Over the last three months, a client has gone through and made major navigation changes to the site. I really don’t want to go through the site page by page and recreate all the navigation changes that were made, so I wrote this script. You should be able to basically copy over all the navigation changes in about 3 minutes with these simple steps. The one part I left out is creating new pages because, I only had to recreate 4 of them (SEE BELOW for details on that).

SYNC the table TABS in development to production:

Step 0.

Back up your databases. ALWAYS do that first.

Step 1.

In development: execute this SQL statement:

SELECT     ‘update tabs set tabOrder = ”’ + cast(TabOrder as varchar(50)) + ”’, tabName = ”’ + cast(replace(TabName,””,”””) as varchar(50)) + ”’, IsVisible = ”’ + cast(IsVisible as varchar(50)) + ”’, ParentId = ”’ + cast(ParentId as varchar(50)) + ”’, [Level] = ”’ + cast([Level] as varchar(50)) + ”’, Title = ”’ + cast(replace(Title,””,”””) as varchar(500)) + ”’, Description = ”’ + cast(replace(Description,””,”””) as varchar(500)) + ”’, KeyWords = ”’ + cast(replace(KeyWords,””,”””) as varchar(500)) + ”’, TabPath = ”’ + cast(TabPath as varchar(500)) + ”’ Where tabID = ”’ + cast(TabID as varchar(50)) + ”’;’ as expr1 FROM         Tabs
ORDER BY TabID

NOTE: This will create a bunch of update statements for you.

Step 2: Copy the output.

Step 3: Open a new Query Window in SQL Server Management Studio (make sure the database selected is the production database)

Step 4: Paste the output into this window. (you may have to go through and delete any NULL lines)

Step 5: Tweak anything at this point. When you are ready, execute the statements. (FYI- they will all execute because of the ; at the end of each statement)

Step 6. Login to your DNN portal as host.

Step 7. Go to: HOST -> Host Settings and scroll to the bottom.

Step 8. Click restart system. Give it a minute or two, then look at the nav.

To find if new tabs were created (out of SYNC)

As a side note, you may want to see if any new pages were added to the navigation in the development environment because if so, they obviously won’t exist in production. To do that, I just ran a query in production “select cast(tabid as varchar(50)) + ‘,’ as expr1 from tabs”, copy that output into notepad – then in development, I ran “select * from tabs where tabid not in ( PASTE NOTEPAD VALUES HERE BUT TAKE OFF THE VERY LAST COMMA );” that will give you a list of  new tabs in development, but not in production. Just reverse the order for new tabs in production and not in development. At least that will give you an idea of what you are working with.

Hope this helps a little bit – Good Hunting.

Advertisements

From → Uncategorized

2 Comments
  1. One thing to keep in mind when changing tabs around is that if you rename a tab, or move a tab, and you aren’t using the tabid/## urls, all your old links will no longer work, and the SEO for your site will likely suffer.

  2. Agreed. – I should have said this was for an intranet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: