Paragraph tags missing in templates
Posted: 02 July 2009 06:34 PM   [ Ignore ]  
Grad Student
Rank
Total Posts:  89
Joined  12-08-2008

I am using EE 1.6.7 and have the LG TinyMCE (v.1.3.3) extension installed as my client will need WYSIWYG editing panels for some content.

I don’t think the issue I am having relates to the Tiny Mce extension.

I have a custom field for a news article body set to the Wysiwyg field that the extension gives me.

I ensure that the entry content for the news article contains paragraph tags (by going to html view in the wysiwyg panel).

I have checked in the database, and the paragraph tags show up there correctly i.e. what is saved in the database for the field matches the html view in the wysiwyg panel exactly.
The content formatting field in the database table (field_ft_2 in my case) is set to none, which I think is what I want. The docs state that none means that text will not be formatted in any way which is useful for allowing HTML content, which is what the wysiwyg field does.

If I return and edit the entry again in the CP, the paragraphs are still there in wysiwyg and html view of the wysiwyg panel.

However, when I include the field in a template e.g. {news_body}, and view the resulting web page, the paragraph tags are nowhere to be seen.

Other minor HTML changes I have made to test this are preserved e.g. I can bold or italicise text and that shows up correctly. Links are also preserved.

However, the main thing I need is paragraphs, and all I get in my web page is one big lump of text without a single paragraph tag in it, even though they are in the database.

Here is an example of the true HTML (correct in wysiwyg panel and database):

<p>The website is being developed to cover all aspects of the sport, from grassroots to international as well as being a source of news for the sports community.  Devoting space to all aspects of sport, it is the place to go for the latest news, from underage competition, right through to senior international results.   The site, developed by <a href="http://www.test.com/" target="_blank">Test</a>, also devotes space to a player blog featuring the game's top <em>young</em> talents.  We hope you enjoy exploring the site as it develops.</p>
<p>Testing, <strong>testing</strong>.</p>

Here is the template code I am using:

{exp:weblog:entries weblog="news" status="not closed" limit="1" disable="member_data|trackbacks|categories|pagination"}         
<h2>{title}</h2>
<
p class="date">{entry_date format="%d %F %Y"}</p>
{news_body}
{
/exp:weblog:entries}

And here is an example of the incorrect HTML rendering I’m getting in the template:

The website is being developed to cover all aspects of the sport, from grassroots to international as well as being a source of news for the sports community.  Devoting space to all aspects of sport, it is the place to go for the latest news, from underage competition, right through to senior international results.   The site, developed by <a href="http://www.test.com/" target="_blank">Test</a>, also devotes space to a player blog featuring the game's top <em>young</em> talents.  We hope you enjoy exploring the site as it develops.
Testing, <strong>testing</strong>.

I’m hoping that this is just some setting or parameter I’m missing, but I can’t work it out. I’d really appreciate some help on this, as the site is due to go live shortly.

Thanks,
Janine.

 Signature 

Janine
Tidy.ie freelance web developers

Profile
 
 
Posted: 03 July 2009 12:35 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRank
Total Posts:  5233
Joined  03-22-2004

Janine.,

Have a look at the LG TinyMCE settings. Is there anything in the config that references tags directly or mention stripping or cleaning any of the content.

 Signature 
Profile
 
 
Posted: 03 July 2009 03:59 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  89
Joined  12-08-2008

Hi John,

There is a parameter where you set which HTML tags are allowed. This already includes paragraphs, and while I tried a few values (including the one I use with my own custom CMS which definitely allows paragraphs) I’m back at the default setting now - I figure Leevi knows what he is at smile

While I have had issues with wysiwyg editors stripping tags in the past with other CMSs, when that happened, the tags were stripped in the database. That is, I saw all the tags in the HTML view of the editor, clicked save and they vanished, as they were stripped by the editor before being stored in the database.

Here, the correct source is stored in the database - that’s why I don’t think it’s a Tiny MCE issue.
The only place I see tag stripping going on is in the rendered template.

However, this is my first EE site, and it’s a steep learning curve!

I’ve just thought that I could try a textarea field with formatting set to none, and paste my sample code in there and check if that’s meddled with. I’ll do that and report back.

 Signature 

Janine
Tidy.ie freelance web developers

Profile
 
 
Posted: 03 July 2009 04:34 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Rank
Total Posts:  89
Joined  12-08-2008

Hi again John,

Wish I’d thought of that sooner!

I still have the same issue, removing Tiny MCE from the equation.

So, I set up a textarea field with formatting set to none, and paragraph tags disappear in the rendered template.

The database row is unchanged: code correct and field_ft_2 set to none.
Whenever I edit the entry, I see the correct code in the textarea.
When I view the web page though, the paragraph tags have gone.

How can I fix this?

 Signature 

Janine
Tidy.ie freelance web developers

Profile
 
 
Posted: 03 July 2009 04:49 AM   [ Ignore ]   [ # 4 ]  
Grad Student
Rank
Total Posts:  89
Joined  12-08-2008

OK, via searching deep in the forum archives, I found my answer here:
http://expressionengine.com/forums/viewreply/302817/

For each weblog, the default html formatting in weblog posting preferences is set to “allow safe HTML” - probably a default, and sounds sensible.

I need to change this to “allow all HTML” to get paragraph tags to show up.
I am not sure why paragraph tags are viewed as dangerous though?

Also, I would like to know the repercussions of allowing all HTML here. Safe HTML sounds sensible, but it’s useless if it won’t allow something as benign as a paragraph.

 Signature 

Janine
Tidy.ie freelance web developers

Profile
 
 
Posted: 03 July 2009 11:01 AM   [ Ignore ]   [ # 5 ]  
Moderator
Avatar
RankRankRankRankRankRank
Total Posts:  5233
Joined  03-22-2004

Janine,

So, I set up a textarea field with formatting set to none, and paragraph tags disappear in the rendered template.

What happens when you set the field to XHTML?

You shouldn’t need to go near the allow safe HTML weblog preference setting for the p tags to display

 Signature 
Profile
 
 
Posted: 03 July 2009 11:41 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  89
Joined  12-08-2008

With the Tiny MCE plugin, I can’t choose the formatting of the field (it is just treated as “none” automatically). With a standard textarea, if I enter my html in it and choose xhtml format, all tags are preserved, but I gather the xhtml format is meant for entering text rather than source code.

The “Allow All HTML” option fixed things at least, but I am puzzled as to why paragraph tags are not seen as safe HTML.

 Signature 

Janine
Tidy.ie freelance web developers

Profile
 
 
Posted: 06 July 2009 12:32 AM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRank
Total Posts:  5233
Joined  03-22-2004

tidy,

but I gather the xhtml format is meant for entering text rather than source code.

XHTML format will create those paragraph tags for you when you enter line breaks.

The 2 definitions of HTML types from the docs follows which may help some more

Allow only safe HTML: This will allow “safe” HTML (<b>, <i>, <u>, <em>, <strike>, <strong>, , <code>, <blockquote>, <h2>, <h3>, <h4>, <h5>, <h6>) to be kept so that they are interpreted by the browser when the entry is viewed. All other HTML is converted to character entities and the raw code will be seen upon viewing.

Allow ALL HTML: This leaves the HTML code as written and the code will then be interpreted by the browser when the entry is viewed.

In any case I am glad you reached a solution. Feel free to start a new thread if you have any more questions.

 Signature 
Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120603 Total Logged-in Users: 66
Total Topics: 126642 Total Anonymous Users: 35
Total Replies: 665701 Total Guests: 412
Total Posts: 792343    
Members ( View Memberlist )
Newest Members:  bell143paololukDarleneChadbourneRashadSargIvar89HonschowmtRetliffherzigerjudith