1
0
mirror of https://github.com/e107inc/e107.git synced 2025-09-09 05:40:44 +02:00

Issue #2795 Support multiple news 'view' layouts (requires database update)

This commit is contained in:
Cameron
2017-09-23 14:08:47 -07:00
parent 9606105e24
commit 13d58de464
6 changed files with 157 additions and 11 deletions

View File

@@ -854,7 +854,7 @@ class news_front
$param['catlink'] = (defined("NEWSLIST_CATLINK")) ? NEWSLIST_CATLINK : "";
$param['caticon'] = (defined("NEWSLIST_CATICON")) ? NEWSLIST_CATICON : defset('ICONSTYLE','');
$param['current_action'] = $action;
$param['template_key'] = 'list';
$param['template_key'] = 'news/list';
// NEW - allow news batch shortcode override (e.g. e107::getScBatch('news', 'myplugin', true); )
e107::getEvent()->trigger('news_list_parse', $newsList);
@@ -1053,7 +1053,7 @@ class news_front
$param = array();
$param['current_action'] = $action;
$param['template_key'] = 'view';
$param['template_key'] = 'news/view';
if(vartrue($NEWSSTYLE))
{
@@ -1066,6 +1066,14 @@ class news_front
else
{
$tmp = e107::getTemplate('news', 'news', 'view');
if(empty($tmp))
{
$newsViewTemplate = !empty($news['news_template']) ? $news['news_template'] : 'default';
$tmp = e107::getTemplate('news', 'news_view', $newsViewTemplate);
$param['template_key'] = 'news_view/'.$newsViewTemplate;
}
$template = $tmp['item'];
unset($tmp);
}
@@ -1480,7 +1488,7 @@ class news_front
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
$param = array();
$param['current_action'] = $action;
$param['template_key'] = 'default';
$param['template_key'] = 'news/default';
// Get Correct Template
// XXX we use $NEWSLISTSTYLE above - correct as we are currently in list mode - XXX No this is not NEWSLISTSTYLE - which provides only summaries.
@@ -1502,7 +1510,7 @@ class news_front
{
$tmpl = $layout['category'];
$template = $tmpl['item'];
$param['template_key'] = 'category';
$param['template_key'] = 'news/category';
}

View File

@@ -131,7 +131,9 @@ $NEWS_TEMPLATE['category']['start'] = '<!-- Category News Template -->';
// As displayed by news.php?extend.1
//@XXX SEE news_view_template.php
/*
$NEWS_WRAPPER['view']['item']['NEWSIMAGE: item=1'] = '<span class="news-images-main pull-left col-xs-12 col-sm-6 col-md-6">{---}</span>';
$NEWS_TEMPLATE['view']['item'] = '
@@ -197,7 +199,7 @@ $NEWS_TEMPLATE['view']['item'] = '
{NEWSNAVLINK}
';
*/
/*
* <hr />
<h3>About the Author</h3>

View File

@@ -0,0 +1,96 @@
<?php
/**
* e107 website system
*
* Copyright (C) 2008-2017 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
$NEWS_VIEW_INFO = array(
'default' => array('title' => LAN_DEFAULT, 'description' => 'unused'),
'videos' => array('title' => "Videos (experimental)", 'description' => 'unused'),
);
// Default
$NEWS_VIEW_WRAPPER['default']['item']['NEWSIMAGE: item=1'] = '<span class="news-images-main pull-left col-xs-12 col-sm-6 col-md-6">{---}</span>';
$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="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>
<hr>
<div class="body">
{NEWSIMAGE: item=1}
<p class="lead">{NEWS_SUMMARY}</p>
<div class="text-justify">
{NEWS_BODY=body}
</div>
<div class="news-videos-1">
{NEWSVIDEO: item=1}
{NEWSVIDEO: item=2}
{NEWSVIDEO: item=3}
</div>
<br />
{SETIMAGE: w=400&h=400}
<div class="row news-images-1">
<div class="col-md-6">{NEWSIMAGE: item=2}</div>
<div class="col-md-6">{NEWSIMAGE: item=3}</div>
</div>
<div class="row news-images-2">
<div class="col-md-6">{NEWSIMAGE: item=4}</div>
<div class="col-md-6">{NEWSIMAGE: item=5}</div>
</div>
{NEWSVIDEO: item=4}
{NEWSVIDEO: item=5}
<div class="body-extended text-justify">
{NEWS_BODY=extended}
</div>
</div>
<hr>
<div class="options hidden-print ">
<div class="btn-group">{NEWSCOMMENTLINK: glyph=comments&class=btn btn-default}{PRINTICON: class=btn btn-default}{ADMINOPTIONS: class=btn btn-default}{SOCIALSHARE}</div>
</div>
</div>
<hr />
{NEWSRELATED}
<hr>
{NEWSNAVLINK}
';
// @todo add more templates. eg. 'videos' , 'slideshow images', 'full width image' - help and ideas always appreciated.
// Videos
$NEWS_VIEW_TEMPLATE['videos']['item'] = '<div class="view-item"><div class="alert alert-warning">Empty news_view_template.php (videos) - have ideas? let us know.</div></div>';