Taking out <p> tag

10 posts by 6 authors in: Forums > CMS Builder
Last Post: February 22, 2011   (RSS)

Hi Guys,

I need to take out a <p> tag that a wysiwyg editor keeps on adding in, tried some of the other suggestions in previous posts but it ended up not displaying the field contents! It's an email address field so I have to use the wysiwyg editor and I just want it to display 'email: and then the email address added in the field'.

Any ideas? Thanks!

Re: [Kittybiccy] Taking out <p> tag

By gkornbluth - February 24, 2010 - edited: February 24, 2010

Hi Kittybiccy,

Most of us don't recommend displaying raw e-mail addresses in the code of our pages. It makes it too easy for bots to harvest them.

I'd suggest using the plugin that Interactive Tools offers http://www.interactivetools.com/order/ or one of the other approaches I mention in my CMSB Cookbook www.thecmsbcookbook.com to accomplish this and save your client's a ton of grief in the form of spam.

Here's the code that I use for removing <p> tags.

<!-- remove leading <p>, do this _before_ displaying field value -->
<?PHP $record['yourfieldname'] = preg_replace("/^\s*<p>/i", "", $record['yourfieldname'] ); ?>


Best,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [Kittybiccy] Taking out <p> tag

By Dave - February 24, 2010

Hi Kittybiccy,

So you just need it to link right? What about using a text field for the email and then displaying it with this code?

<a href="mailto:<?php echo $record['email']; ?>"><?php echo $record['email']; ?></a>

That should create something like this:

<a href="mailto:example@example.com">example@example.com</a>

Let me know if that works for you! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Taking out <p> tag

Worked perfectly, thanks Dave.

Jerry - I have told them about having emails on the site but they feel that they need them. We are looking into buying that spam plug in though as that would be a great thing to have with other clients.

Thanks guys! :)

Re: [Kittybiccy] Taking out <p> tag

By Kittybiccy - May 18, 2010

Hi guys,

Is the email plug in still available? I can't see it anywhere to buy it?

Thanks!

Re: [Kittybiccy] Taking out <p> tag

By Damon - May 18, 2010

Hi,

On our order page in the New Products section here,
http://www.interactivetools.com/order/
there is a link to order Spambot Email Protector.
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [pod9] Taking out <p> tag

By Jason - February 18, 2011

Hi,

If you don't want any html added to your content, you can use a text box field instead of a wysiwyg field.

If that doesn't work for you, you could try the php strip_tags function:
http://php.net/manual/en/function.strip-tags.php

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Taking out <p> tag

By pod9 - February 22, 2011

Hi, All I want to do is not have the opening and closing tags that the editor propogates. Is there not a simple way to do this?
Pod9

Re: [pod9] Taking out <p> tag

By Jason - February 22, 2011

Hi,

There some code in this forum post that might help you get started:

http://www.interactivetools.com/forum/gforum.cgi?post=71869#71869

Hoe this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/