Unwanted paragraph markup

8 posts by 4 authors in: Forums > CMS Builder
Last Post: October 27, 2008   (RSS)

By rsekaly - October 24, 2008

On my website I want to display a number of announcements, consecutively one below the other. This works well, except that cmsBuilder forces the <p>...</p> html markup in each record. This then moves every line down one, adding a pile of unwanted whitespace.

Here is my code snippet:

<?php foreach ($announcementsRecords as $record): ?>
<center><h2><?php echo $record['title'] ?><h2></center>
<p><b>When<b>: <?php echo $record['when'] ?></p>
<p><b>Where</b>: <?php echo $record['where'] ?></p>
<p><b>Details</b>: <?php echo $record['content'] ?></p>


It looks like this on the website:

When:

{content from record 1}

Where:

{content from record 2}

etc....

When I checked the data in each record, I noticed that the content is wraped in <p>...</p> paragraph markup which forces the whitespaces. I've tried removing the <p> ...</p> in my code, but there is no difference. How can I get rid of the markup in each record?

Thanx!
--
Ragi Sekaly

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [rsekaly] Unwanted paragraph markup

By MisterJim - October 24, 2008

Sounds like you're using a 'WYSIWYG' field type to input your content. Try changing that field into a 'text box' field type.

The 'text box' field type will not wrap it's content with <p> tags.

Jim
WebCamp One, LLC



Websites That Work

Re: [rsekaly] Unwanted paragraph markup

By _kate_ - October 25, 2008 - edited: October 25, 2008

Just to add to what Jim has said, you might also like to have a look at this thread where I posted about the same problem >
http://www.interactivetools.com/iforum/forum.cgi?t=search_engine&do%3Dpost_view_flat%3Bsb%3Dpost_latest_reply%3Bso%3DASC%3Bpost%3D61790%3B=Next+Thread

Depending on your site layout there's a simple CSS you can add in so you can keep using the WYSIWYG section without the space, and also a link Dave posted about ways to make changes to the editor so it doesn't add the p tags.

Re: [_kate_] Unwanted paragraph markup

By rsekaly - October 25, 2008

Thank you both for your solutions. I actually used both of them as some of my fields were simple one liners, but another did have to be wysiwyg.

With the css change Iwill have to check the rest of my site to see what it affected, but it doesn't look like any major areas have changed.

Thanx again!
--
Ragi Sekaly

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [rsekaly] Unwanted paragraph markup

By _kate_ - October 25, 2008

No problem :). If you are using a global style sheet and only need that code on one page, you can just add it to the top of that page underneath the link to your css file by putting it in between the code below - that way it will affect only that page and not any others on the site (your global css will still work for that page too)

<style type="text/css">
</style>

If you have any other questions feel free to ask :)

Re: [_kate_] Unwanted paragraph markup

By rsekaly - October 25, 2008

Thanx! Already tried that. While it does remove the blank line between paras, it still gives me a problem. If you go to http://cycloneaircadets.com/announcements_e.php you will notice that in the announcements the first 2 fields (textfields) render correctly. However the 3rd field, Details, is WYSIWYG. With this field, the <p>...</p> still forces the text of the record to start on the next line. Unfortunately, my client wants a WYSIWYG field here.

Basically, I would like to have the record to start printing one space after the "Details:" title.

Any ideas?
--
Ragi Sekaly

"Any sufficiently advanced technology
is indistinguishable from magic."
........Arthur C. Clarke

Re: [rsekaly] Unwanted paragraph markup

By Dave - October 27, 2008

Hi Ragi,

Here's a post with some code that will remove the first <p> for you.

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

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