Re: Counting HTML Lines
| From: | mel list_php | Date: | Fri, 15 Apr 2005 10:43:08 +0000 |
| Subject: | Re: Counting HTML Lines | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39201@lists.php.net to get a copy of this message | ||
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@towa.com.sg> To: <php-db@lists.php.net> Subject: Re: [PHP-DB] 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@gmail.com> To: <php-db@lists.php.net> Sent: Friday, April 15, 2005 5:25 PM Subject: Re: [PHP-DB] 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@towa.com.sg> wrote:_________________________________________________________________ It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messengerhi! thanx for your reply. i cannot count the number of "\n" becausesometimesthe inputted text is very long without any "\n", but because it isinside acell that has a linited width, HTML will automatically push it to thenextline, right? in this case, there won't be a count for "\n". hwee ----- Original Message ----- From: "Petar Nedyalkov" <bu@orbitel.bg> To: <php-db@lists.php.net> Sent: Friday, April 15, 2005 5:06 PM Subject: Re: [PHP-DB] 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