#1
  1. No Profile Picture
    WannaKnow
    Guest
    Devshed Newbie (0 - 499 posts)
    I am looking for a quick and simple solution for following task:

    On all (meaning: many) generated HTML-pages I intend to offer a DOWNLOAD of a textfile, according to the text of the HTML-page.

    The textfiles (ASCII, *.txt or *.pdf - depending on what is easier to program) should contain: the whole text-contents (also in table-layout) of the HTML-pages (except images, links etc.).

    Techncal Info: The HTML-pages have been programmed with PHP3 and JavaScript (many interrogations) and read data from a database with MYSQL.

    So far I only would be able to realize this either doing a lot of programming (i.e. to define the page size, row witdth, change special characters, transfer tables 1:1 ...) or I would have to ask the surfer to use the browser features to save the HTML-page as a textfile (but last solution shall not be used although the result is perfect).

    I hope there is a function or a program (freeware) which will generate the textfiles automaticillay during the process of programming the website at a time I can choose myself by just placing 1 comand into the program.

    Who has got a good idea? I would be very happy to hear about some trick and tips.

    __________________________________________________________


    Suche schnelle, einfache Lösung für folgende Aufgabe:

    Auf allen (d.h. sehr vielen) generierten HTML-Seiten möchte ich jeweils einen entsprechenden DOWNLOAD von einem Textfile anbieten.

    Die Textfiles (ASCII, *.txt oder *.pdf - je nachdem, was einfacher zu programmieren ist) sollen beinhalten: den gesamten Text-Inhalt (auch in Tabellen-Form) der zu sehenden HTML-Seite (außer Bilder, Links etc.).

    Technische Info: Die HTML-Seiten sind u.a. mit PHP3 und Javascript programmiert (viele Abfragen) und lesen mit MYSQL Daten aus der Datenbank aus.

    Bisher würde ich dieses nur durch aufwendige Programmierung (u. a. definieren der Seitengröße, Zeilenbreite , Umwandlung sämtlicher Sonderzeichen, Tabellen 1:1 umsetzen etc.) realisieren können oder den Surfer bitten, über den Browser die Datei als Textfile zu speichern (letzteres soll aber nicht gemacht werden, obwohl das Ergebnis hervorragend ist).

    Ich hoffe, es gibt irgendeine Funktion oder ein Programm (Freeware), welches die Textfiles im Zuge der Programmierung der WebSite zu einem von mir gewählten Zeitpunkt automatisch generiert, indem ich z.B. einfach nur 1 Befehl in das Programm hierfür einbinde.

    Wer hat eine gute Idee? Über Tips und Trick würde ich mich sehr freuen.
    --------------
    dahamsta,your idea sounds like the solution. thanks!
    WannaKnow


    [This message has been edited by WannaKnow (edited 07-19-99).]
  2. #2
  3. No Profile Picture
    dahamsta
    Guest
    Devshed Newbie (0 - 499 posts)
    Seems an awful lot of hassle to go to, just to let a user donwload a page? However, mine is not to reason why...

    I think you're making a mountain out of a molehill anyway. PHP3 is equipped with everything you need, although I can't give you the exact code to do it. For a start, look at the DevShed homepage -- see the "Source" link? Follow that and then look at the "source of the source", there's a link down the bottom of the page. So PHP3 already has mechanisms in place to view its own code. To make the file downloadable, simply use the header() function to send a header of "text/save" or some other file type that the server/browser won't recognize, and the user will be prompted to save it.

    As I said, I can't tell you *exactly* how to go about it, but that's a start, and if you get stuck, the people on the forums at http://www.phpbuilder.com/support will be able to help you out.

    Cheers,
    adam

Similar Threads

  1. Replies: 1
    Last Post: August 5th, 2003, 08:31 AM
  2. Multiple MySQL Tables --> HTML Table
    By Mouncef in forum PHP Development
    Replies: 2
    Last Post: August 27th, 2001, 04:21 PM
  3. Replies: 1
    Last Post: July 10th, 2000, 10:58 AM
  4. Replies: 0
    Last Post: July 16th, 1999, 11:15 AM
  5. Replies: 0
    Last Post: July 16th, 1999, 11:08 AM

IMN logo majestic logo threadwatch logo seochat tools logo