From 594506296217cc4b4d3b70d331c3089bc8e82b39 Mon Sep 17 00:00:00 2001 From: secretr Date: Tue, 29 Nov 2011 16:07:12 +0000 Subject: [PATCH] more news fixes, news category title always shown on news list, more thumbnail shortcode flexibility --- .../shortcodes/batch/news_shortcodes.php | 26 +++++++++++++-- news.php | 33 ++++++++++++++----- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/e107_core/shortcodes/batch/news_shortcodes.php b/e107_core/shortcodes/batch/news_shortcodes.php index f3ea9c26e..afd63b7c1 100644 --- a/e107_core/shortcodes/batch/news_shortcodes.php +++ b/e107_core/shortcodes/batch/news_shortcodes.php @@ -260,16 +260,32 @@ class news_shortcodes extends e_shortcode return ($this->news_item['news_summary']) ? $this->news_item['news_summary'].'
' : ''; } - // 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 = '') { if(!$this->news_item['news_thumbnail']) { return ''; } + + $parms = eHelper::scDualParams($parm); // 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']; - switch($parm) + $_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']; + if($parms[2]) $src = e107::getParser()->thumbUrl($src, $parms[2]); + switch($parms[1]) { case 'src': return $src; @@ -279,6 +295,10 @@ class news_shortcodes extends e_shortcode return ""; break; + case 'img': + return ""; + break; + default: return "news_item)."'>"; break; diff --git a/news.php b/news.php index 1ba0fc491..52452762f 100644 --- a/news.php +++ b/news.php @@ -247,7 +247,7 @@ if ($action == 'cat' || $action == 'all') } $text .= "
".LAN_NEWS_84."
"; ob_start(); - $ns->tablerender($NEWSLISTTITLE, $text); + $ns->tablerender($NEWSLISTTITLE, $text, 'news'); $cache_data = ob_get_flush(); setNewsCache($cacheString, $cache_data); require_once(FOOTERF); @@ -525,10 +525,11 @@ if($newsCachedPage = checkCache($cacheString)) // normal news front-page - with // { // require_once(e_PLUGIN."featurebox/featurebox.php"); // } - if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1) - { - require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); - } + // Removed, legacy + // if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1) + // { + // require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); + // } } @@ -596,9 +597,10 @@ if(!$action) // require_once(e_PLUGIN."featurebox/featurebox.php"); // } - if (isset($pref['nfp_display']) && $pref['nfp_display'] == 1){ - require_once(e_PLUGIN."newforumposts_main/newforumposts_main.php"); - } + // Removed, legacy + // 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")) @@ -676,6 +678,21 @@ else // #### normal newsitems, rendered via render_newsitem(), the $query is changed above (no other changes made) --------- $param = array(); $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 = "

".$tp->toHTML($category_name,FALSE,'TITLE')."

"; + } + else + { + $NEWSLISTCATTITLE = str_replace("{NEWSCATEGORY}",$tp->toHTML($category_name,FALSE,'TITLE'),$NEWSLISTCATTITLE); + } + echo $NEWSLISTCATTITLE; + } $i= 1; while(isset($newsAr[$i]) && $i <= $interval) {