Jump to content

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

Thanks for that. One other thing, I am unsure how to format the date to D/M/Y

 

Here is the code for the date:

echo ("<h4>".utf8_encode($start)." ".utf8_encode($finish)."</h4>");

 

I am not sure how you do this with the encoding?

 

The start is a date and the finish is a date?

Link to comment
https://forums.phpfreaks.com/topic/206510-changing-tags/#findComment-1080248
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

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.