From a8a49f5aadb53a2a0cecb2891bd1305397f61f6b Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 26 Sep 2017 12:32:55 -0700 Subject: [PATCH] Allow for more than 2 default news layout options. (work in progress) --- e107_admin/newspost.php | 14 +++++++++- e107_plugins/news/news.php | 15 ++++++++--- e107_plugins/news/templates/news_template.php | 26 +++++++++++++++++-- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/e107_admin/newspost.php b/e107_admin/newspost.php index 25be9666d..c86587381 100644 --- a/e107_admin/newspost.php +++ b/e107_admin/newspost.php @@ -1098,9 +1098,21 @@ class news_admin_ui extends e_admin_ui $sefbaseDiz = str_replace(array("[br]","[","]"), array("
","",""), NWSLAN_128 ); $pingOpt = array('placeholder'=>LAN_NEWS_87); $pingVal = (!empty($pref['news_ping_services'])) ? implode("\n",$pref['news_ping_services']) : ''; - $newsTemplates = array('default'=>LAN_DEFAULT, 'list'=>LAN_LIST); //TODO 'category'=>'Categories'? research 'Use non-standard template for news layout' and integrate here. + $newsTemplates = array(); + if($newInfo = e107::getTemplateInfo('news', 'news')) //TODO 'category'=>'Categories'? research 'Use non-standard template for news layout' and integrate here. + { + foreach($newInfo as $k=>$val) + { + $newsTemplates[$k] = $val['title']; + } + + } + else + { + $newsTemplates = array('default'=>LAN_DEFAULT, 'list'=>LAN_LIST); + } $text = "
"; diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php index 2ac1337b6..a04c6bb35 100644 --- a/e107_plugins/news/news.php +++ b/e107_plugins/news/news.php @@ -1161,8 +1161,6 @@ class news_front $tp = e107::getParser(); $sql = e107::getDb(); - - $interval = $this->pref['newsposts']; global $NEWSSTYLE; @@ -1500,7 +1498,18 @@ class news_front else // v2.x { $layout = e107::getTemplate('news', 'news'); - $tmpl = $layout['default']; // default - we show the full items, except for the 'extended' part.. + if(!empty($layout[$this->defaultTemplate])) + { + $tmpl = $layout[$this->defaultTemplate]; + $this->addDebug('Template key',$this->defaultTemplate); + } + else + { + $tmpl = $layout['default'] ; + $this->addDebug('Template key','default'); + } + // $tmpl = !empty($layout[$this->defaultTemplate]) ? $layout[$this->defaultTemplate] : $layout['default'] ; // default - we show the full items, except for the 'extended' part.. + $template = $tmpl['item']; // unset($tmp); } diff --git a/e107_plugins/news/templates/news_template.php b/e107_plugins/news/templates/news_template.php index 2a3cc76d0..f65b0dbb5 100644 --- a/e107_plugins/news/templates/news_template.php +++ b/e107_plugins/news/templates/news_template.php @@ -14,10 +14,21 @@ global $sc_style; //$NEWS_MENU_TEMPLATE['list']['start'] = ''; + +$NEWS_TEMPLATE = array(); + + $NEWS_MENU_TEMPLATE['list']['start'] = '
'; $NEWS_MENU_TEMPLATE['list']['end'] = '
'; +$NEWS_INFO = array( + 'default' => array('title' => LAN_DEFAULT, 'description' => 'unused'), + 'list' => array('title' => LAN_LIST, 'description' => 'unused'), +// '2-column' => array('title' => "2 Column", 'description' => 'unused'), //@todo more default listing options. +); + + // 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 // {NEWSBODY} should not appear in the LISTSTYLE as it is NOT the same as what would appear on news.php (no query) @@ -121,8 +132,19 @@ $NEWS_TEMPLATE['default']['end'] = ''; $NEWS_TEMPLATE['category'] = $NEWS_TEMPLATE['default']; $NEWS_TEMPLATE['category']['start'] = ''; - - +/** + * @todo + */ +$NEWS_TEMPLATE['2-column']['caption'] = ''; +$NEWS_TEMPLATE['2-column']['start'] = '
'; +$NEWS_TEMPLATE['2-column']['item'] = '
+ {SETIMAGE: w=400&h=400&crop=1} + {NEWSTHUMBNAIL=placeholder} +

{NEWS_TITLE}

+

{NEWS_SUMMARY}

+

' . LAN_READ_MORE . '

+
'; +$NEWS_TEMPLATE['2-column']['end'] = '
'; ###### Default view item (temporary) ######