e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
322 stars 214 forks source link

Placement of breadcrumb when comments form is rendered #4489

Closed Moc closed 3 years ago

Moc commented 3 years ago

Bug Description

The breadcrumb is rendered in the wrong place when the comments form is rendered.

How to Reproduce

Steps to reproduce the behavior:

  1. Add comments form by using e107::getComment()->render()
  2. Refresh the page and see that the breadcrumb moves down. (see screenshots)

Expected Behavior

Breadcrumb should stay rendered at the same place (see screenshot 1) when comments form is rendered.

Screenshots

Screenshot #1: Without comments form image

Screenshot #2: With comments form image

Jimmi08 commented 3 years ago

@CaMer0n That problem is because comments use default tablerender and you can't change this from the plugin. And theme uses {---BREADCRUMB---} shortcode.

image

CaMer0n commented 3 years ago

@Moc I have added an example to the blank plugin. Please install and navigate to /e107_plugins/_blank/_blank.php with the bootstrap3 theme running. Does it cause the same issue?

Moc commented 3 years ago

Does it cause the same issue?

No, because it is called differently in the _blank plugin, after the tablerender. For me, the comments shortcode is part of the tablerender.

CaMer0n commented 3 years ago

e107::getComment()->render($plugin, $id, $subject, $rate); uses tablerender(), so you're placing one tablerender inside another. You should use e107::getComment()->render($plugin, $id, $subject, $rate); the same way you would use $ns->tablerender()

Moc commented 3 years ago

If I change the shortcode to echo instead of return, then the comments form is rendered above the other content.

I'll finish my rewrite and provide you with my code asap so you can check.

Moc commented 3 years ago

With the latest files, this is now fixed after changing the style of the comments area (ie. not 'default').

This can be done in multiple ways, for example:

  1. Through the template:

        {SETSTYLE=cookbook_comments} // or anything other than 'default' or 'main' 
        {COOKBOOK_COMMENTS}
        {SETSTYLE=default} // return back to default
  2. Through the shortcode, using something like this:

    $prevStyle = e107::getRender()->getStyle(); 
    e107::getRender()->setStyle('cookbook_comments'); 
    $text .= e107::getComment()->render($plugin, $id, $subject, $rate);
    e107::getRender()->setStyle($prevStyle);
Jimmi08 commented 2 years ago

Because the search page has a similar issue if style "default" is used, this is the next way how to fix the look:

Jimmi08 commented 2 years ago

@Moc your solution is changing style for tablestyle() for content item

This is layout from boostrap5 theme

      <!-- Blog Entries Column -->
      <div class="col-md-8">
            {ALERTS}
            {SETSTYLE=main}
            {---}
      </div>

Debug

<!-- tablestyle initial:  style=default  mode=recipe-item  UniqueId= -->
<!-- 
{
    "list": "",
    "uniqueId": "",
    "menuArea": 0,
    "menuCount": 0,
    "menuTotal": 0,
    "setStyle": "default",
    "caption": "Recipe - White calzones with marinara sauce",
    "styleCount": 1
}
-->

After deleting all SETSTYLE from your template, result is

image

image