Jump to content

Is There a Textformatter that converts <p> to <br>?


montero4
 Share

Recommended Posts

Hello,

I’m using mautic, a marketing automation platform to send out my newsletters (so I can do tracking etc). Its newsletter builder is quite a pain to use so I figured what I want to do is create the newsletter in PW and simply paste the html code into mautic. One thing it requires is that all css styling is inline (which I can figure out), but one thing it also requires is that <p> tags are actually <br> Tags. 

I’ve searched through the module library to see if there is a textformatter for this? Anything that jumps to mind?

Thank you for your help.

 

Regards,

Link to comment
Share on other sites

// not tested
class TextformatterP2BR extends Textformatter {
	public static function getModuleInfo() {
		return [
			'title' => 'P2BR',
			'version' => '1.0.0',
			'summary' => 'Textformatter that strips all <p> and replaces </p> by <br>',
		]; 
	}

	public function format(&$str) {
		$str = str_replace("<p>", "", $str);
		$str = str_replace("</p>", "<br>", $str);
	}
}

 

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...