tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
1
ZUGRIFFE
690
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Tep Tep ist offline Rookie
    Registriert seit
    Jan 2004
    Beiträge
    7
    Hallo ihr Lieben,

    ich lese mit flgendem Code ein Verzeichnis aus, worin sich .txt Dateien befinden:

    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    
    <html>
     
    <%
     
    u_file=trim(request.querystring("u_file"))
    if u_file = "" then
     
    ' Get the top level directory info
    dir_info = request.servervariables("d:\home\web21\xxx\xxx\xxx-xxx.de\a")
     
    ' Get the rest of the directory info without the first /  
    dir_info = dir_info + right(request.servervariables("script_name"),(len(request.servervariables("script_name"))-1)) 
     
    ' Split the directory info by /
    g_input=split(dir_info,"/")
     
    ' Count the number of splits
    num_inputted=ubound(g_input)-1
     
    set directory=server.createobject("scripting.filesystemobject")
    set allfiles=directory.getfolder(server.mappath("../"&g_input(num_inputted)))
     
    ' Lists all the files found in the directory
    For each directoryfile in allFiles.files 
     
    ' Removes ASP pages from view  
    if (right(directoryfile.name,3)) <> "asp" then 
     
    set fso = createobject("scripting.filesystemobject")
    set act = fso.opentextfile(server.mappath(directoryfile.name))
     
    read_text = act.readline
    act.close
     
    %>
    <a href=<%
    ' Write out the name of the page
    response.write request.servervariables("script_name") %>?u_file=<%
    ' Write out the name of the document
    response.write server.urlencode(directoryfile.name) %>>
    <%
    ' Write out the first line of the document
    response.write server.htmlencode(read_text) %>
    </a><br>
    <% 
    'End check for any pge other than ASP
    end if 
     
    ' End for next loop to list documents
    next 
    ' End check for querstring input
    else
     
    set fso = createobject("scripting.filesystemobject")
     
    ' Check to see if the file in the querystring exists
    ' (This prevents user input in the address bar from causing errors)
    if fso.FileExists (server.mappath(u_file)) then 
    ' Open the file and read it
    set act = fso.opentextfile(server.mappath(u_file))
    read_text = act.readall
    act.close
     
    ' Write the contents of the document ot the browser
    Response.Write "<pre>" & server.htmlencode(read_text) & "</pre>"
     
    ' If the file in the querystring does not exist
    ' Display and eror message
    else 
    %>
    There was a problem displaying the requested item<br>Please go <a href=<%= request.servervariables("script_name")%>>back</a> and select again
    <%
     
    ' End check for file existence
    end if 
     
    ' End check for querystring value
    end if
    %>
    </span>

    Ich möchte nun aber die Ausgabe der jeweiligen Textdatei, also, wenn man draufklickt in die ASP Datei, ausgeben aber gleichzeitig formatiert (Schriftart, Schriftgröße).
    Denn momentan wird alles in Times Roman ausgegeben, soll aber in Arila sein.

    Wie mache ich das?

    Danke
    Tep
     

  2. #2
    Registriert seit
    Aug 2003
    Ort
    Arnsberg, Germany, Germany
    Beiträge
    1.066
    Hi

    Formatierung legt man in <head>-Bereich über ein Style-Sheet fest.
     
    liebe Grüße, die Luzie

Ähnliche Themen

  1. Textdatei formatieren
    Von Adrian_ im Forum Swing, Java2D/3D, SWT, JFace
    Antworten: 2
    Letzter Beitrag: 23.07.10, 11:24
  2. Datensatz auslesen Date formatieren
    Von lll192837465lll im Forum PHP
    Antworten: 20
    Letzter Beitrag: 17.02.09, 16:29
  3. Antworten: 3
    Letzter Beitrag: 10.12.08, 12:01
  4. Excelsheet auslesen & formatieren
    Von nordi im Forum PHP
    Antworten: 9
    Letzter Beitrag: 10.04.08, 19:15
  5. Textdatei auslesen
    Von LordNikkon im Forum Enterprise Java (JEE, J2EE, Spring & Co.)
    Antworten: 3
    Letzter Beitrag: 12.08.04, 10:28