Is it possible to get the text by default without the paragraph tags.
Also if I click the source code and I removed them, when I go back to the normal view the paragraph tags are placed again.
Thanks.
Official
Response
-
CKEditor requires that all text be within some sort of block level element. While <p> is the default, you can change a block to a plain <div> by selecting “Normal (DIV)” in the Paragraph Format menu.
-
Seriously need this 'feature' as well, as it is adding tags to many unwanted fields, and causing inconsistent layout on my client's site (only fields edited post-Wygwam are effected, so older entries display properly).
I know that in TinyMCE, this was a feature that could be disabled. Any idea if the same is true for CKEditor?
Ira
-
-
Ira, do you need to strip out all the tags, or do you need to strip out just the opening and closing
only? I often need to do the latter so I can float an image at the beginning or end of a paragraph. When I need to do this, I enclose the field in an Expression Engine plugin called ptobr ("paragraphs to breaks").
Also, when the tags are being added to many bits of text in the Wygwam field... is this from text pasted into the box? if so, are you "pasting as plain text"? It's a "feature" of CKEditor that if you, say, paste normal text copied from an InDesign documents, it tries to capture your font and other features of the original copy, and embeds really cluttery tags. (When I paste, I always paste as plain text for this reason).
If not, what sorts of tags are appearing?
Cheers
Rob -
-
Hey Rob,
Didn't know about the ptobr plugin, that might do!
What's happening, is that some fields are for titles/subtitles (eg: on Press Releases). We want the basic WYGWAM field (for bold, etc), but don't necessarily want it wrapped in a < p > tag.
If I have a field, for example, where the text is just " Hello World ", it saves the data as:
< p >
Hello World< /p >
(with the linebreak and tabbed second line, but without the spaces in the p tags)
If I look at the source, remove the paragraph tags and save, they're automatically added again.
I've also seen it do this for other WYGWAM fields which contained pasted text (with some DIVs, etc), and again, it wrapped the whole thing in < p > ... < / p >
But again, when it does this, it's always the start and end, so PTOBR might work. Though, I guess what I really need is P to Newline, or to figure out how to tell CKFinder to stop adding the paragraphs by default.
Cheers,
Ira -
-
Oh! Titles and subtitles - I'm in the middle of a similar formatting mess, and that's when I discovered ptobr, especially when I began introducing Wygwam fields into the system.
I use ptobr in combination with a paragraph tag. This lets me insert an image reference field like so, and still wrap the image and text in paragraph tags.
<h2>title</h2>
<h3>subtitle</h3>
<p>{exp:ptobr}{wygwam_body}{/exp:ptobr}
If there are any <p> tags in the middle of {wygwam_body}, they are balanced out by bookending them with the paragraph tags I've manually re-inserted.
Then, I use my CSS to control the spacing for instances of subtitles (h3) following titles (h2) (ie. "h2+h3") and paragraphs (p) following subtitles (h3) (ie. h3+p). (I usually make the margin/padding tighter in a list of entries or even zero out the padding in those instances).
This is just because I like to have most of my site's body text in < p > tags and only "snippets" and metadata outside of < p > tags. So the above works for me. -
-
For what it's worth, CKEditor has an option called "enterMode" which determines whether it turns line breaks into p, div, or br tags. The feature is documented at:
http://docs.cksource.com/ckeditor_api...
I don't yet know how hard it is to change CKEditor configuration options in a Wygwam environment. Has anybody tried it?
The authors of CKEditor issue lots of dire warnings about setting enterMode to br but I don't think they envisioned the common ExpressionEngine/Wygwam situation where a blob of content edited in CKEditor is only intended to be a fragment within a larger p.
Ideally, it would be nice if Wygwam let us set the enterMode behavior of CKEditor on a per-field or per-toolbar basis. I don't know whether that would give CKEditor indigestion. -
-
I am in trouble with this problem. I cannot get the formatting I want with those *^%$# p tags being added. I need them to be gone.
The biggest place I have this problem is when I need a single img tag with no gaps. Even a br won't help here. -
-
I had the opposite problem where the paragraph tags showed up in Wygwam, but got stripped when saved. I'd had section posting preferences set to "Allow Only Safe HTML" When I changed it to "Allow All HTML" it allowed the paragraph tags. So, check your setting there and change according to your needs (didn't test with other tags). Admin > Weblog Admin > Weblog Management > Section Posting Preferences (EE 1.6.8)
-
-
I'm having the same issue, I need the p tags to not exist, and just use br for line breaks. Would really appreciate it if Brandon or some other Pixel & Tonic employee could take a look at this and give us an answer. Looks like it's gone unanswered for over 6 months now.
-
-
Hey gang, the new Wygwam lets you set a lot of entry options when you configure its "advanced settings" on a per field basis.
One of these is entryMode. I haven't experimented with this, but deezignink, if you apply this setting and choose <br>, that could potentially solve your problems. Then wrap it in external paragraph tags as you need to. -
-
This might be what you want: strip_p
-
-
Here's what I did which seems to work:
1) Enable PHP for the template where you are showing the entry
2) Store the content that has the errant tags into a PHP variable (this must be inside your {exp:channel:entries} tag pair). NOTE: I had to add some spaces below in order to be able to post this code. Remove space between <<< and EOD. Also remove spaces in the < p > and < /p > paragraph tags.
<<< EOD
{your_channel_field_name}
EOD;
//Trim off < p > and </ p > tags
$html = trim($html, "< p >");
$html = trim($html, "< /p >");
?>
The "EOD" syntax is required in case your content contains quotes -- i.e., you SHOULD NOT simply do something like this:
$html = "{your_channel_field_name}";
This will not work if your content contains double quotes (").
3) Where you would normally just output {your_channel_field_name} in your template, do this instead to output the fixed-up PHP variable:
-
-
CKEditor requires that all text be within some sort of block level element. While <p> is the default, you can change a block to a plain <div> by selecting “Normal (DIV)” in the Paragraph Format menu.
-
Loading Profile...


Twitter,
Facebook, or email.

EMPLOYEE




