1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +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
e107_plugins/news
e107_themes/bootstrap

@ -31,24 +31,37 @@ unset($text);
global $OTHERNEWS2_STYLE;
$ix = new news;
if(!$OTHERNEWS2_STYLE) {
$OTHERNEWS2_STYLE = "
<table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'>
<tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'>
{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(!$OTHERNEWS2_STYLE)
{
if(deftrue('BOOTSTRAP')) // v2.x
{
$template = e107::getTemplate('news', 'news_menu', 'other2');
$OTHERNEWS2_STYLE = $template['item'];
}
else //v1.x
{
$template['start'] = '';
$template['end'] = '';
$template['caption'] = TD_MENU_L2;
$OTHERNEWS2_STYLE = "
<table class='forumheader3' cellpadding='0' cellspacing='0' style='width:100%'>
<tr><td class='caption2' colspan='2' style='padding:3px;text-decoration:none;'>
{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")){
@ -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))
{
$text = "";
$text = $tp->parseTemplate($template['start'],true);
if(OTHERNEWS2_COLS !== false)
{
@ -137,12 +150,12 @@ if ($sql->db_Select_gen($query))
}
}
$text .= $tp->parseTemplate($template['end'], true);
// Save Data
ob_start();
$ns->tablerender(TD_MENU_L2, $text, 'other_news2');
$ns->tablerender($template['caption'], $text, 'other_news2');
$cache_data = ob_get_flush();
$e107cache->set("nq_othernews2", $cache_data);

@ -29,18 +29,44 @@ unset($text);
global $OTHERNEWS_STYLE;
$ix = new news;
$caption = TD_MENU_L1;
if(!$OTHERNEWS_STYLE)
{
$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";
if(deftrue('BOOTSTRAP')) // v2.x
{
$template = e107::getTemplate('news', 'news_menu', 'other');
$item_selector = '<div class="btn-group pull-right"><a class="btn btn-mini " href="#otherNews" data-slide="prev"></a>
<a class="btn btn-mini" href="#otherNews" data-slide="next"></a></div>';
$caption = "<span class='inline-text'>".$template['caption']." ".$item_selector."</span>";
$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))
{
$text = "";
$text = $tp->parseTemplate($template['start'],true);
if(OTHERNEWS_COLS !== false)
{
@ -127,18 +153,24 @@ if ($sql->db_Select_gen($query))
}
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
ob_start();
$ns->tablerender(TD_MENU_L1, $text, 'other_news');
$ns->tablerender($caption, $text, 'other_news');
$cache_data = ob_get_flush();
e107::getCache()->set("nq_othernews", $cache_data);

@ -13,6 +13,11 @@ global $sc_style;
$sc_style['NEWS_CATEGORY_NEWS_COUNT']['pre'] = '(';
$sc_style['NEWS_CATEGORY_NEWS_COUNT']['post'] = ')';
// category menu
$NEWS_MENU_TEMPLATE['category']['start'] = '<ul class="nav nav-list news-menu-category">';
$NEWS_MENU_TEMPLATE['category']['end'] = '</ul>';
@ -21,6 +26,11 @@ $NEWS_MENU_TEMPLATE['category']['item'] = '
';
//$NEWS_MENU_TEMPLATE['category']['separator'] = '<br />';
// months menu
$NEWS_MENU_TEMPLATE['months']['start'] = '<ul class="nav nav-list news-menu-months">';
$NEWS_MENU_TEMPLATE['months']['end'] = '</ul>';
@ -29,12 +39,59 @@ $NEWS_MENU_TEMPLATE['months']['item'] = '
';
//$NEWS_MENU_TEMPLATE['months']['separator'] = '<br />';
// latest menu
$NEWS_MENU_TEMPLATE['latest']['start'] = '<ul class="nav nav-list news-menu-latest">';
// Example
//$NEWS_MENU_TEMPLATE['latest']['end'] = '<br />{currentTotal} from {total}';
$NEWS_MENU_TEMPLATE['latest']['end'] = '</ul>';
$NEWS_MENU_TEMPLATE['latest']['item'] = '
<li><a class="e-menu-link newsmonths" href="{NEWSURL}">{NEWSTITLE} ({NEWSCOMMENTCOUNT})</a></li>
';
$NEWS_MENU_TEMPLATE['latest']['end'] = '</ul>'; // Example: $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>';
// 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.

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