Try our conversational search powered by Generative AI!

Find and Replace in MainBody of EPiServer Template

Vote:
 
Dear Forum, We've started to migrate some content into EPiServer. We will need to do a lot of clean up in the code, especially relinking links to pages that didn't exist when the page was created in EPiServer. I've kept the ID of each of the pages from the old system into a field/property in EPiServer. Let's say that intItemID was 1906, I added an intItemID property in the page type and migrated the number 1906 in it. I will need to activate some sort of Find Replace in EPiServer where I can search inside the MainBody field and replace the link from the OLD system to that of the new. I will need to rebuild the link replacing the ID of the old page with that of the new one in EPiServer. If I was doing this on SQL, I would do something like this: -- ID in OLD SYSTEM = 1906 -- ID in EPiServer = 870 DECLARE @sOldPath VARCHAR(8000) DECLARE @sNewPath VARCHAR(8000) SET @sOldPath = 'http://www.unctad.org/Templates/Page.asp?intItemID=1906&lang=1' SET @sNewPath = '/Web/Templates/Page____870.aspx' SELECT MainBody = REPLACE(MainBody,@sOldPath,@sNewPath) FROM EPiServerTable Where ... Can something like this be done in EPiServer? What would the SQL command be? I know that we are told not to mess up with the database but there must be a way to do this bulk job other than manually. Thanks, Victor
#13159
Aug 14, 2007 18:33
Vote:
 
Hi, As a start you could take a look at the two following examples: http://www.episerver.com/en/EPiServer_Knowledge_Center/FAQ_EPiServer_4/927/935/ http://www.episerver.com/en/EPiServer_Knowledge_Center/Download2/Code-Samples/2640/Search-and-replace/ Regards Per
#15481
Aug 15, 2007 9:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.