Change from full url to not, now need to fix the data

6 posts by 3 authors in: Forums > CMS Builder
Last Post: January 8, 2010   (RSS)

By garyhoffmann - January 6, 2010

Hi,

Due to the need to be able to switch back and forth between secure and non-secure mode, plus not wanting my images within posts to reference the development area, I need to turn off the "Save full URL for local links..." option in the General Settings.

Of course, this information is already saved in the database...all over the place and within content.

Do you have any suggestions as to how I can fix the data that resides in many different tables and in many different records within those tables to eliminate the use of the now pseudo hard-coded paths in the data?

I'm mainly dealing with pictures as a problem, so I can even limit my "fix" to just <img tags within the data.

Thanks,
Gary.

Re: [chris] Change from full url to not, now need to fix the data

By Damon - January 7, 2010

Another option is to backup your database, download it, open your database in a text editor and carefully do a search and replace. Then upload it again and restore.

Make sure you keep and back up of your backup!
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Damon] Change from full url to not, now need to fix the data

By Chris - January 7, 2010

Wow, that's much simpler! Kudos, Damon!
All the best,
Chris

Re: [chris] Change from full url to not, now need to fix the data

By garyhoffmann - January 8, 2010

Thank you for replying. I may have come up with a code-based alternative to scan the content fields before trying to echo them out. Still working through it, but this may be the answer as nothing needs to change in the data and this can work for other things such as this.

In my case, I'm worried about IMG tags generally. So, I can scan with something like this (in pseudo code):

$myvar = $record['content']
replace_within_string("http://dev.domain.com/cmsAdmin","/cmsAdmin");

replace_within_string would do some regular expression handling.

Now, if something happens, where dev.domain.com needs to become my.new.domain someday, I can use the same code without making a user change their data.

Then, finally, once the replace_within_string is done, I would echo out the fixed string...something like:

<?php echo mydatafix($record['content']) ?>

I would wrap the above commands into the mydatafix function. That should solve the issue, but don't know for sure if it will work.

It's all within wysiwyg fields, so this "should" work

Re: [garyhoffmann] Change from full url to not, now need to fix the data

By Chris - January 8, 2010

Best of luck! Please let us know how it goes. :)
All the best,
Chris