Re: Counting HTML Lines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



what about a file()?
this will return the file in an array:each element of the array is a line of the file.
then you can do a count to have the numer of elements in the array.


you can get rid of the html tags with a strip_tags.

hth,
melanie



From: "Ng Hwee Hwee" <hhwee@xxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject: Re:  Counting HTML Lines
Date: Fri, 15 Apr 2005 17:31:58 +0800

Hi! thank you so much for your help!!

do you mean to do ob_get_contents() before i do a ob_end_flush()?

but even if i'm successful in counting the number of "\n"s, HTML tags like
<html>,<head>,<script> will also give me a count for "\n"s but in actual
fact, they do not contribute to the screen output. how can i get round this
problem? =(

thanks thanks...

----- Original Message -----
From: "Jyrki Laurila" <jyrki.laurila@xxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Sent: Friday, April 15, 2005 5:25 PM
Subject: Re:  Counting HTML Lines


> Firstly, you are printing the output directly, so in case you don't > mark the lines you are printing out after each section, there is no > way to count the lines. > > Secondly, "HTML" doesn't "push" the text automatically to anywhere, it > is your text-editor. > HTML is presented as it's written on the file. So if your text-editor > chops the text to multiple lines, then it's no-can-do. Though, usually > text-editors don't add "\n"'s in text, even if they show a long line > chopped to multiple lines in edit-mode. > > A solution would be for you to process the HTML to a variable first > and then print it. > This way you can also count the lines by counting the number of "\n"'s. > > -- > Regards, > Jyrki Laurila > > > On 4/15/05, Ng Hwee Hwee <hhwee@xxxxxxxxxxx> wrote: > > hi! > > > > thanx for your reply. i cannot count the number of "\n" because sometimes > > the inputted text is very long without any "\n", but because it is inside a > > cell that has a linited width, HTML will automatically push it to the next > > line, right? in this case, there won't be a count for "\n". > > > > hwee > > > > ----- Original Message ----- > > From: "Petar Nedyalkov" <bu@xxxxxxxxxx> > > To: <php-db@xxxxxxxxxxxxx> > > Sent: Friday, April 15, 2005 5:06 PM > > Subject: Re: Counting HTML Lines > > > > Count the "\n" characters in the output.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux