Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- di_Library v. 0.1 - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

    *---------------------------------------------------------------------
    FUNCTION di_HTMLTitle(cTitle)       // --> nSuccessList
    *---------------------------------------------------------------------
    //-- Put a title into all output devices

    LOCAL nSuccessList := 0, i, cPage, nExp, nBeg, nEnd, nOutputList

    IF EMPTY(cTitle)                // If no argument, do nothing, return 0
        RETURN 0
    ENDIF

    cTitle := di_HTMLChars(cTitle)  // Make special characters encoded
    nOutputList := di_SetOutput()   // For each HTML device, check status
                                    // Get rid of any devices > HTML range
    nOutputList := _diJustHTML(nOutputList)
    FOR i = MaxHTMLDevice TO 1 STEP -1
                                    // If device 2i set to output, remove
                                    // 2i from the output list and procede
                                    // with attempted modification
        IF nOutputList >= (nExp := 2i)
            nOutputList -= nExp
                                    // IF we can assign nPos as the location
                                    // of the string '<TITLE>' within the
                                    // current page, insert cTitle into page
            IF 0 <> (nBeg := AT("<TITLE>", cPage := _diHTMLEdit(nExp)))
                                    // Replace page with oldpage up to end
                                    // of '<TITLE>', then cTitle, then either
                                    // all from '</TITLE>' or just all one
                                    // character after '<TITLE>' (the latter
                                    // means '</TITLE>' was not found, but we
                                    // modify anyway)
                nEnd := AT("</TITLE>",cPage)
                cPage := _diHTMLEdit(nExp, SUBSTR(cPage,1,nBeg+6) + cTitle + ;
                                    SUBSTR(cPage, IIF(nEnd=0, nBeg+8, nEnd)) )
                                    // If ERROR not returned, add to
                                    // nSuccessList
                nSuccessList += IIF( (SUBSTR(cPage,1,5) = 'ERROR'), 0, nExp)
            ENDIF
        ENDIF
    NEXT i
    RETURN nSuccessList

See Also: Example1

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson