Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7065853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:00:28+00:00 2026-05-28T05:00:28+00:00

EDIT : The key point is about getting the first 200 characters and closing

  • 0

EDIT: The key point is about getting the first 200 characters and closing all tags, that are left open.


I’m currently loading articles from other website via DOM object (the other website have no RSS). I want to make a “preview” of that article, but here are my problems:

  1. I do not control how the articles are written, therefore it seems to always be inside a table on the second TR (they use a CMS and it is messy – see example below).

  2. They have A LOT of HTML tags, I don’t want to leave one open.

  3. I need to keep the HTML format, I know it’s ugly but it fits perfectly in my page.

Not my code (in French sorry):

<table>

<TR >

<TD class='Normal' valign="top" colspan="2" style="padding-bottom:15px;">13-01-2012   <b>Water-polo – Championnat pan-pacifique<b ></TD>

</TR><TR >

<TD class='Normal' valign="top"><span class="HeadTitleNews"> Les Canadiennes disputeront le bronze aux Chinoises</span>   <img src='http://www.sportcom.qc.ca/Portals/0/2011WaterpoloF.jpg' width='165' align='right' class='imgAnnouncementCss'><div style="margin: 0in 0in 0pt"><span style="font-family: Tahoma; font-size: 10pt">Montr&eacute;al, 13 janvier 2012 (Sportcom) &ndash; L&rsquo;&eacute;quipe f&eacute;minine canadienne de water-polo a remport&eacute; une victoire &eacute;crasante de 19-3 face au Br&eacute;sil, vendredi, au Championnat pan-pacifique de Melbourne, en Australie. Les Canadiennes se sont ainsi assur&eacute;es de participer au match pour la m&eacute;daille de bronze contre les Chinoises. </span></div>

<div style="margin: 0in 0in 0pt">&nbsp;</div>

<div style="margin: 0in 0in 0pt"><span style="font-family: Tahoma; font-size: 10pt">La Montr&eacute;alaise <strong>Sophie</strong></span><strong><span style="font-family: Tahoma; font-size: 10pt"> Baron-La Salle</span></strong><span style="font-family: Tahoma; font-size: 10pt"> a marqu&eacute; quatre buts dans la victoire. </span></div>

<div style="margin: 0in 0in 0pt">&nbsp;</div>

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:00:29+00:00Added an answer on May 28, 2026 at 5:00 am
    <?php 
    $your_string_without_tags = strip_tags($your_string); 
    $your_200_char_string = substr($your_string_without_tags, 0, 200); 
    ?>
    

    Close open HTML tags in a string

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT Sorry I forgot the most important part here. Each key can have more
I'd prefer my primary key field weren't visible in my edit page. If I
Is there a way to remove duplicate (key-value) pairs from NSDictionary ? EDIT: My
How to make a multi-thread python program response to Ctrl+C key event? Edit: The
Edit: From another question I provided an answer that has links to a lot
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++
Edit: solution added. Hi, I currently have some working albeit slow code. It merges
EDIT: I found the solution, see below My first post on StackOverFlow. However I
So I am having an issue with MySQL 5.5 that is about to drive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.