1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

'styleCount' info added to all theme tablestyle() calls. 'styleCount' keeps count of the number of times the current style has been rendered. Usage example added to the bootstrap3 theme. Core news view template updated to use tablestyle caption correctly.

This commit is contained in:
Cameron 2021-02-19 07:33:05 -08:00
parent a136e3771c
commit c03e0ab066
3 changed files with 18 additions and 7 deletions

View File

@ -21,6 +21,7 @@
private $content = array();
private $contentTypes = array('header', 'footer', 'text', 'title', 'image', 'list');
private $mainRenders = array(); // all renderered with style = 'default' or 'main'.
private $styleCount = array();
private $thm;
@ -34,7 +35,7 @@
$this->load();
}
// Called in header.
// Called in header_default.php.
public function init()
{
@ -331,7 +332,7 @@
private function hasLegacyCode()
{
$legacy = ['VIEWPORT', 'THEME_DISCLAIMER', 'IMODE', 'BODYTAG', 'COMMENTLINK', 'OTHERNEWS_LIMIT',
$legacy = ['VIEWPORT', 'THEME_DISCLAIMER', 'IMODE', 'HTMLTAG', 'BODYTAG', 'COMMENTLINK', 'OTHERNEWS_LIMIT',
'PRE_EXTENDEDSTRING', 'COMMENTOFFSTRING', 'CORE_CSS', 'TRACKBACKSTRING', 'TRACKBACKBEFORESTRING'];
foreach($legacy as $const)
@ -376,6 +377,14 @@
$this->mainRenders[] = $options;
}
if(!empty($this->eSetStyle))
{
$this->styleCount[$this->eSetStyle]++;
}
$options['styleCount'] = varset($this->styleCount[$this->eSetStyle]);
//XXX Optional feature may be added if needed - define magic shortcodes inside $thm class. eg. function msc_custom();
if(!empty($this->thm) && is_object($this->thm))

View File

@ -22,14 +22,11 @@ $NEWS_VIEW_INFO = array(
$NEWS_VIEW_WRAPPER['default']['item']['NEWSIMAGE: item=1'] = '<span class="news-images-main pull-left float-left col-xs-12 col-sm-6 col-md-6">{---}</span>';
$NEWS_VIEW_TEMPLATE['default']['caption'] = null; // add a value to user tablerender()
$NEWS_VIEW_TEMPLATE['default']['caption'] = '{NEWS_TITLE}'; // null; // add a value to user tablerender()
$NEWS_VIEW_TEMPLATE['default']['item'] = '
{SETIMAGE: w=900&h=600}
<div class="view-item">
<h2 class="news-title">{NEWS_TITLE: link=1}</h2>
<hr class="news-heading-sep">
<div class="row">
<div class="row">
<div class="col-md-6"><small>{GLYPH=user} &nbsp;{NEWSAUTHOR} &nbsp; {GLYPH=time} &nbsp;{NEWSDATE=short} </small></div>
<div class="col-md-6 text-right options"><small>{GLYPH=tags} &nbsp;{NEWSTAGS} &nbsp; {GLYPH=folder-open} &nbsp;{NEWSCATEGORY} </small></div>
</div>

View File

@ -144,6 +144,11 @@ class theme implements e_theme_render
echo '<h2 class="caption">'.$caption.'</h2>';
}
if($info['styleCount'] === 1) // add the breadcrumb the first time the 'default' style is rendered.
{
echo '{---BREADCRUMB---}';
}
echo $text;
// code to be executed if n is different from all labels;
}