Hello,
In my aplication registered users can generate text files when they do an specific action. Then they also have a section to look for these text files and i do not know how to show each text file in the section. I don't want to show all the text in these files in the section i only want to show haw many of this files are there and with the possibility to click on them.
For instance
Section:
Textfile1 -> when click on it show the document and if it's possible with html and css format
Textfile2
Textfile3
User Folder:
Textfile1
Textfile2
Textfile3
Managing textfiles
Moderator: General Moderators
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Managing textfiles
Get the list of files:
http://us3.php.net/manual/en/function.opendir.php
If you want to have HTML and CSS, you'll have to, instead of linking to somefile.txt, you'll have to link to something like viewfile.php?f=somefile.txt , then viewfile.php will open up $_GET['f'] with file_get_contents()
http://us3.php.net/manual/en/function.f ... ntents.php
http://us3.php.net/manual/en/function.opendir.php
If you want to have HTML and CSS, you'll have to, instead of linking to somefile.txt, you'll have to link to something like viewfile.php?f=somefile.txt , then viewfile.php will open up $_GET['f'] with file_get_contents()
http://us3.php.net/manual/en/function.f ... ntents.php
Re: Managing textfiles
Thanks Jonah,
NowI am able to show the files which are in the directory. I manage to put a link (and input type="submit") with a specific value that when the user click on it it shows the textfile. But using file_get_contents() it doesn't follow the same rules like spaces and end lines. And I want to show the document with format css and html how can I do that?
In your reply I don't really understand this:
you'll have to link to something like viewfile.php?f=somefile.txt , then viewfile.php will open up $_GET['f'] with file_get_contents()
How I link to this page -> viewfile.php?f=somefile.txt. It seems to me like chinese I don't understand nothing.
NowI am able to show the files which are in the directory. I manage to put a link (and input type="submit") with a specific value that when the user click on it it shows the textfile. But using file_get_contents() it doesn't follow the same rules like spaces and end lines. And I want to show the document with format css and html how can I do that?
In your reply I don't really understand this:
you'll have to link to something like viewfile.php?f=somefile.txt , then viewfile.php will open up $_GET['f'] with file_get_contents()
How I link to this page -> viewfile.php?f=somefile.txt. It seems to me like chinese I don't understand nothing.
- Jonah Bron
- DevNet Master
- Posts: 2764
- Joined: Thu Mar 15, 2007 6:28 pm
- Location: Redding, California
Re: Managing textfiles
Post your code and I'll show you what I'm talking about.