We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Cant get rid of p tags around field data

Development and Programming

herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

Hi,

I have a LG_Image_Manager section field ‘callout_image’ where I pass a relative image url (eg /path/to/image.png).

My problem is that when I call the entry out on the frontend the first entry is wrapped in a p tag, however, subsequent entries are called out as expected.

I’ve set Section Posting Preferences ‘Allow image URLs in section entries?’ to No and Yes with the same result and I set ‘Automatically turn URLs and email addresses into links?’ Likewise.

Can anyone tell me how to get rid of the p tags without hacking it?

Cheers, Eoghan

Moved to Extensions by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Eoghan, this appears to be a third party issue, so moving to the Extensions forum for additional community support.

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

No its not actually a third party problem, I’ve tried this with a regular text field as well, I should have specified that earlier, sorry. Can you move it back again?

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

One quick question, if you look at the format of the textarea field, is it set to formatting of none?

You’ll need to have it set to that field type for our support troubleshooting.

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

Yup, have it set to None all along.

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
16 years ago
Sue Crocker's avatar Sue Crocker

Is it a text field or a textarea field?

What about other extensions? If you temporarily turn them off, does the problem still remain?

What does your template look like?

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

Its a textfield. I think I’m just gonna regex it out to be honest, I cant really afford to waste any time uninstalling extensions, I thought it might be a common problem. You can close this thread if you like. Sorry for wasting your time.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

If you have tags surrounding one entry but not others then this is usually due to the field not in the beginning having its field formatting set to None and instead being set to XHTML. This can be easily fixed though by going to :

Admin->Weblog Administration->Custom Weblog Fields->Add/Edit Custom Fields (Your Field Group)->Your Field Name->Default Text Formatting for This Field

Ensure this is set to None. If not then change it and make sure to tick the checkbox at the end of the page before updating that fields settings. This will then apply that format setting to all other existing weblog entries which should then get rid of the tags.

Hope that helps a bit.

Best wishes,

Mark

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

If anyone is interested, I ended up creating a plugin, pi.strip_tags.php which basically uses the PHP function strip_tags() and accepts one parameter for allowable tags. I dont like having to turn on PHP parsing in EE for simple things like this so this was perfect for me.

Usage:

{exp:strip_tags allowable="<p><a>"}This <em>is</em> <strong>a</strong> <a href="http://google.com">link</a>{/exp:strip_tags}

Before: This is a link

After: This is a link

Download it from Gist

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Did changing the field format not work then?

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion

it seems to have worked for the other entries, the first entry no matter how I sorted the entries would always be wrapped in tags, I didn’t really have the time to go in to more detail on it

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
it seems to have worked for the other entries, the first entry no matter how I sorted the entries would always be wrapped in tags, I didn’t really have the time to go in to more detail on it

Okay. Glad you have something sorted out now although it would have been nice to find out what was causing that problem so that hopefully it doesn’t happen to you again in the future.

One other thing you could always do of course would be to delete that entry and just re-create it again, that should get rid of the problem too of course.

Best wishes,

Mark

       
herbageonion's avatar
herbageonion
57 posts
16 years ago
herbageonion's avatar herbageonion
One other thing you could always do of course would be to delete that entry and just re-create it again, that should get rid of the problem too of course.

That’s what I tried before making the plugin but that did the same thing, whichever entry was first always got wrapped in p tags.

Cheers

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
One other thing you could always do of course would be to delete that entry and just re-create it again, that should get rid of the problem too of course.
That’s what I tried before making the plugin but that did the same thing, whichever entry was first always got wrapped in p tags. Cheers

That’s truly weird and the only thing I can think of now is that there is something up with the LG Image Manager as I wouldn’t have thought it could really be anything else really.

Might be a nice idea to contact Leevi about it and see if he has any ideas on that though. Failing that some of your template code might help 😉

Best wishes,

Mark

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.