<P>'d Off with Formatting Options!

21 posts by 5 authors in: Forums > CMS Builder
Last Post: May 21, 2009   (RSS)

Re: [Perchpole] <P>'d Off with Formatting Options!

By Dave - June 30, 2008

Hi Perch,

What do you want it to do instead? Output <br/> tags?

There's some explanation why TinyMCE does it this way and options to change it here:

http://wiki.moxiecode.com/index.php/TinyMCE:FAQ#TinyMCE_produce_BR_elements_on_enter.2Freturn_instead_of_P_elements.3F

http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/forced_root_block

http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/force_br_newlines

Do you think those options would work for you?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] <P>'d Off with Formatting Options!

By Perchpole - June 30, 2008

Hi, Dave -

Interesting stuff. I'll give it a read.

In my particular case, I'm trying to configure a table cell in which I have data drawn from 2 fields in CMSB - namely the title and the content. Because the space is rather tight, however, the opening words of the content will appear on the same line as the title (which will appear emboldened to make it stand out). Obviously you cannot do this if the system inserts a <p> tag between the title data and the content data!

I appreciate there are easier work-arounds for this scenario but (as ever) I'm building this set-up for a client who has next-to-no experience with tools like CMS - so it's really a case of content by numbers...("The title goes in this box and the content text goes in this box - then press this button and magic will happen, etc...").

:0)

Perch

Re: [Perchpole] <P>'d Off with Formatting Options!

By Dave - June 30, 2008

Hi perch,

Do you have an example url?

Is using CSS to change how the <p> tag formatting works when inside a <td> an option?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] <P>'d Off with Formatting Options!

By Perchpole - June 30, 2008

Hi, Dave -

Yes, CSS formatting would solve the problem - but it seems like a long way around for an issue I'd rather solve directly! I guess I just begrudge the fact that the WYSIWYG editor "forces" the <p> tags into the code and I have no (direct) way of stopping it!

Hrrrmmphh!

:o/

Perch

Re: [Perchpole] <P>'d Off with Formatting Options!

By Dave - June 30, 2008

Hmm... Well, I could give you some code to strip out the P tags before you display them in the viewer. Would that work?

Do you just want <p> and </p> removed? Do you want them replaced with anything? Is it just the first <p> you need removed?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] <P>'d Off with Formatting Options!

By Perchpole - July 1, 2008

Hi, Dave -

The code would come in handy - or I could just get my nose into the TinyMCE documentation you hi-lighted.

In any event, thanks as always for your excellent support!

:0)

Perchpole

Re: [Perchpole] <P>'d Off with Formatting Options!

By Dave - July 1, 2008

Well let's try this first. Here's some code to remove the first <p> tag. It's a little complex looking... But should do the job. I'm not sure what your field is called, I'm using $record['content'] in this example. Just replace that with your variable and field name.

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

Let me know how that goes! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] <P>'d Off with Formatting Options!

By Perchpole - July 1, 2008

Ossum!

:0D

Perch

Re: [Dave] <P>'d Off with Formatting Options!

By monmon - August 6, 2008 - edited: August 6, 2008

Hi Dave,

I have the same problem & have tried your solution:

[font "Verdana"]<?php $record['fieldname'] = preg_replace("/^\s*<p>/i", "", $record['fieldname'] ); ?>

[font "Verdana"]and I am now getting:

[font "Verdana"]Notice: Undefined variable: record in /home/mesamui/public_html/cms-hotel.html on line 37 in the browser

[font "Verdana"]Can you help please

[font "Verdana"]Thanks in advance

[font "Verdana"]Simon

[font "Verdana"]