mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
more news fixes, news category title always shown on news list, more thumbnail shortcode flexibility
This commit is contained in:
@@ -260,16 +260,32 @@ class news_shortcodes extends e_shortcode
|
|||||||
return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : '';
|
return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'<br />' : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - REAL thumbnail - already possible on the fly
|
/**
|
||||||
|
* Auto-thumbnailing now allowed.
|
||||||
|
* New sc parameter standards
|
||||||
|
* Exampes:
|
||||||
|
* - {NEWSTHUMBNAIL=link|w=200} render link with thumbnail max width 200px
|
||||||
|
* - {NEWSTHUMBNAIL=|w=200} same as above
|
||||||
|
* - {NEWSTHUMBNAIL=src|aw=200&ah=200} return thumb link only, size forced to 200px X 200px (smart thumbnailing close to how Facebook is doing it)
|
||||||
|
*
|
||||||
|
* First parameter values: link|src|tag
|
||||||
|
* Second parameter format: aw|w=xxx&ah|ah=xxx
|
||||||
|
*
|
||||||
|
* @see eHelper::scDualParams()
|
||||||
|
* @see eHelper::scParams()
|
||||||
|
*/
|
||||||
function sc_newsthumbnail($parm = '')
|
function sc_newsthumbnail($parm = '')
|
||||||
{
|
{
|
||||||
if(!$this->news_item['news_thumbnail'])
|
if(!$this->news_item['news_thumbnail'])
|
||||||
{
|
{
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$parms = eHelper::scDualParams($parm);
|
||||||
// We store SC path in DB now + BC
|
// We store SC path in DB now + BC
|
||||||
$src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
|
$_src = $src = $this->news_item['news_thumbnail'][0] == '{' ? e107::getParser()->replaceConstants($this->news_item['news_thumbnail'], 'abs') : e_IMAGE_ABS."newspost_images/".$this->news_item['news_thumbnail'];
|
||||||
switch($parm)
|
if($parms[2]) $src = e107::getParser()->thumbUrl($src, $parms[2]);
|
||||||
|
switch($parms[1])
|
||||||
{
|
{
|
||||||
case 'src':
|
case 'src':
|
||||||
return $src;
|
return $src;
|
||||||
@@ -279,6 +295,10 @@ class news_shortcodes extends e_shortcode
|
|||||||
return "<img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' />";
|
return "<img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' />";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'img':
|
||||||
|
return "<a href='".$_src."' rel='external image'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "<a href='".$this->e107->url->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
|
return "<a href='".$this->e107->url->create('news/view/item', $this->news_item)."'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
|
||||||
break;
|
break;
|
||||||
|
33
news.php
33
news.php
@@ -247,7 +247,7 @@ if ($action == 'cat' || $action == 'all')
|
|||||||
}
|
}
|
||||||
$text .= "<div style='text-align:center;'><a href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
|
$text .= "<div style='text-align:center;'><a href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
|
||||||
ob_start();
|
ob_start();
|
||||||
$ns->tablerender($NEWSLISTTITLE, $text);
|
$ns->tablerender($NEWSLISTTITLE, $text, 'news');
|
||||||
$cache_data = ob_get_flush();
|
$cache_data = ob_get_flush();
|
||||||
setNewsCache($cacheString, $cache_data);
|
setNewsCache($cacheString, $cache_data);
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
@@ -525,10 +525,11 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with
|
|||||||
// {
|
// {
|
||||||
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||||
// }
|
// }
|
||||||
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1)
|
// Removed, legacy
|
||||||
{
|
// if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1)
|
||||||
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
// {
|
||||||
}
|
// require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,9 +597,10 @@ if(!$action)
|
|||||||
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
// require_once(e_PLUGIN."featurebox/featurebox.php");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){
|
// Removed, legacy
|
||||||
require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
// if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){
|
||||||
}
|
// require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php");
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php"))
|
if(isset($pref['news_unstemplate']) && $pref['news_unstemplate'] && file_exists(THEME."news_template.php"))
|
||||||
@@ -676,6 +678,21 @@ else
|
|||||||
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
|
// #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) ---------
|
||||||
$param = array();
|
$param = array();
|
||||||
$param['current_action'] = $action;
|
$param['current_action'] = $action;
|
||||||
|
|
||||||
|
// NEW - news category title when in list
|
||||||
|
if($sub_action && vartrue($newsAr[1]['category_name']))
|
||||||
|
{
|
||||||
|
$category_name = $newsAr[1]['category_name'];
|
||||||
|
if(!isset($NEWSLISTCATTITLE))
|
||||||
|
{
|
||||||
|
$NEWSLISTCATTITLE = "<h1 class='newscatlist-title'>".$tp->toHTML($category_name,FALSE,'TITLE')."</h1>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$NEWSLISTCATTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,'TITLE'),$NEWSLISTCATTITLE);
|
||||||
|
}
|
||||||
|
echo $NEWSLISTCATTITLE;
|
||||||
|
}
|
||||||
|
|
||||||
$i= 1;
|
$i= 1;
|
||||||
while(isset($newsAr[$i]) && $i <= $interval) {
|
while(isset($newsAr[$i]) && $i <= $interval) {
|
||||||
|
Reference in New Issue
Block a user