From 58435c2cc6d18f185d9f8212ca0b2071e4522290 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 3 Nov 2013 18:58:50 -0800 Subject: [PATCH] News template BC fixes and added news-list start and end templates. --- e107_plugins/news/templates/news_template.php | 9 +-- .../templates/news/news_template.php | 9 +-- e107_themes/bootstrap/theme.php | 26 --------- news.php | 58 +++++++------------ 4 files changed, 32 insertions(+), 70 deletions(-) diff --git a/e107_plugins/news/templates/news_template.php b/e107_plugins/news/templates/news_template.php index 6bc7aa2a4..a8d324e69 100644 --- a/e107_plugins/news/templates/news_template.php +++ b/e107_plugins/news/templates/news_template.php @@ -10,7 +10,7 @@ if (!defined('e107_INIT')) exit; global $sc_style; -###### Default list item (temporary) - TODO rewrite news, template standards ###### +###### Default list item (temporary) - TODO rewrite news ###### //$NEWS_MENU_TEMPLATE['list']['start'] = ''; @@ -23,8 +23,9 @@ $NEWS_MENU_TEMPLATE['list']['end'] = ''; // {NEWSBODY} should not appear in the LISTSTYLE as it is NOT the same as what would appear on news.php (no query) // Template/CSS to be reviewed for best bootstrap implementation -$NEWS_TEMPLATE['list']['item'] = ' - {SETIMAGE: w=400&h=300&crop=1} +$NEWS_TEMPLATE['list']['start'] = '{SETIMAGE: w=400&h=300&crop=1}'; +$NEWS_TEMPLATE['list']['end'] = ''; +$NEWS_TEMPLATE['list']['item'] = '
@@ -38,7 +39,7 @@ $NEWS_TEMPLATE['list']['item'] = ' {NEWSSUMMARY}

- Read More + '.LAN_READ_MORE.'

diff --git a/e107_themes/bootstrap/templates/news/news_template.php b/e107_themes/bootstrap/templates/news/news_template.php index 127111453..491a40870 100644 --- a/e107_themes/bootstrap/templates/news/news_template.php +++ b/e107_themes/bootstrap/templates/news/news_template.php @@ -40,9 +40,10 @@ $NEWS_TEMPLATE['default']['item'] = ' // XXX The ListStyle template offers a listed summary of items with a minimum of 10 items per page. -// As displayed by news.php?cat.1 OR news.php?all -$NEWS_TEMPLATE['list']['item'] = ' - {SETIMAGE: w=400&h=300&crop=1} +// As displayed by news.php?cat.1 OR news.php?all OR news.php?tag=xxx +$NEWS_TEMPLATE['list']['start'] = '{SETIMAGE: w=400&h=300&crop=1}'; +$NEWS_TEMPLATE['list']['end'] = ''; +$NEWS_TEMPLATE['list']['item'] = '
@@ -56,7 +57,7 @@ $NEWS_TEMPLATE['list']['item'] = ' {NEWSSUMMARY}

- Read More + '.LAN_READ_MORE.'

diff --git a/e107_themes/bootstrap/theme.php b/e107_themes/bootstrap/theme.php index d4cbd9091..6f2214432 100644 --- a/e107_themes/bootstrap/theme.php +++ b/e107_themes/bootstrap/theme.php @@ -511,32 +511,6 @@ TMPL; - -$NEWSLISTSTYLE = " -\n\n\n\n - - - - - - -
- {NEWSCATICON} - - - {NEWSTITLELINK} -
- {NEWSSUMMARY} -
- {NEWSTHUMBNAIL} -
- -\n\n\n\n -" - -; - - $NEWSCAT = "\n\n\n\n\n\n\n\n
diff --git a/news.php b/news.php index ec9d7c159..d2795c2fe 100644 --- a/news.php +++ b/news.php @@ -225,39 +225,13 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) require_once(HEADERF); $action = $currentNewsAction; - /* - if(!$NEWSLISTSTYLE) - { - $NEWSLISTSTYLE = " -
- - -
- {NEWSCATICON} - - {NEWSTITLELINK=extend} -
- {NEWSSUMMARY} - - {NEWSDATE} - {NEWSCOMMENTS} - -
- {NEWSTHUMBNAIL} -
-
\n"; - - }*/ - - if(vartrue($NEWSLISTSTYLE)) + if(vartrue($NEWSLISTSTYLE)) // Legacy v1.x { $template = $NEWSLISTSTYLE; } - else + else // v2.x { - $tmp = e107::getTemplate('news', 'news', 'list'); - $template = $tmp['item']; - unset($tmp); + $template = e107::getTemplate('news', 'news', 'list'); } $param = array(); @@ -270,11 +244,22 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) // NEW - allow news batch shortcode override (e.g. e107::getScBatch('news', 'myplugin', true); ) e107::getEvent()->trigger('news_list_parse', $newsList); + if(vartrue($template['start'])) + { + $text .= $tp->parseTemplate($template['start'], true); + } + foreach($newsList as $row) { - $text .= $ix->render_newsitem($row, 'return', '', $template, $param); + $text .= $ix->render_newsitem($row, 'return', '', $template['item'], $param); } + if(vartrue($template['end'])) + { + $text .= $tp->parseTemplate($template['end'], true); + } + + $icon = ($row['category_icon']) ? "" : ""; // Deprecated. @@ -283,11 +268,12 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) // // $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}")."
"; - $amount = NEWSLIST_LIMIT; - $nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount='.NEWS_NEXTPREV_NAVCOUNT : '' ; - $url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms)); - $parms = 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='.$news_total.'&amount='.$amount.'¤t='.$newsfrom.$nitems.'&url='.$url; - $text .= $tp->parseTemplate("{NEXTPREV={$parms}}"); + $amount = NEWSLIST_LIMIT; + $nitems = defined('NEWS_NEXTPREV_NAVCOUNT') ? '&navcount='.NEWS_NEXTPREV_NAVCOUNT : '' ; + $url = rawurlencode(e107::getUrl()->create($newsRoute, $newsUrlparms)); + $parms = 'tmpl_prefix='.deftrue('NEWS_NEXTPREV_TMPL', 'default').'&total='.$news_total.'&amount='.$amount.'¤t='.$newsfrom.$nitems.'&url='.$url; + + $text .= $tp->parseTemplate("{NEXTPREV={$parms}}"); if(!$NEWSLISTTITLE) { @@ -297,7 +283,7 @@ if ($action == 'cat' || $action == 'all' || vartrue($_GET['tag'])) { $NEWSLISTTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,'TITLE'),$NEWSLISTTITLE); } - $text .= ""; + $text .= ""; ob_start(); $ns->tablerender($NEWSLISTTITLE, $text, 'news'); $cache_data = ob_get_flush();