Help with modify a script.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
joegats916
Forum Newbie
Posts: 4
Joined: Wed Dec 16, 2009 4:54 pm

Help with modify a script.

Post by joegats916 »

Hi.. I'm trying to modify this script so that it only prints 100 bytes of the data in the file, no matter how big the file is.. then after the $text print "..." to indicate that it's been cut off.

Code: Select all

 
<?php 
$text = nl2br(file_get_contents('content/calendardata/cdate2.data'));
echo $text;
?> 
 
Thanks!
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Help with modify a script.

Post by requinix »

1. file_get_contents
2. substr
3. nl2br
joegats916
Forum Newbie
Posts: 4
Joined: Wed Dec 16, 2009 4:54 pm

Re: Help with modify a script.

Post by joegats916 »

It would be an understatement to say that i'm ubernoobish, could you explain that in a little more detail.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: Help with modify a script.

Post by daedalus__ »

its pretty self explanatory once you read the manual. you could have kept this in the other thread.

go ahead and head over to php.net and look those functions up.

you could also use the file reading functions to produce the same results.
Post Reply