You are here: Re: Cutting strings short with php « PHP Language « IT news, forums, messages
Re: Cutting strings short with php

Posted by Stefan Rybacki on 07/20/05 22:01

Tony wrote:
> Stefan Rybacki wrote:
>
>>Hello wrote:
>>
>>>There is a function in PHP that strips the HTML tags called
>>>"strip_tags" then when you get the string back with no tags use
>>>"substr" or something to get the first 100 chars.
>>>
>>>
>>
>>How will that help him, since I guess he needs the HTML tags?!
>>
>
>
> I could see that possibly causing some problems, since you would have
> opening tags but no closing tags. Depending on the tags, of course:
>
> <pre>This is a string of more than 100 characters. This is a string of more
> than 100 characters. This is a string of more than 100 characters. This is a
> string of more than 100 characters. This is a string of more than 100
> characters. This is a string of more than 100 characters.</pre>
>
> could cause the rest of the page to not function properly. Seems to me that
> stripping the HTML would be better, if you're not displaying the whole
> string.
>
Thats true, but if you split the string like I proposed you could simply add closing tags
to opened tags after cutting the string.

Regards
Stefan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация