Closed Moc closed 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.
@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?
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.
I have {COOKBOOK_COMMENTS}
in my template:
function sc_cookbook_comments($parm = '')
{
$plugin = 'cookbook';
$id = $this->var['r_id'];
$subject = $this->var["r_name"];
$rate = false;
return e107::getComment()->render($plugin, $id, $subject, $rate);
}
$text .= e107::getParser()->parseTemplate($LAYOUT, true, $sc);
...
e107::breadcrumb($this->breadcrumb_array);
..
e107::getRender()->tablerender(LAN_CB_RECIPE.$caption, $text, "recipe-item");
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()
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.
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:
Through the template:
{SETSTYLE=cookbook_comments} // or anything other than 'default' or 'main'
{COOKBOOK_COMMENTS}
{SETSTYLE=default} // return back to default
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);
Because the search page has a similar issue if style "default" is used, this is the next way how to fix the look:
switch($mode)
{
case "search_result":
$style = "normalstyle";
break;
}
@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
Bug Description
The breadcrumb is rendered in the wrong place when the comments form is rendered.
How to Reproduce
Steps to reproduce the behavior:
e107::getComment()->render()
Expected Behavior
Breadcrumb should stay rendered at the same place (see screenshot 1) when comments form is rendered.
Screenshots
Screenshot #1: Without comments form
Screenshot #2: With comments form