Jump to content

removing boldtext from included content


forzatio

Recommended Posts

Hi there, Im getting some rss feeds to display on my site however the source rss contains bold text which I can't get away.

I tried to make a stylesheet that would set the text to normal but this doesn;t work, also I tried to put something like this in the echo:

 

<p class=\"nobold\">$description</p>   but still I get bold text.

This is my code.


<p class="nobold">
<?php include ('includewebsite.php'); ?>
</p>

foreach ($rss->items as $item ) {

$description = str_ireplace('badword','goodword',$item[description]);
$url =		$item[link];
$title =	str_ireplace('badword','goodword',$item[title]);




echo "$title<br><br><p class=\"nobold\">$description</p><br><br>";
}

Link to comment
Share on other sites

Ok I tried it this way in my includefile which retrieves the rss.

 

in this case, it should remove the tag from the rss it needs to retrieve.

 

foreach ($rss->items as $item ) {

$description = str_ireplace('badword','goodword',strip_tags($item[description], '<b>'));

 

The CSS font weight didn't work too.

Link to comment
Share on other sites

the second argument of strip_tags() is allowed tags. You told it to strip every tag BUT

<b>

.

 

What are you replacing with str_ireplace?

 

I tried it like this now and it seems to work now.

 


foreach ($rss->items as $item ) {

$description = str_ireplace('badword','goodword',strip_tags($item[description], '<b>'));

 

They didn't use bold

<b>

with that tag.

I use the str_ireplace (another thing) to replace some words from the RSS feed.

Link to comment
Share on other sites

You're not making any sense. If you want to remove the bold tag, you can't put it as the second argument of strip_tags().

If they didn't use the b tag, what tag did they use to make it bold? strong? Either way, just use strip_tags() with NO second argument.

Link to comment
Share on other sites

You're not making any sense. If you want to remove the bold tag, you can't put it as the second argument of strip_tags().

If they didn't use the b tag, what tag did they use to make it bold? strong? Either way, just use strip_tags() with NO second argument.

ah yeah, in my case it's a totally coincidence, so I allowed '<b>'  as a tag, while all other tags are now just stripped out.. the only tag in the RSS was

<b>

  so it just solved the problem with total coincidence.

 

how would I normally strip out the

<b>

tag and allow all other ?

I just had some luck there ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.