Re: Two Scenarios

  •  12-12-2005, 5:00 PM

    Re: Two Scenarios

    I came up with a workaround for my situation and wanted to share with others that might encounter something similar.

    A few overall settings are:
    • Editor.BaseHref is never assigned a value
    • Editor.UseRelativeLinks = True
    • Editor.RemoveServerNamesFromUrl = True
    • Editor.EditorWysiwygModeCss = "/css/" & stylesheet   ' if internet = 0
    • Editor.EditorWysiwygModeCss = "/external/" & siteName & "/css/" & stylesheet   ' if internet = 1
    Below is my conditional code to handle necessary pathing adjustments.

    'NOTE: If the variable internet = 0 then we're dealing with an intranet site. If internet = 1 then we're dealing with an external web site.

    ' ------------------------------------------------------------------------------------------------------
    ' Pathing adjustment right before the page content (Editor.XHTML) is saved to SQL Server
    '
    ------------------------------------------------------------------------------------------------------
    Dim xhtmlContent As String

    xhtmlContent = cntrlCuteEditor.XHTML

    If (internet = 1) Then
        xhtmlContent = xhtmlContent.Replace("/external/" & siteName, "")
        xhtmlContent = xhtmlContent.Replace("http://www." & siteName & ".com", "")
    End
    If
    xhtmlContent = xhtmlContent.Replace("/" & folderName + "/", "")
    '
    ------------------------------------------------------------------------------------------------------

    ...
    ...

    ' ------------------------------------------------------------------------------------------------------
    ' Pathing adjustment after the page has been saved to SQL Server
    ' and right before the content is then re-assigned to Editor.Text
    ' -----------------------
    -------------------------------------------------------------------------------
    '
    ' Intranet site

    If (internet = 0) Then
        If (pageContent.IndexOf(folderName) < 0) Then
            Editor.Text = pageContent.Replace("uploads", "/" & folderName & "/uploads")
        End If

    ' External web site
    ElseIf (pageContent.IndexOf("http") < 0) Then
        Editor.Text = pageContent.Replace("uploads", "http://www." & siteName & ".com" & "/" & folderName + "/uploads")
    End If
    ' ------------------------------------------------------------------------------------------------------


     The only undesirable effect with this is that once an image is selected with the Insert Image button, the path is /external/siteName/uploads/images/image.jpg in order for the CuteEditor control to display the image. Once I save the page content I strip /external/siteName/ out of the path before updating SQL Server. Then, whenever the page is loaded again to be edited I stuff the image path with the pathing prefix that I need. This works though, and there's no appreciable downside for the end-user.


View Complete Thread