File2Body

Reads file and showing it as Bootstrap row, with ability to replace variables inside file with certain strings from caller.
File should already has all html tags if needed, otherwise, will be shown as block.
Needs function to read file into string (like ASCII2Read).
It also shows the file name in small (muted) text on bottom right of row.

CodeFunctionName
What is this?

Public

Tested

Original Work
Function File2Body(FileName, ReplaceVarList)
    ' ReplaceVarList
    ' Is list of variables to be replaced inside the file as 1 pair per line
    ' like {{$Site$}} = BoldCodes.com
    '
    FullBody                    = ASCII2Read(FileName, 1)
    For Each ReplaceVar in Split(ReplaceVarList, VBcrlf)
        Var1                    = Trim(CutString3(ReplaceVar, 1, "="))
        Var2                    = Trim(CutString3(ReplaceVar, 2, "="))
        FullBody                = Replace(FullBody, Var1, Var2)
    Next
    Rett                        = "<div class=""row"" ><div class=""col"" >" & vbcrlf
    Rett                        = Rett & "<p >" & vbcrlf
    Rett                        = Rett & FullBody & vbcrlf
    Rett                        = Rett & "</p >" & vbcrlf
    Rett                        = Rett & "</div ></div >" & vbcrlf
    Rett                        = Rett & "" & vbcrlf
    Rett                        = Rett & "<div class=""row"" ><div class=""col text-right"" >" & vbcrlf
    Rett                        = Rett & "<small ><small class=""text-muted"" >From " & FileName & "</small ></small >" & vbcrlf
    Rett                        = Rett & "</div ></div >" & vbcrlf
    File2Body                = Rett
End Function

FileName, ReplaceVarList

FileTermsofUse_URL = "/Assets/File.txt"
ReplaceVarList        = "{{$Site_URL$}} = " & Site_URL & vbcrlf
ReplaceVarList        = ReplaceVarList & "{{$SiteName$}} = " & SiteName & vbcrlf
PrnL File2Body(FileTermsofUse_URL, ReplaceVarList)

Views 786

Downloads 260

CodeID
DB ID