Jump to content

Changing Tags


zimmo

Recommended Posts

I am using some old code etc.. and need to get the data into a nice xhtml compliant format for mobile. Now the issue I have is with the bold tags and italic tags.

 

I want to replace them with strong and for the italics to strip it out completely.

 

Here is what I have tried:

$string = $abstract;

$abstractrpl = strtr($string, 'b>', 'strong>'); //

 

Now the problem is, it does change them, but I dont get the correct tag, it is showing as:

 

<st

 

So I only get the first 2 characters?

 

Link to comment
https://forums.phpfreaks.com/topic/206510-changing-tags/
Share on other sites

Before you utf8_encode them, run a custom function on them, eg:

echo ("<h4>".utf8_encode(stringdate_format($start,"d/m/y"))." ".utf8_encode(stringdate_format($finish,"d/m/y"))."</h4>");

 

The function would look something like:

function stringdate_format($string, $format){
$timestamp = strtotime($string);
return date($format, $timestamp);
}

 

Hope this Helps,

-cb-

Link to comment
https://forums.phpfreaks.com/topic/206510-changing-tags/#findComment-1080297
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.