1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 03:40:37 +02:00

Othernews and Othernews2 Menu templates updated.

This commit is contained in:
Cameron
2013-11-03 21:47:26 -08:00
parent cf18561926
commit 4132b454ae
4 changed files with 147 additions and 43 deletions

View File

@@ -31,24 +31,37 @@ unset($text);
global $OTHERNEWS2_STYLE; global $OTHERNEWS2_STYLE;
$ix = new news; $ix = new news;
if(!$OTHERNEWS2_STYLE) { if(!$OTHERNEWS2_STYLE)
$OTHERNEWS2_STYLE = " {
<table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'> if(deftrue('BOOTSTRAP')) // v2.x
<tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'> {
{NEWSCATICON} $template = e107::getTemplate('news', 'news_menu', 'other2');
{NEWSCATEGORY} $OTHERNEWS2_STYLE = $template['item'];
</td></tr> }
<tr><td style='padding:3px;vertical-align:top'> else //v1.x
{NEWSTITLELINK} {
<br /> $template['start'] = '';
{NEWSSUMMARY} $template['end'] = '';
</td> $template['caption'] = TD_MENU_L2;
<td style='padding:3px'>
{NEWSTHUMBNAIL} $OTHERNEWS2_STYLE = "
</td> <table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'>
</tr> <tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'>
</table> {NEWSCATICON}
"; {NEWSCATEGORY}
</td></tr>
<tr><td style='padding:3px;vertical-align:top'>
{NEWSTITLELINK}
<br />
{NEWSSUMMARY}
</td>
<td style='padding:3px'>
{NEWSTHUMBNAIL}
</td>
</tr>
</table>
";
}
} }
if(!defined("OTHERNEWS2_LIMIT")){ if(!defined("OTHERNEWS2_LIMIT")){
@@ -96,7 +109,7 @@ AND FIND_IN_SET(3, n.news_render_type) ORDER BY n.news_datestamp DESC LIMIT 0,"
if ($sql->db_Select_gen($query)) if ($sql->db_Select_gen($query))
{ {
$text = ""; $text = $tp->parseTemplate($template['start'],true);
if(OTHERNEWS2_COLS !== false) if(OTHERNEWS2_COLS !== false)
{ {
@@ -137,12 +150,12 @@ if ($sql->db_Select_gen($query))
} }
} }
$text .= $tp->parseTemplate($template['end'], true);
// Save Data // Save Data
ob_start(); ob_start();
$ns->tablerender(TD_MENU_L2, $text, 'other_news2'); $ns->tablerender($template['caption'], $text, 'other_news2');
$cache_data = ob_get_flush(); $cache_data = ob_get_flush();
$e107cache->set("nq_othernews2", $cache_data); $e107cache->set("nq_othernews2", $cache_data);

View File

@@ -29,18 +29,44 @@ unset($text);
global $OTHERNEWS_STYLE; global $OTHERNEWS_STYLE;
$ix = new news; $ix = new news;
$caption = TD_MENU_L1;
if(!$OTHERNEWS_STYLE) if(!$OTHERNEWS_STYLE)
{ {
$OTHERNEWS_STYLE = " if(deftrue('BOOTSTRAP')) // v2.x
<div style='padding:3px;width:100%'> {
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
<tr> $template = e107::getTemplate('news', 'news_menu', 'other');
<td style='vertical-align:top;padding:3px;width:20px'>
{NEWSCATICON} $item_selector = '<div class="btn-group pull-right"><a class="btn btn-mini " href="#otherNews" data-slide="prev"></a>
</td><td style='text-align:left;padding:3px;vertical-align:top'> <a class="btn btn-mini" href="#otherNews" data-slide="next"></a></div>';
{NEWSTITLELINK}
</td></tr></table> $caption = "<span class='inline-text'>".$template['caption']." ".$item_selector."</span>";
</div>\n";
$OTHERNEWS_STYLE = $template['item'];
}
else //v1.x
{
$template['start'] = '';
$template['end'] = '';
$OTHERNEWS_STYLE = "
<div style='padding:3px;width:100%'>
<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>
<tr>
<td style='vertical-align:top;padding:3px;width:20px'>
{NEWSCATICON}
</td><td style='text-align:left;padding:3px;vertical-align:top'>
{NEWSTITLELINK}
</td></tr></table>
</div>\n";
}
} }
@@ -90,7 +116,7 @@ WHERE n.news_class IN (".USERCLASS_LIST.") AND n.news_start < ".$_t." AND (n.new
if ($sql->db_Select_gen($query)) if ($sql->db_Select_gen($query))
{ {
$text = ""; $text = $tp->parseTemplate($template['start'],true);
if(OTHERNEWS_COLS !== false) if(OTHERNEWS_COLS !== false)
{ {
@@ -127,18 +153,24 @@ if ($sql->db_Select_gen($query))
} }
else // perfect for divs. else // perfect for divs.
{ {
while ($row = $sql->db_Fetch()) $loop = 0;
while ($row = $sql->fetch())
{ {
$text .= $ix->render_newsitem($row, 'return', '', $OTHERNEWS_STYLE, $param); $active = ($loop == 0) ? 'active' : '';
$TMPL = str_replace("{ACTIVE}", $active, $OTHERNEWS_STYLE);
$text .= $ix->render_newsitem($row, 'return', '', $TMPL, $param);
$loop++;
} }
} }
$text .= $tp->parseTemplate($template['end'], true);
// Save Data // Save Data
ob_start(); ob_start();
$ns->tablerender(TD_MENU_L1, $text, 'other_news'); $ns->tablerender($caption, $text, 'other_news');
$cache_data = ob_get_flush(); $cache_data = ob_get_flush();
e107::getCache()->set("nq_othernews", $cache_data); e107::getCache()->set("nq_othernews", $cache_data);

View File

@@ -13,6 +13,11 @@ global $sc_style;
$sc_style['NEWS_CATEGORY_NEWS_COUNT']['pre'] = '('; $sc_style['NEWS_CATEGORY_NEWS_COUNT']['pre'] = '(';
$sc_style['NEWS_CATEGORY_NEWS_COUNT']['post'] = ')'; $sc_style['NEWS_CATEGORY_NEWS_COUNT']['post'] = ')';
// category menu // category menu
$NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="nav nav-list news-menu-category">'; $NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="nav nav-list news-menu-category">';
$NEWS_MENU_TEMPLATE['category']['end'] = '</ul>'; $NEWS_MENU_TEMPLATE['category']['end'] = '</ul>';
@@ -21,6 +26,11 @@ $NEWS_MENU_TEMPLATE['category']['item'] = '
'; ';
//$NEWS_MENU_TEMPLATE['category']['separator'] = '<br />'; //$NEWS_MENU_TEMPLATE['category']['separator'] = '<br />';
// months menu // months menu
$NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="nav nav-list news-menu-months">'; $NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="nav nav-list news-menu-months">';
$NEWS_MENU_TEMPLATE['months']['end'] = '</ul>'; $NEWS_MENU_TEMPLATE['months']['end'] = '</ul>';
@@ -29,12 +39,59 @@ $NEWS_MENU_TEMPLATE['months']['item'] = '
'; ';
//$NEWS_MENU_TEMPLATE['months']['separator'] = '<br />'; //$NEWS_MENU_TEMPLATE['months']['separator'] = '<br />';
// latest menu // latest menu
$NEWS_MENU_TEMPLATE['latest']['start'] = '<ul class="nav nav-list news-menu-latest">'; $NEWS_MENU_TEMPLATE['latest']['start'] = '<ul class="nav nav-list news-menu-latest">';
// Example $NEWS_MENU_TEMPLATE['latest']['end'] = '</ul>'; // Example: $NEWS_MENU_TEMPLATE['latest']['end'] '<br />{currentTotal} from {total}';
//$NEWS_MENU_TEMPLATE['latest']['end'] = '<br />{currentTotal} from {total}'; $NEWS_MENU_TEMPLATE['latest']['item'] = '<li><a class="e-menu-link newsmonths" href="{NEWSURL}">{NEWSTITLE} ({NEWSCOMMENTCOUNT})</a></li>';
$NEWS_MENU_TEMPLATE['latest']['end'] = '</ul>';
$NEWS_MENU_TEMPLATE['latest']['item'] = '
<li><a class="e-menu-link newsmonths" href="{NEWSURL}">{NEWSTITLE} ({NEWSCOMMENTCOUNT})</a></li>
';
// Other News Menu.
$NEWS_MENU_TEMPLATE['other']['caption'] = TD_MENU_L1;
$NEWS_MENU_TEMPLATE['other']['start'] = "<div id='otherNews' data-interval='false' class='carousel slide othernews-block'>
<div class='carousel-inner'>
{SETIMAGE: w=400&h=200&crop=1}"; // set the {NEWSIMAGE} dimensions.
$NEWS_MENU_TEMPLATE['other']['item'] = '<div class="item {ACTIVE}">
{NEWSIMAGE}
<h2>{NEWSTITLE}</h2>
<p>{NEWSSUMMARY}</p>
<p class="text-right"><a class="btn" href="{NEWSURL}">'.LAN_READ_MORE.' &raquo;</a></p>
</div>';
$NEWS_MENU_TEMPLATE['other']['end'] = "</div></div>";
// Other News Menu. 2
$NEWS_MENU_TEMPLATE['other2']['caption'] = TD_MENU_L2;
$NEWS_MENU_TEMPLATE['other2']['start'] = "<ul class='media-list unstyled othernews2-block'>{SETIMAGE: w=100&h=100&crop=1}"; // set the {NEWSIMAGE} dimensions.
$NEWS_MENU_TEMPLATE['other2']['item'] = "<li class='media'>
<span class='media-object pull-left'>{NEWSIMAGE}</span>
<div class='media-body'><b>{NEWSTITLELINK}</b><br />
<small class='muted smalltext'>{NEWSSUMMARY}</small><br />
</div>
</li>\n";
$NEWS_MENU_TEMPLATE['other2']['end'] = "</ul>";
//$NEWS_MENU_TEMPLATE['latest']['separator'] = '<br />'; // Shouldn't be needed. //$NEWS_MENU_TEMPLATE['latest']['separator'] = '<br />'; // Shouldn't be needed.

View File

@@ -65,18 +65,20 @@ if(THEME_LAYOUT == 'docs')
//define("STANDARDS_MODE",TRUE); //define("STANDARDS_MODE",TRUE);
/*
$OTHERNEWS_STYLE = '<div class="span4"> $OTHERNEWS_STYLE = '<div class="span4">
<h2>{NEWSTITLE}</h2> <h2>{NEWSTITLE}</h2>
<p>{NEWSSUMMARY}</p> <p>{NEWSSUMMARY}</p>
<p><a class="btn" href="{NEWSURL}">View details &raquo;</a></p> <p><a class="btn" href="{NEWSURL}">View details &raquo;</a></p>
</div><!--/span-->'; </div><!--/span-->';
$OTHERNEWS2_STYLE = '<div class="span4"> $OTHERNEWS2_STYLE = '<div class="span4">
<h2>{NEWSTITLE}</h2> <h2>{NEWSTITLE}</h2>
<p>{NEWSSUMMARY}</p> <p>{NEWSSUMMARY}</p>
<p><a class="btn" href="{NEWSURL}">View details &raquo;</a></p> <p><a class="btn" href="{NEWSURL}">View details &raquo;</a></p>
</div><!--/span-->'; </div><!--/span-->';
*/
define('OTHERNEWS_COLS',false); // no tables, only divs. define('OTHERNEWS_COLS',false); // no tables, only divs.
define('OTHERNEWS_LIMIT', 3); // Limit to 3. define('OTHERNEWS_LIMIT', 3); // Limit to 3.