1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

more news fixes, news category title always shown on news list, more thumbnail shortcode flexibility

This commit is contained in:
secretr 2011-11-29 16:07:12 +00:00
parent 2e09bfde63
commit 5945062962
2 changed files with 48 additions and 11 deletions

View File

@ -260,16 +260,32 @@ class news_shortcodes extends e_shortcode
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 = '')
{
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 "<img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' />";
break;
case 'img':
return "<a href='".$_src."' rel='external image'><img class='news_image' src='".$src."' alt='' style='".$this->param['thumbnail']."' /></a>";
break;
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>";
break;

View File

@ -247,7 +247,7 @@ if ($action == 'cat' || $action == 'all')
}
$text .= "<div style='text-align:center;'><a href='".e_SELF."'>".LAN_NEWS_84."</a></div>";
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 = "<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;
while(isset($newsAr[$i]) && $i <= $interval) {