FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » input a section of a large file
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: input a section of a large file [message #171662 is a reply to message #171659] Fri, 14 January 2011 19:31 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 14/01/11 18:25, richard wrote:
> On Fri, 14 Jan 2011 10:41:19 -0700, richard wrote:
>
>> Just being curious.
>> Is it possible in php to acquire information from a file in part, rather
>> than retrieving the whole file?

Yes, you can read a line at a time.

>> I have a series of tables that I would prefer not showing up on the main
>> page when loaded. When the user clicks the link, the tables would appear.
>> Rather than uploading a thousand small files, I'd rather upload a dozen or
>> so files and retrieive the tables as needed.

If you want to use text files that contain data (for example csv data)
that you will use to create tables, it would probably be best to have a
separate file containing the data for each table that you wish to create.

You could also write a script off-line to create html tables that are
output as included php files. This would save the resources involved in
repeated conversion to html using php of static data in text files.

> Perhaps to clarify a little, I am thinking of something in the way of using
> file_get_contents as a means to open the file, then retrieving the
> particular item I want within that file.

If a file contains data for lots of tables, how will you know where in
the file the data for the table that you want is?

Where are you going to store the offsets? And what implications does
that have for things that need to get updated when the table data files
are changed?

What happens when you discover that all your offsets are wrong due to
differences in cr/lf handling?

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: php xml DOM/xpath how to reference child nodes by name within foreach loop?
Next Topic: Adaptive Learning for PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 05:33:57 GMT 2024

Total time taken to generate the page: 0.04445 seconds