Jump to content

Insert html tags?


kelly123

Recommended Posts

I'm working on a journal that uses a php form to update the content. I was wondering if there was anyway to auto insert html tags into it to format it, or will I just have to add all the tags up when i write the update?

 

If you need clarification of what i mean, let me know.

 

 

Thanks in advance

 

http://www.infysolutions.com

 

--------------------------------------------------------------------------------------------------------

<a href="http://www.infysolutions.com">Outsourcing software development</a>

Link to comment
Share on other sites

Here is a function I use for replacing new line breaks with p tags.

 

Perhaps you could expand on this.

 

function nl2p($text){

// Return if there are no line breaks.
if (!strstr($text, "\n")) {
	return $text;
}
// put all text into <p> tags
$text = '<p>'.$text.'</p>';
// replace all newline characters with paragraph
// ending and starting tags
$text = str_replace("\n", "</p>\n<p>", $text);
// remove empty paragraph tags & any cariage return characters
$text = str_replace(array('<p></p>', "\r" ,"\n"), '', $text);
$text = trim($text);
return $text;
} // end nl2p

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.