Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Phantom Paragraph Tags

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 2155 Views
  • redking
    Avatar
    43 Posts

    Phantom Paragraph Tags Link to this post

    Hi,

    When viewing my published site, I am finding three pairs of phantom paragraph tags <p></p> in one particular section of the page. They are actually appearing in the presentation of the page (see attached image), not just in the source code. I've scoured the template for that page and can't find where these tags are coming from. I've also checked to make sure that there are no hard paragraph breaks in the CMS that could be causing it. Has anyone experienced this before?
    I've isolated it to one section of code in my template (see below), but am complete boggled as to where these tags are coming from. Anyone have any insight?

    Thanks!

    The snippet of code in which the tags are coming from:

    <!-- Begin Blue Content Area -->
                <div id="contentBandBlue">
                   <div id="contentBlue">
                      $BlueContent
                      
                      <!-- Begin Left Column -->
                      <div id="leftColumnHome">
                         $LeftColContent
                      </div>
                      <!-- End Left Column -->
                      
                      <!-- Begin Middle Column -->
                      <div id="midColumn">
                         $MidColContent
                      </div>
                      <!-- End Middle Column -->
                      
                      <!-- Begin Right Column -->
                      <div id="rightColumnHome">
                         $RightColContent
                      </div>
                      <!-- End Right Column -->
                      
                   </div>
                </div>
                <!-- End Blue Content Area -->

  • redking
    Avatar
    43 Posts

    Re: Phantom Paragraph Tags Link to this post

    Here's the image. I forgot to upload it in the previous post.

  • redking
    Avatar
    43 Posts

    Re: Phantom Paragraph Tags Link to this post

    I just tried adding content via the CMS in the area where these mysterious tags are appearing, and it won't render it. I just displays the actual code. This makes me think I have an unclosed tag somewhere, but I can't seem to find one. This is so odd...

  • redking
    Avatar
    43 Posts

    Re: Phantom Paragraph Tags Link to this post

    Just in case, here's what the pagetype looks like:

    <?php
    /**
    * Defines the HomePage page type
    */

    class HomePage extends Page {

       static $db = array(
       'BlueContent' => 'Text',
       'LeftColContent' => 'Text',
       'MidColContent' => 'Text',
       'RightColContent' => 'Text'
       );

       function getCMSFields() {
       $fields = parent::getCMSFields();
       
       $fields->addFieldToTab('Root.Content.Blue', new HtmlEditorField('BlueContent', 'Blue Conent'));
       $fields->addFieldToTab('Root.Content.LeftCol', new HtmlEditorField('LeftColContent', 'Left Col Conent'));
       $fields->addFieldToTab('Root.Content.MidCol', new HtmlEditorField('MidColContent', 'Mid Col Conent'));
       $fields->addFieldToTab('Root.Content.RightCol', new HtmlEditorField('RightColContent', 'Right Col Conent'));
       
       return $fields;
       }
       
       static $has_one = array(
       );

    static $icon = "tutorial/images/treeicons/home";

    }

    class HomePage_Controller extends Page_Controller {
       
    }
    ?>

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: Phantom Paragraph Tags Link to this post

    The problem is you have defined your database fields as Text fields. This is plain text (eg not going to be rendered as HTML) yet you use HTMLEditorFields to edit it which will allow HTML but because it is a text field in the database thats what it outputs it as.

    Silverstripe should warn you about this bug - make sure you have error_reporting() on. But the fix is simple, change your Database fields to HTMLText or change the cms boxs to TextareaFields() rather then HTMLEditors if you only intend on using plain text

    2155 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.